@trackunit/react-components 0.1.63 → 0.1.65-alpha-0b53b6cf53.0

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.
Files changed (2) hide show
  1. package/index.cjs +3222 -0
  2. package/package.json +5 -5
package/index.cjs ADDED
@@ -0,0 +1,3222 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var tailwindStyledComponents = require('@trackunit/tailwind-styled-components');
7
+ var React = require('react');
8
+ var uiIcons = require('@trackunit/ui-icons');
9
+ var reactUse = require('react-use');
10
+ var dateFns = require('date-fns');
11
+ var react = require('@floating-ui/react');
12
+ var reactRouterDom = require('react-router-dom');
13
+ var reactDayPicker = require('react-day-picker');
14
+ var locale = require('date-fns/locale');
15
+ var reactBrowserHooks = require('react-browser-hooks');
16
+ var usePortal = require('react-useportal');
17
+ var reactHelmetAsync = require('react-helmet-async');
18
+ var ReactSelect = require('react-select');
19
+ var ReactAsyncCreatableSelect = require('react-select/async-creatable');
20
+ var ReactCreatableSelect = require('react-select/creatable');
21
+ var ReactAsyncSelect = require('react-select/async');
22
+ var uiDesignTokens = require('@trackunit/ui-design-tokens');
23
+
24
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
25
+
26
+ function _interopNamespace(e) {
27
+ if (e && e.__esModule) return e;
28
+ var n = Object.create(null);
29
+ if (e) {
30
+ Object.keys(e).forEach(function (k) {
31
+ if (k !== 'default') {
32
+ var d = Object.getOwnPropertyDescriptor(e, k);
33
+ Object.defineProperty(n, k, d.get ? d : {
34
+ enumerable: true,
35
+ get: function () { return e[k]; }
36
+ });
37
+ }
38
+ });
39
+ }
40
+ n["default"] = e;
41
+ return Object.freeze(n);
42
+ }
43
+
44
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
45
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
46
+ var usePortal__default = /*#__PURE__*/_interopDefaultLegacy(usePortal);
47
+ var ReactSelect__default = /*#__PURE__*/_interopDefaultLegacy(ReactSelect);
48
+ var ReactAsyncCreatableSelect__default = /*#__PURE__*/_interopDefaultLegacy(ReactAsyncCreatableSelect);
49
+ var ReactCreatableSelect__default = /*#__PURE__*/_interopDefaultLegacy(ReactCreatableSelect);
50
+ var ReactAsyncSelect__default = /*#__PURE__*/_interopDefaultLegacy(ReactAsyncSelect);
51
+
52
+ const docs = {
53
+ source: {
54
+ type: "dynamic",
55
+ excludeDecorators: true,
56
+ },
57
+ };
58
+
59
+ /**
60
+ * Utility for common props on containers.
61
+ *
62
+ * @param {UseContainerProps} ContainerProps - Props for the utility
63
+ * @param {string} ContainerProps.className - Optional custom className
64
+ * @param {string} ContainerProps.dataTestId - Optional custom data-TestId
65
+ * @returns {UseContainerProps} - Object with undefined values removed
66
+ */
67
+ const useContainerProps = ({ className, dataTestId }) => {
68
+ const containerProps = { className, "data-testid": dataTestId };
69
+ if (containerProps["data-testid"] === undefined) {
70
+ delete containerProps["data-testid"];
71
+ }
72
+ if (containerProps.className === undefined) {
73
+ delete containerProps.className;
74
+ }
75
+ return containerProps;
76
+ };
77
+
78
+ /******************************************************************************
79
+ Copyright (c) Microsoft Corporation.
80
+
81
+ Permission to use, copy, modify, and/or distribute this software for any
82
+ purpose with or without fee is hereby granted.
83
+
84
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
85
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
86
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
87
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
88
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
89
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
90
+ PERFORMANCE OF THIS SOFTWARE.
91
+ ***************************************************************************** */
92
+
93
+ function __rest(s, e) {
94
+ var t = {};
95
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
96
+ t[p] = s[p];
97
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
98
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
99
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
100
+ t[p[i]] = s[p[i]];
101
+ }
102
+ return t;
103
+ }
104
+
105
+ function __awaiter(thisArg, _arguments, P, generator) {
106
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
107
+ return new (P || (P = Promise))(function (resolve, reject) {
108
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
109
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
110
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
111
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
112
+ });
113
+ }
114
+
115
+ /**
116
+ * The spinner component provides visual feedback that data is being processed.
117
+ *
118
+ * Spinners are used when performing actions. They notify to the user that their request is being processed. Although they do not provide details about what is occurring on the back-end, they reassure the user that their action is being processed.
119
+ *
120
+ * Common actions that benefit from spinners include any create, update, or delete actions that may have a lot of data to process. It can be used in a table, after a primary or secondary button click, or even in a modal.
121
+ *
122
+ * Use a spinner component for any action that cannot be performed instantly and will only require a short time (between 1 to 5 seconds) to process.
123
+ *
124
+ * Use when retrieving or refreshing small data amounts, such as status.
125
+ *
126
+ * @param {SpinnerProps} props - The props for the Spinner component
127
+ * @returns {JSX.Element} Spinner component
128
+ */
129
+ const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId, }) => {
130
+ return (jsxRuntime.jsx(Container$9, Object.assign({ "$mode": mode, "$centering": centering, className: containerClassName }, { children: jsxRuntime.jsx(StyledSpinner$1, { "$size": size, "$mode": mode, role: "spinbutton", className: className, "data-testid": dataTestId }) })));
131
+ };
132
+ const getSpinnerStyles = () => ({ $size }) => {
133
+ switch ($size) {
134
+ case "small":
135
+ return tailwindStyledComponents.tws `tu-spinner--small`;
136
+ case "large":
137
+ return tailwindStyledComponents.tws `tu-spinner--large`;
138
+ case "medium":
139
+ default:
140
+ return;
141
+ }
142
+ };
143
+ const getCenteringStyles = () => ({ $centering }) => {
144
+ switch ($centering) {
145
+ case "centered":
146
+ return tailwindStyledComponents.tws `tu-spinner--container-centered`;
147
+ case "horizontally":
148
+ return tailwindStyledComponents.tws `tu-spinner--container-centered-horizontally`;
149
+ case "vertically":
150
+ return tailwindStyledComponents.tws `tu-spinner--container-centered-vertically`;
151
+ default:
152
+ return;
153
+ }
154
+ };
155
+ const StyledSpinner$1 = tailwindStyledComponents.tw.span `
156
+ tu-spinner
157
+ ${p => (p.$mode === "dark" ? tailwindStyledComponents.tws `tu-spinner--dark` : null)}
158
+ ${getSpinnerStyles()}
159
+ `;
160
+ const Container$9 = tailwindStyledComponents.tw.div `
161
+ tu-spinner--container
162
+ ${getCenteringStyles()}
163
+
164
+ `;
165
+
166
+ /**
167
+ * Helper to get the needed classname from buttonProps.
168
+ *
169
+ * @returns {string} - Classnames for the button
170
+ */
171
+ const getStyles = () => ({ $color, $variant }) => {
172
+ const styles = {
173
+ filled: {
174
+ primary: tailwindStyledComponents.tws `tu-button--primary`,
175
+ secondary: tailwindStyledComponents.tws `tu-button--secondary`,
176
+ danger: tailwindStyledComponents.tws `tu-button--danger`,
177
+ tertiary: tailwindStyledComponents.tws `tu-button--tertiary`,
178
+ warning: tailwindStyledComponents.tws `tu-button--warning`,
179
+ },
180
+ transparent: {
181
+ primary: tailwindStyledComponents.tws `tu-button--transparent-primary`,
182
+ secondary: tailwindStyledComponents.tws `tu-button--transparent-secondary`,
183
+ danger: tailwindStyledComponents.tws `tu-button--transparent-danger`,
184
+ tertiary: tailwindStyledComponents.tws `tu-button--transparent-tertiary`,
185
+ warning: tailwindStyledComponents.tws `tu-button--transparent-warning`,
186
+ },
187
+ };
188
+ return styles[$variant][$color];
189
+ };
190
+ /**
191
+ * Helper to get the needed classname for padding.
192
+ *
193
+ * @returns {string} - The correct class for setting padding.
194
+ */
195
+ const getPadding = () => ({ $size }) => {
196
+ switch ($size) {
197
+ case "small":
198
+ return tailwindStyledComponents.tws `tu-button--small`;
199
+ case "large":
200
+ return tailwindStyledComponents.tws `tu-button--large`;
201
+ default:
202
+ return "";
203
+ }
204
+ };
205
+
206
+ /**
207
+ * Buttons allow users to perform an action when triggered.
208
+ *
209
+ * @param {ButtonProps} props - The props for the Button component
210
+ * @returns {JSX.Element} Button component
211
+ */
212
+ const Button = React__namespace.forwardRef((_a, ref) => {
213
+ var { onClick, children, loading, disabled, className, fullWidth = false, prefix, suffix, color = "primary", variant = "filled", type = "button", size = "medium", square = false, dataTestId, title, role, tabIndex, renderAs = "button" } = _a, rest = __rest(_a, ["onClick", "children", "loading", "disabled", "className", "fullWidth", "prefix", "suffix", "color", "variant", "type", "size", "square", "dataTestId", "title", "role", "tabIndex", "renderAs"]);
214
+ return (jsxRuntime.jsxs(StyledButton$1, Object.assign({ "$as": renderAs, onClick: onClick, disabled: disabled || loading, type: type, className: className, "$color": color, "$fullWidth": fullWidth, "$variant": variant, "$size": size, "$square": square, title: title, "aria-label": title, role: role, tabIndex: tabIndex, "data-testid": dataTestId, ref: ref }, rest, { children: [loading && jsxRuntime.jsx(StyledSpinner, { centering: "vertically" }), prefix, children, suffix] })));
215
+ });
216
+ const StyledButton$1 = tailwindStyledComponents.tw.button `
217
+ tu-button
218
+ ${p => p.$square && tailwindStyledComponents.tws `tu-button--square`}
219
+ ${p => p.$fullWidth && tailwindStyledComponents.tws `tu-button--full-width`}
220
+ ${p => p.disabled &&
221
+ p.$as !== "button" &&
222
+ (p.$variant === "transparent" ? tailwindStyledComponents.tws `tu-button__disabled--transparent` : tailwindStyledComponents.tws `tu-button__disabled`)}
223
+ ${getStyles()}
224
+ ${getPadding()}
225
+ `;
226
+ const StyledSpinner = tailwindStyledComponents.twx(Spinner) `
227
+ tu-button__spinner
228
+ `;
229
+
230
+ const IconButton = React__namespace.forwardRef((_a, ref) => {
231
+ var { icon, size = "small", square = true, circular, loading, disabled } = _a, rest = __rest(_a, ["icon", "size", "square", "circular", "loading", "disabled"]);
232
+ return (jsxRuntime.jsx(StyledButton, Object.assign({ size: size, square: square, "$circular": circular, disabled: disabled || loading, ref: ref }, rest, { children: jsxRuntime.jsx(IconContainer$2, { children: loading ? jsxRuntime.jsx(Spinner, { size: size }) : icon }) })));
233
+ });
234
+ const StyledButton = tailwindStyledComponents.twx(Button) `
235
+ ${p => (p.$circular ? tailwindStyledComponents.tws `tu-button--rounded` : null)}
236
+ `;
237
+ const IconContainer$2 = tailwindStyledComponents.tw.div `
238
+ tu-button__container
239
+ ${p => (p.$size === "small" ? tailwindStyledComponents.tws `tu-button__container--small` : null)}
240
+ `;
241
+
242
+ const IconSizeClassMap = {
243
+ small: tailwindStyledComponents.tws `tu-icon--small`,
244
+ medium: tailwindStyledComponents.tws `tu-icon--medium`,
245
+ large: tailwindStyledComponents.tws `tu-icon--large`, // 24x24px
246
+ };
247
+ /**
248
+ * - The Icon component is used to display an Icon.
249
+ * - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
250
+ * - All the [HeroIcons](https://heroicons.dev/) as well as custom TrackUnit icons are available.
251
+ *
252
+ * @param {IconProps} props - The props for the Icon component
253
+ * @returns {JSX.Element} Icon component
254
+ */
255
+ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
256
+ const iconSizeClassName = React__namespace.useMemo(() => IconSizeClassMap[size], [size]);
257
+ const correctIconType = React__namespace.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
258
+ const colorClassNames = React__namespace.useMemo(() => (correctIconType === "solid" ? tailwindStyledComponents.tws `fill-current stroke-transparent` : tailwindStyledComponents.tws `fill-transparent stroke-current`), [correctIconType]);
259
+ let IconComponent = null;
260
+ if (uiIcons.HeroIconsArray.find(icon => icon === name)) {
261
+ IconComponent = uiIcons.heroIconLookup(name, correctIconType);
262
+ }
263
+ else if (uiIcons.TrackunitSolidIconsArray.find(icon => icon === name) ||
264
+ uiIcons.TrackunitOutlineIconsArray.find(icon => icon === name)) {
265
+ IconComponent = uiIcons.trackunitIconLookup(name, correctIconType);
266
+ }
267
+ if (!IconComponent) {
268
+ return null;
269
+ }
270
+ return (jsxRuntime.jsx(React__namespace.Suspense, Object.assign({ fallback: jsxRuntime.jsx(LoadingDot, { className: iconSizeClassName }) }, { children: jsxRuntime.jsx(Root$9, 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) }) })) })));
271
+ };
272
+ const LoadingDot = tailwindStyledComponents.tw.span `
273
+ tu-loading-dot
274
+ `;
275
+ const Root$9 = tailwindStyledComponents.tw.span `
276
+ tu-icon
277
+ ${({ $color }) => {
278
+ switch ($color) {
279
+ case "primary":
280
+ return tailwindStyledComponents.tws `tu-icon--primary`;
281
+ case "secondary":
282
+ return tailwindStyledComponents.tws `tu-icon--secondary`;
283
+ case "accent":
284
+ return tailwindStyledComponents.tws `tu-icon--accent`;
285
+ case "neutral":
286
+ return tailwindStyledComponents.tws `tu-icon--neutral`;
287
+ case "info":
288
+ return tailwindStyledComponents.tws `tu-icon--info`;
289
+ case "success":
290
+ return tailwindStyledComponents.tws `tu-icon--success`;
291
+ case "warning":
292
+ return tailwindStyledComponents.tws `tu-icon--warning`;
293
+ case "danger":
294
+ return tailwindStyledComponents.tws `tu-icon--danger`;
295
+ case "good":
296
+ return tailwindStyledComponents.tws `tu-icon--good`;
297
+ case "low":
298
+ return tailwindStyledComponents.tws `tu-icon--low`;
299
+ case "critical":
300
+ return tailwindStyledComponents.tws `tu-icon--critical`;
301
+ case "working":
302
+ return tailwindStyledComponents.tws `tu-icon--working`;
303
+ case "idle":
304
+ return tailwindStyledComponents.tws `tu-icon--idle`;
305
+ case "stopped":
306
+ return tailwindStyledComponents.tws `tu-icon--stopped`;
307
+ case "moving":
308
+ return tailwindStyledComponents.tws `tu-icon--moving`;
309
+ case "unknown":
310
+ return tailwindStyledComponents.tws `tu-icon--unknown`;
311
+ case "white":
312
+ return tailwindStyledComponents.tws `text-white`;
313
+ default:
314
+ return "tu-icon--default";
315
+ }
316
+ }}
317
+ `;
318
+
319
+ /**
320
+ * The ActionButton component is a wrapper over IconButton to perform an action when the onClick event is triggered.
321
+ *
322
+ * @param {ActionButtonProps} props - The props for the ActionButton component
323
+ * @returns {JSX.Element} ActionButton component
324
+ */
325
+ const ActionButton = ({ type, value, dataTestId, iconSize, disabled }) => {
326
+ const getIconName = () => {
327
+ switch (type) {
328
+ case "PHONE_NUMBER":
329
+ return "PhoneArrowUpRightIcon";
330
+ case "WEB_ADDRESS":
331
+ return "ArrowTopRightOnSquareIcon";
332
+ case "EMAIL":
333
+ default:
334
+ return "EnvelopeIcon";
335
+ }
336
+ };
337
+ const ButtonAction = () => {
338
+ switch (type) {
339
+ case "EMAIL":
340
+ return window.open(`mailto:${value}`);
341
+ case "WEB_ADDRESS":
342
+ if (value) {
343
+ return window.open(value, "_blank", "noopener,noreferrer");
344
+ }
345
+ return null;
346
+ case "PHONE_NUMBER":
347
+ default:
348
+ return window.open(`tel:${value}`);
349
+ }
350
+ };
351
+ 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 }) }));
352
+ };
353
+ const ActionContainer = tailwindStyledComponents.tw.div `
354
+ tu-action-container
355
+ `;
356
+ const StyledIconButton = tailwindStyledComponents.twx(IconButton) `
357
+ tu-action-button
358
+ ${({ $fieldSize }) => $fieldSize === "small" && tailwindStyledComponents.tws `tu-action-button--small`}
359
+ `;
360
+
361
+ /**
362
+ * The StarButton component is used for favorite actions or similar.
363
+ *
364
+ * @param {StarButtonProps} props - The props for the StarButton component
365
+ * @returns {JSX.Element} StarButton component
366
+ */
367
+ const StarButton = ({ starred, onClick }) => {
368
+ return (jsxRuntime.jsx(Flex$2, Object.assign({ onClick: onClick, "data-test-id": "starred-filter" }, { children: jsxRuntime.jsx(CustomIcon, { name: "StarIcon", "$starred": starred }) })));
369
+ };
370
+ const Flex$2 = tailwindStyledComponents.tw.div `
371
+ flex
372
+ items-center
373
+ `;
374
+ const CustomIcon = tailwindStyledComponents.twx(Icon) `
375
+ cursor-pointer
376
+ w-5
377
+ h-5
378
+ hover:!fill-primary-400
379
+ hover:!stroke-transparent
380
+ ${p => (p.$starred ? tailwindStyledComponents.tws `!fill-primary-600 !stroke-transparent` : tailwindStyledComponents.tws `!fill-transparent !stroke-neutral-800`)}
381
+ `;
382
+
383
+ /**
384
+ * The Text component is used to apply Trackunit default typography styles to text.
385
+ *
386
+ * ### When to use
387
+ *
388
+ * Use Text when you want to show a text section, use Heading if you want to show a heading.
389
+ *
390
+ * @param {TextProps} props - The props for the Text component
391
+ * @returns {JSX.Element} Text component
392
+ */
393
+ const Text$1 = ({ children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, className, dataTestId, }) => {
394
+ return (jsxRuntime.jsx(StyledText$4, Object.assign({ "$as": type, className: className, "$align": align, "$inverted": inverted, "$subtle": subtle, "$italicize": italicize, "$uppercase": uppercase, "$size": size, "$weight": weight, "$underline": underline, "data-testid": dataTestId }, { children: children })));
395
+ };
396
+ const getTextSize = () => ({ $size }) => {
397
+ const sizes = {
398
+ small: tailwindStyledComponents.tws `tu-text--small`,
399
+ large: tailwindStyledComponents.tws `tu-text--large`,
400
+ default: null,
401
+ };
402
+ return sizes[$size];
403
+ };
404
+ const getTextWeight = () => ({ $weight }) => {
405
+ const weights = {
406
+ thick: tailwindStyledComponents.tws `tu-text--medium`,
407
+ bold: tailwindStyledComponents.tws `tu-text--semibold`,
408
+ default: null,
409
+ };
410
+ return weights[$weight];
411
+ };
412
+ const getFontColor$1 = () => ({ $inverted, $subtle }) => {
413
+ const subtle = $inverted ? tailwindStyledComponents.tws `tu-text--subtle-inverted` : tailwindStyledComponents.tws `tu-text--subtle`;
414
+ const inverted = $inverted ? tailwindStyledComponents.tws `tu-text--inverted` : null;
415
+ return $subtle ? subtle : inverted;
416
+ };
417
+ const getTextAlignment = () => ({ $align }) => {
418
+ const alignments = {
419
+ left: tailwindStyledComponents.tws `tu-text--align-left`,
420
+ center: tailwindStyledComponents.tws `tu-text--align-center`,
421
+ right: tailwindStyledComponents.tws `tu-text--align-right`,
422
+ };
423
+ return alignments[$align];
424
+ };
425
+ const StyledText$4 = tailwindStyledComponents.tw.text `
426
+ tu-text
427
+ ${getFontColor$1()}
428
+ ${p => (p.$italicize ? tailwindStyledComponents.tws `tu-text--italic` : "")}
429
+ ${p => (p.$uppercase ? tailwindStyledComponents.tws `tu-text--uppercase` : "")}
430
+ ${getTextAlignment()}
431
+ ${p => (p.$underline ? tailwindStyledComponents.tws `tu-text--underline` : "")}
432
+ ${getTextSize()}
433
+ ${getTextWeight()}
434
+ `;
435
+
436
+ /**
437
+ * The Alert component should be used to inform the user of important information.
438
+ *
439
+ * @param {AlertProps} props - The props for the Alert component
440
+ * @returns {JSX.Element} Alert component
441
+ */
442
+ const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, inline = false, }) => {
443
+ const ref = React__namespace.useRef();
444
+ const getIconFromColor = () => {
445
+ switch (color) {
446
+ case "danger":
447
+ return jsxRuntime.jsx(Icon, { name: "ExclamationTriangleIcon", color: "danger" });
448
+ case "warning":
449
+ return jsxRuntime.jsx(Icon, { name: "ExclamationCircleIcon", color: "warning" });
450
+ case "success":
451
+ return jsxRuntime.jsx(Icon, { name: "CheckCircleIcon", color: "success" });
452
+ default:
453
+ return jsxRuntime.jsx(Icon, { name: "InformationCircleIcon" });
454
+ }
455
+ };
456
+ const getButtonColor = () => {
457
+ switch (color) {
458
+ case "danger":
459
+ return "danger";
460
+ case "warning":
461
+ return "warning";
462
+ default:
463
+ return "primary";
464
+ }
465
+ };
466
+ 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$2, 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$2, Object.assign({ weight: !title ? "bold" : "normal", "$hasTitle": !!title }, { children: children })))] }));
467
+ React__namespace.useEffect(() => {
468
+ if (autoScroll) {
469
+ ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
470
+ }
471
+ }, [ref, autoScroll]);
472
+ return (jsxRuntime.jsxs(Container$8, 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] })))] }))] })));
473
+ };
474
+ const CloseButtonContainer = tailwindStyledComponents.tw.div `
475
+ ${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert__close-button-container--inline` : tailwindStyledComponents.tws `tu-alert__close-button-container`)}
476
+ `;
477
+ const getBackgroundColor = () => ({ $color }) => {
478
+ const colors = {
479
+ danger: tailwindStyledComponents.tws `tu-alert--danger`,
480
+ warning: tailwindStyledComponents.tws `tu-alert--warning`,
481
+ success: tailwindStyledComponents.tws `tu-alert--success`,
482
+ info: tailwindStyledComponents.tws `tu-alert--info`,
483
+ };
484
+ return colors[$color];
485
+ };
486
+ const Container$8 = tailwindStyledComponents.tw.div `
487
+ tu-alert
488
+ ${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert--inline` : null)}
489
+ ${getBackgroundColor()}
490
+ `;
491
+ const Content$1 = tailwindStyledComponents.tw.div `
492
+ ${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert__content--inline` : tailwindStyledComponents.tws `tu-alert__content`)}
493
+ `;
494
+ const ContentDetails = tailwindStyledComponents.tw.div `
495
+ tu-alert__content-details
496
+ `;
497
+ const ContentBody = tailwindStyledComponents.tw.div `
498
+ tu-alert__content-body
499
+ `;
500
+ const Description$2 = tailwindStyledComponents.twx(Text$1) `
501
+ ${p => (p.$hasTitle ? tailwindStyledComponents.tws `tu-alert__description` : null)}
502
+ `;
503
+ const RightAligned = tailwindStyledComponents.tw.div `
504
+ tu-alert__right-aligned
505
+ ${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert__right-aligned--inline` : null)}
506
+ `;
507
+ const IconContainer$1 = tailwindStyledComponents.tw.div `
508
+ tu-alert__icon-container
509
+ ${p => (p.$inline ? tailwindStyledComponents.tws `tu-alert__icon-container--inline` : null)}
510
+ `;
511
+
512
+ /**
513
+ * The Badge component is used to display a notification badge with an optional number value.
514
+ *
515
+ * @param {BadgeProps} props - The props for the Badge component
516
+ * @returns {JSX.Element} Badge component
517
+ */
518
+ const Badge = (_a) => {
519
+ var { color = "primary", subtle = false, className, count, max, hideZero = false, dataTestId } = _a; __rest(_a, ["color", "subtle", "className", "count", "max", "hideZero", "dataTestId"]);
520
+ if (hideZero && count === 0) {
521
+ return null;
522
+ }
523
+ const displayedCount = count && max ? (count > max ? `${max}+` : count) : count;
524
+ return (jsxRuntime.jsx(StyledText$3, Object.assign({ className: className, "$color": color, "$subtle": subtle, "$count": count, "data-testid": dataTestId, "$as": "span" }, { children: displayedCount })));
525
+ };
526
+ const getBadgeModifierClass = () => ({ $color, $subtle }) => {
527
+ const colorClasses = {
528
+ primary: $subtle ? tailwindStyledComponents.tws `tu-badge--primary-subtle` : tailwindStyledComponents.tws `tu-badge--primary`,
529
+ danger: $subtle ? tailwindStyledComponents.tws `tu-badge--danger-subtle` : tailwindStyledComponents.tws `tu-badge--danger`,
530
+ };
531
+ return colorClasses[$color];
532
+ };
533
+ const StyledText$3 = tailwindStyledComponents.tw.text `
534
+ tu-badge
535
+ ${({ $count }) => ($count === null || $count === undefined) && tailwindStyledComponents.tws `tu-badge--square`}
536
+ ${getBadgeModifierClass()}
537
+ `;
538
+
539
+ /**
540
+ * A base input component that can be used for text inputs, password inputs, etc.
541
+ * A reference to the input element is provided as the `ref` prop.
542
+ * Extends props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
543
+ *
544
+ * For specific input types make sure to use the corresponding input component.
545
+ * This is a base used by our other input components such as TextInput, NumberInput, PasswordInput, etc.
546
+ */
547
+ const BaseInput = React__namespace.forwardRef((_a, ref) => {
548
+ 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"]);
549
+ 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] })));
550
+ });
551
+ const InputPrefix = tailwindStyledComponents.tw.div `
552
+ tu-input__prefix
553
+ `;
554
+ const InputSuffix = tailwindStyledComponents.tw.div `
555
+ tu-input__suffix
556
+ `;
557
+ const AddonBefore = tailwindStyledComponents.tw.div `
558
+ tu-input__addon-before
559
+ `;
560
+ const AddonAfter = tailwindStyledComponents.tw.div `
561
+ tu-input__addon-after
562
+ `;
563
+ const InputContainer$1 = tailwindStyledComponents.tw.label `
564
+ tu-input
565
+ ${({ $invalid }) => ($invalid ? tailwindStyledComponents.tws `tu-input--invalid` : null)}
566
+ ${({ $disabled }) => ($disabled ? tailwindStyledComponents.tws `tu-input--disabled` : null)}
567
+ ${({ $fieldSize }) => ($fieldSize === "small" ? tailwindStyledComponents.tws `tu-input--small` : null)}
568
+ `;
569
+
570
+ const ROLE_CARD = "region";
571
+ /**
572
+ * The Card component is a container for UI elements, and is the main component of the modal.
573
+ * To get the most out of the Card, use it in combination with the CardHeader, CardBody and CardFooter.
574
+ *
575
+ * @param {CardProps} props - The props for the Card component
576
+ * @returns {JSX.Element} Card component
577
+ */
578
+ const Card = (_a) => {
579
+ var { children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, dataTestId, overflow = "visible", gridArea } = _a, rest = __rest(_a, ["children", "onClick", "fullHeight", "onMouseEnter", "onMouseLeave", "className", "dataTestId", "overflow", "gridArea"]);
580
+ return (jsxRuntime.jsx(StyledCard$2, Object.assign({}, rest, { "$fullHeight": fullHeight, "$overflow": overflow, onClick: onClick, className: className, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, "data-testid": dataTestId, role: ROLE_CARD, style: { gridArea } }, { children: children })));
581
+ };
582
+ const getOverflow$1 = () => ({ $overflow }) => {
583
+ if (!$overflow) {
584
+ return null;
585
+ }
586
+ const overflows = {
587
+ visible: tailwindStyledComponents.tws `overflow-visible`,
588
+ hidden: tailwindStyledComponents.tws `overflow-hidden`,
589
+ scroll: tailwindStyledComponents.tws `overflow-scroll`,
590
+ auto: tailwindStyledComponents.tws `overflow-auto`,
591
+ };
592
+ return overflows[$overflow];
593
+ };
594
+ const StyledCard$2 = tailwindStyledComponents.tw.div `
595
+ tu-card
596
+ ${p => (p.$fullHeight ? `h-full` : null)}
597
+
598
+ ${p => p.onClick && `tu-card--clickable`}
599
+ ${getOverflow$1()}
600
+ `;
601
+
602
+ /**
603
+ * The DensityContainer component applies gap and padding.
604
+ * The padding should live here, and not on the Card itself, as to not inset the scrollbar in case of overflow.
605
+ *
606
+ * @summary For applying auto padding and gap to a Card or Modal or whatever.
607
+ * @param {ContainerProps} props - The props for the DensityContainer component
608
+ * @returns {JSX.Element} DensityContainer component
609
+ */
610
+ const DensityContainer = ({ children, className, dataTestId, density, disableGap, direction, }) => {
611
+ return (jsxRuntime.jsx(StyledDensityContainer$1, Object.assign({ "$disableGap": disableGap, "$density": density, "$direction": direction, "data-testid": dataTestId, className: className }, { children: children })));
612
+ };
613
+ const getDirection = () => ({ $direction }) => {
614
+ $direction = $direction !== null && $direction !== void 0 ? $direction : "column";
615
+ const directions = {
616
+ row: tailwindStyledComponents.tws `flex-row`,
617
+ "row-reverse": tailwindStyledComponents.tws `flex-row-reverse`,
618
+ column: tailwindStyledComponents.tws `flex-col`,
619
+ "column-reverse": tailwindStyledComponents.tws `flex-col-reverse`,
620
+ };
621
+ return directions[$direction];
622
+ };
623
+ const densityAuto = tailwindStyledComponents.tws `
624
+ component-card-spacing
625
+ sm:component-card-spacing-sm
626
+ md:component-card-spacing-md
627
+ `;
628
+ const DensityFinder = ({ $density }) => {
629
+ switch ($density) {
630
+ case "none":
631
+ return;
632
+ case "compact":
633
+ return tailwindStyledComponents.tws `gap-3 p-3`;
634
+ case "comfortable":
635
+ return tailwindStyledComponents.tws `gap-4 p-4`;
636
+ case "spacious":
637
+ return tailwindStyledComponents.tws `gap-4 p-6`;
638
+ case "auto":
639
+ default:
640
+ return densityAuto;
641
+ }
642
+ };
643
+ const StyledDensityContainer$1 = tailwindStyledComponents.tw.div `
644
+ flex
645
+ ${getDirection()}
646
+ ${p => (p.$disableGap ? tailwindStyledComponents.tws `gap-0` : null)}
647
+ ${DensityFinder}
648
+ `;
649
+
650
+ /**
651
+ * The CardBody component should be used to inform the user of important information.
652
+ *
653
+ * @summary For applying padding and gap to a Card.
654
+ * @description The padding must live here, and not on the Card itself, as to not inset the scrollbar in case of overflow
655
+ * @param {CardBodyProps} props - The props for the CardBody component
656
+ * @returns {JSX.Element} CardBody component
657
+ */
658
+ const CardBody = ({ density = "auto", overflow = "auto", children, dataTestId, className, disableGap, }) => {
659
+ return (jsxRuntime.jsx(StyledDensityContainer, Object.assign({ "$overflow": overflow, density: density, dataTestId: dataTestId, className: className, disableGap: disableGap }, { children: children })));
660
+ };
661
+ const getOverflow = () => ({ $overflow }) => {
662
+ if (!$overflow) {
663
+ return null;
664
+ }
665
+ const overflows = {
666
+ visible: tailwindStyledComponents.tws `overflow-visible`,
667
+ hidden: tailwindStyledComponents.tws `overflow-hidden`,
668
+ scroll: tailwindStyledComponents.tws `overflow-scroll`,
669
+ auto: tailwindStyledComponents.tws `overflow-auto`,
670
+ };
671
+ return overflows[$overflow];
672
+ };
673
+ const StyledDensityContainer = tailwindStyledComponents.twx(DensityContainer) `
674
+ ${getOverflow()}
675
+ tu-card__body
676
+ `;
677
+
678
+ /**
679
+ * A simple footer intended to use with Cards and Modals.
680
+ * Currently only intended to contain Buttons.
681
+ * The buttons justifies to the right, but if you style a button with "margin-right: auto" it will move to the left
682
+ *
683
+ * @param {CardFooterProps} props - The props for the CardFooter component
684
+ * @returns {JSX.Element} CardFooter component
685
+ */
686
+ const CardFooter = ({ dataTestId, className, children, density, hideSeparator = false }) => {
687
+ return (jsxRuntime.jsx(Container$7, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density, direction: "row" }, { children: children })));
688
+ };
689
+ const Container$7 = tailwindStyledComponents.twx(DensityContainer) `
690
+ tu-card__footer-density-container
691
+ ${p => p.$hideSeparator && tailwindStyledComponents.tws `tu-card__footer-density-container--borderless`}
692
+ `;
693
+
694
+ /**
695
+ * The Heading is used for a heading of a section (h1,h2,h3,h4).
696
+ *
697
+ * @param {HeadingProps} props - The props for the Heading component
698
+ * @returns {JSX.Element} Heading component
699
+ */
700
+ const Heading$1 = ({ children, variant = "primary", inverted = false, subtle = false, className, dataTestId, }) => {
701
+ const semanticType = {
702
+ primary: "h1",
703
+ secondary: "h2",
704
+ tertiary: "h3",
705
+ subtitle: "h4",
706
+ };
707
+ return (jsxRuntime.jsx(StyledHeading, Object.assign({ "$as": semanticType[variant], className: className, "$variant": variant, "$inverted": inverted, "$subtle": subtle, "data-testid": dataTestId }, { children: children })));
708
+ };
709
+ const getVariantStyles = () => ({ $variant }) => {
710
+ const variants = {
711
+ primary: tailwindStyledComponents.tws `tu-heading--primary`,
712
+ secondary: tailwindStyledComponents.tws `tu-heading--secondary`,
713
+ tertiary: tailwindStyledComponents.tws `tu-heading--tertiary`,
714
+ subtitle: tailwindStyledComponents.tws `tu-heading--subtitle`,
715
+ };
716
+ return variants[$variant];
717
+ };
718
+ const getFontColor = () => ({ $inverted, $subtle }) => {
719
+ const subtle = $inverted ? tailwindStyledComponents.tws `tu-heading--subtle-inverted` : tailwindStyledComponents.tws `tu-heading--subtle`;
720
+ const inverted = $inverted ? tailwindStyledComponents.tws `tu-heading--inverted` : null;
721
+ return $subtle ? subtle : inverted;
722
+ };
723
+ const StyledHeading = tailwindStyledComponents.tw.div `
724
+ tu-heading
725
+ ${getFontColor()}
726
+ ${getVariantStyles()}
727
+ `;
728
+
729
+ /**
730
+ * Header for Cards and Modals.
731
+ *
732
+ * @param {CardHeaderProps} props - The props for the CardHeader component
733
+ * @returns {JSX.Element} CardHeader component
734
+ */
735
+ const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
736
+ return (jsxRuntime.jsx(Root$8, Object.assign({ dataTestId: dataTestId, className: className, "$hideSeparator": hideSeparator, density: density }, { children: jsxRuntime.jsxs(Container$6, { 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" }))] }) })));
737
+ };
738
+ const Root$8 = tailwindStyledComponents.twx(DensityContainer) `
739
+ tu-card__header-density-container
740
+ ${p => p.$hideSeparator && tailwindStyledComponents.tws `tu-card__header-density-container--borderless`}
741
+ `;
742
+ const Container$6 = tailwindStyledComponents.tw.div `
743
+ tu-card__header
744
+ `;
745
+ const HeadingContainer$1 = tailwindStyledComponents.tw.div `
746
+ tu-card__header-heading-container
747
+ `;
748
+
749
+ /**
750
+ * The Label component is used for labels for input fields.
751
+ * This component is **not used directly**, but is part of the FormGroup and Field components.
752
+ *
753
+ * @param {LabelProps} props - The props for the Label component
754
+ * @returns {JSX.Element} Label component
755
+ */
756
+ const Label$2 = ({ id, htmlFor, children, className, dataTestId, disabled, isInvalid, }) => {
757
+ return (jsxRuntime.jsx(Root$7, Object.assign({ id: id || "", htmlFor: htmlFor || "", className: className, "data-testid": dataTestId, "$disabled": disabled, "$isInvalid": isInvalid }, { children: children })));
758
+ };
759
+ const Root$7 = tailwindStyledComponents.tw.label `
760
+ tu-label
761
+ ${({ $disabled }) => $disabled && tailwindStyledComponents.tws `tu-label--disabled`}
762
+ ${({ $isInvalid }) => $isInvalid && tailwindStyledComponents.tws `tu-label--invalid`}
763
+ `;
764
+
765
+ /**
766
+ * The CheckIcon component is used by the checkbox to display the checked state.
767
+ *
768
+ * @param {CheckIconProps} props - The props for the CheckIcon component
769
+ * @returns {JSX.Element} CheckIcon component
770
+ */
771
+ const CheckIcon = ({ className, dataTestId }) => {
772
+ 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" }) })));
773
+ };
774
+
775
+ /**
776
+ * The IndeterminateIcon component is used by the checkbox to display the Indeterminate state.
777
+ *
778
+ * @param {IndeterminateIconProps} props - The props for the IndeterminateIcon component
779
+ * @returns {JSX.Element} IndeterminateIcon component
780
+ */
781
+ 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" }) })));
782
+
783
+ /**
784
+ * Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.
785
+ *
786
+ * 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.
787
+ *
788
+ * _**Do use** checkboxes to allow selection in a form, for filtering, terms and conditions to indicate agreement, and bulk actions in lists or tables._
789
+ *
790
+ * _**Do not use** checkboxes if the user can only select one option from a list, radio buttons should be used instead of checkboxes._
791
+ *
792
+ * @description A reference to the input element is provided as the `ref` prop.
793
+ * @augments props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
794
+ * @param {CheckboxProps} props - The props for the Checkbox component
795
+ * @returns {JSX.Element} Checkbox component
796
+ */
797
+ const Checkbox = React__namespace.forwardRef((_a, ref) => {
798
+ 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"]);
799
+ const icon = indeterminate ? jsxRuntime.jsx(StyledIndeterminateIcon, {}) : checked && jsxRuntime.jsx(StyledCheckIcon, {});
800
+ const internalRef = React__namespace.useRef(null);
801
+ const isReadonly = disabled || readOnly;
802
+ const onKeyPress = e => {
803
+ var _a;
804
+ if ("Space" === e.code) {
805
+ (_a = internalRef === null || internalRef === void 0 ? void 0 : internalRef.current) === null || _a === void 0 ? void 0 : _a.click();
806
+ }
807
+ };
808
+ const uuid = rest.id || dataTestId;
809
+ 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] })));
810
+ });
811
+ const StyledCheckIcon = tailwindStyledComponents.twx(CheckIcon) `tu-checkbox--icon`;
812
+ const StyledIndeterminateIcon = tailwindStyledComponents.twx(IndeterminateIcon) `tu-checkbox--icon`;
813
+ const CheckboxContainer = tailwindStyledComponents.tw.label `tu-checkbox--container group`;
814
+ const HiddenInput$1 = tailwindStyledComponents.tw.input `tu-checkbox--input`;
815
+ const CheckboxWrapper = tailwindStyledComponents.tw.span `
816
+ tu-checkbox
817
+ ${({ $checked, $disabled, $indeterminate }) => {
818
+ if ($disabled) {
819
+ return tailwindStyledComponents.tws `tu-checkbox--disabled`;
820
+ }
821
+ return $indeterminate
822
+ ? tailwindStyledComponents.tws `tu-checkbox--indeterminate`
823
+ : $checked
824
+ ? tailwindStyledComponents.tws `tu-checkbox--selected`
825
+ : tailwindStyledComponents.tws `tu-checkbox--deselected`;
826
+ }}
827
+
828
+ ${({ $isInvalid }) => $isInvalid && tailwindStyledComponents.tws `tu-checkbox--invalid`}
829
+ `;
830
+
831
+ /**
832
+ * The Collapse component is used to condense non-important information.
833
+ *
834
+ * @param {CollapseProps} props - The props for the Collapse component
835
+ * @returns {JSX.Element} Collapse component
836
+ */
837
+ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, className, dataTestId, }) => {
838
+ const [expanded, setExpanded] = React__namespace.useState(initialExpanded);
839
+ const handleClick = React__namespace.useCallback((e) => {
840
+ if (onToggle) {
841
+ onToggle(e, !expanded);
842
+ }
843
+ setExpanded(!expanded);
844
+ }, [expanded, onToggle]);
845
+ 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$2, { 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 }))] })));
846
+ };
847
+ const Rotate = tailwindStyledComponents.twx(Icon) `
848
+ ${p => (p.$expanded ? tailwindStyledComponents.tws `tu-icon--animated-rotate-expanded` : null)}
849
+ tu-icon--animated-rotate
850
+ `;
851
+ const StyledCollapse = tailwindStyledComponents.tw.div `
852
+ tu-collapse
853
+ `;
854
+ const CollapseLabel = tailwindStyledComponents.tw.div `
855
+ tu-collapse__label
856
+ `;
857
+ const LabelContainer$2 = tailwindStyledComponents.tw.div `
858
+ tu-collapse__label__container
859
+ `;
860
+ const Collapsible = ({ children, expanded, id }) => {
861
+ const [ref, { height }] = reactUse.useMeasure();
862
+ return (jsxRuntime.jsx(AnimatedCollapsible, Object.assign({ id: id, style: { height: expanded ? height : "0" } }, { children: jsxRuntime.jsx(StyledCollapsible, Object.assign({ ref: ref }, { children: children })) })));
863
+ };
864
+ const AnimatedCollapsible = tailwindStyledComponents.tw.div `
865
+ tu-collapsible--animated
866
+ `;
867
+ const StyledCollapsible = tailwindStyledComponents.tw.div `
868
+ tu-collapsible
869
+ `;
870
+
871
+ /**
872
+ * The CopyableText component is used where the user should have easy access to copy information.
873
+ *
874
+ * @param {CopyableTextProps} props - The props for the CopyableText component
875
+ * @returns {JSX.Element} CopyableText component
876
+ */
877
+ const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
878
+ var _a;
879
+ const value = (_a = alternativeText !== null && alternativeText !== void 0 ? alternativeText : text) !== null && _a !== void 0 ? _a : "";
880
+ const [animating, setAnimating] = React.useState(false);
881
+ const [, copyToClipboard] = reactUse.useCopyToClipboard();
882
+ const handleOnClick = () => {
883
+ copyToClipboard(value);
884
+ setAnimating(true);
885
+ };
886
+ return (jsxRuntime.jsx(StyledCopyableText, Object.assign({ className: className, "data-testid": dataTestId, onClick: handleOnClick, onAnimationEnd: () => setAnimating(false), "$animating": animating, title: value }, { children: text })));
887
+ };
888
+ const StyledCopyableText = tailwindStyledComponents.tw.span `
889
+ tu-copyable-text
890
+ ${p => (p.$animating ? tailwindStyledComponents.tws `tu-copyable-text--animating` : null)}`;
891
+
892
+ /**
893
+ * A wrapper around BaseInput with a pop-up day picker.
894
+ *
895
+ * NOTE: If shown with a label, please use the `DateField` component instead.
896
+ */
897
+ const DateInput = React.forwardRef((_a, ref) => {
898
+ var { min, max, defaultValue, value } = _a, rest = __rest(_a, ["min", "max", "defaultValue", "value"]);
899
+ const formatDateToInputString = (date) => date instanceof Date ? dateFns.format(date, "yyyy-MM-dd") : date;
900
+ // @ts-ignore
901
+ // Chrome needs it's default icon to have datepicker functionality.
902
+ // window.chrome doesn't exist in TS but is available on chrome browsers.
903
+ // If it fails it will just show our icon.
904
+ const hideOnChrome = () => (window.chrome !== null && typeof window.chrome !== "undefined" ? "hidden" : "");
905
+ 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)));
906
+ });
907
+
908
+ /**
909
+ * @param {PopoverProps} props The children to render in the popover
910
+ * @returns {ReactElement} Popover with specified content and placement
911
+ */
912
+ const Popover = ({ children, render, placement, activation = { click: true, hover: false }, className, dataTestId, }) => {
913
+ const [open, setOpen] = React.useState(false);
914
+ const { x, y, reference, floating, strategy, context } = react.useFloating({
915
+ open,
916
+ onOpenChange: setOpen,
917
+ middleware: [
918
+ react.offset(8),
919
+ react.flip({ fallbackPlacements: ["top", "bottom", "right", "left"] }),
920
+ react.size({
921
+ apply({ availableWidth, availableHeight, elements }) {
922
+ Object.assign(elements.floating.style, {
923
+ maxWidth: `${availableWidth}px`,
924
+ maxHeight: `${availableHeight}px`,
925
+ });
926
+ },
927
+ }),
928
+ react.shift(),
929
+ ],
930
+ placement,
931
+ whileElementsMounted: react.autoUpdate,
932
+ });
933
+ const { getReferenceProps, getFloatingProps } = react.useInteractions([
934
+ react.useClick(context, { enabled: activation.click, ignoreMouse: activation.hover }),
935
+ react.useHover(context, { enabled: activation.hover }),
936
+ react.useRole(context),
937
+ react.useDismiss(context),
938
+ ]);
939
+ // Preserve the consumer's ref
940
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
941
+ const ref = React.useMemo(() => mergeRefs([reference, children.ref]), [reference, children]);
942
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [React.cloneElement(children, getReferenceProps(Object.assign({ ref }, children.props))), jsxRuntime.jsx(react.FloatingPortal, Object.assign({ id: "tu-floating-ui" }, { children: open && (jsxRuntime.jsx(react.FloatingFocusManager, Object.assign({ guards: false, context: context, modal: false, order: ["reference", "content"], returnFocus: false }, { children: jsxRuntime.jsx("div", Object.assign({ ref: floating, className: `tu-popover-container animate-fade-in-fast ${className !== null && className !== void 0 ? className : ""}`, "data-testid": dataTestId, style: {
943
+ position: strategy,
944
+ top: y !== null && y !== void 0 ? y : 0,
945
+ left: x !== null && x !== void 0 ? x : 0,
946
+ display: "flex",
947
+ } }, getFloatingProps(), { children: render({
948
+ close: () => {
949
+ setOpen(false);
950
+ },
951
+ }) })) }))) }))] }));
952
+ };
953
+ // Utility to merge refs — Heavily inspired by https://github.com/gregberge/react-merge-refs
954
+ function mergeRefs(refs) {
955
+ return value => {
956
+ refs.forEach(ref => {
957
+ if (typeof ref === "function") {
958
+ ref(value);
959
+ }
960
+ else if (ref !== null) {
961
+ ref.current = value;
962
+ }
963
+ });
964
+ };
965
+ }
966
+
967
+ /**
968
+ * The PopoverList component.
969
+ *
970
+ * @param {PopoverListProps} props - The props for the PopoverList component
971
+ * @returns {JSX.Element} PopoverList component
972
+ */
973
+ const PopoverList = ({ className, children, dataTestId }) => {
974
+ return (jsxRuntime.jsx(Card, Object.assign({ className: className, dataTestId: dataTestId }, { children: jsxRuntime.jsx(StyledCardBody, Object.assign({ density: "comfortable" }, { children: jsxRuntime.jsx(List, { children: children }) })) })));
975
+ };
976
+ const List = tailwindStyledComponents.tw.ul `
977
+ tu-popover-list
978
+ `;
979
+ const StyledCardBody = tailwindStyledComponents.twx(CardBody) `
980
+ tu-popover-list-body
981
+ `;
982
+
983
+ /**
984
+ * The PopoverListItem component.
985
+ *
986
+ * @param {PopoverListItemProps} props - The props for the PopoverListItem component
987
+ * @returns {JSX.Element} PopoverListItem component
988
+ */
989
+ const PopoverListItem = ({ selected, children, disabled, ariaLabel, url, onClick, prefix, suffix, dataTestId, className, }) => {
990
+ const content = (jsxRuntime.jsxs("div", Object.assign({ className: "flex items-center gap-3" }, { children: [prefix && jsxRuntime.jsx("div", { children: prefix }), jsxRuntime.jsx(StyledText$2, Object.assign({ weight: selected ? "bold" : "normal", "$selected": selected }, { children: children })), suffix && jsxRuntime.jsx("div", { children: suffix })] })));
991
+ return (jsxRuntime.jsx(ListItem, Object.assign({ "$selected": selected, disabled: disabled, onClick: onClick, "aria-label": ariaLabel, "data-testid": dataTestId, className: className }, { children: url ? jsxRuntime.jsx(PopoverLink, Object.assign({ to: url }, { children: content })) : content })));
992
+ };
993
+ const StyledText$2 = tailwindStyledComponents.twx(Text$1) `
994
+ tu-popover-list-item__text
995
+ ${p => p.$selected && tailwindStyledComponents.tws `tu-popover-list-item__text--selected`}
996
+ `;
997
+ const ListItem = tailwindStyledComponents.tw.li `
998
+ group
999
+ tu-popover-list-item
1000
+ ${p => p.disabled && tailwindStyledComponents.tws `tu-popover-list-item--disabled`}
1001
+ `;
1002
+ const PopoverLink = tailwindStyledComponents.twx(reactRouterDom.Link) `
1003
+ tu-popover-list-item__anchor
1004
+ `;
1005
+
1006
+ /**
1007
+ * The PopoverTitle component.
1008
+ *
1009
+ * @param {PopoverTitleProps} props - The props for the PopoverTitle component
1010
+ * @returns {JSX.Element} PopoverTitle component
1011
+ */
1012
+ const PopoverTitle = ({ children, action, divider = false, className, dataTestId }) => {
1013
+ return (jsxRuntime.jsxs(Container$5, 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] })));
1014
+ };
1015
+ const Container$5 = tailwindStyledComponents.tw.div `
1016
+ tu-popover-title-container
1017
+ ${p => p.$divider && `tu-popover-title-container--divider`}
1018
+ `;
1019
+ const StyledText$1 = tailwindStyledComponents.twx(Text$1) `
1020
+ tu-popover-title-text
1021
+ `;
1022
+
1023
+ /**
1024
+ * The Tooltip component is used to show helpful tips or contextual information to the users.
1025
+ *
1026
+ * @param {TooltipProps} props - The props for the Tooltip component
1027
+ * @returns {JSX.Element} Tooltip component
1028
+ */
1029
+ const Tooltip = (_a) => {
1030
+ var { children, dataTestId, disabled, className } = _a, rest = __rest(_a, ["children", "dataTestId", "disabled", "className"]);
1031
+ const wrappedChildren = (jsxRuntime.jsx(Flex$1, Object.assign({ className: className, "data-testid": dataTestId && `${dataTestId}-parent` }, { children: children })));
1032
+ if (disabled) {
1033
+ return wrappedChildren;
1034
+ }
1035
+ return (jsxRuntime.jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
1036
+ };
1037
+ const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxRuntime.jsx(StyledPopover, Object.assign({ className: "tu-tooltip__container", placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", render: () => (jsxRuntime.jsx(Content, Object.assign({ "$mode": mode }, { children: jsxRuntime.jsx(Text$1, Object.assign({ inverted: mode === "dark", type: contentTextType }, { children: label })) }))) }, { children: children })));
1038
+ const Flex$1 = tailwindStyledComponents.tw.div `
1039
+ inline-flex
1040
+ `;
1041
+ const StyledPopover = tailwindStyledComponents.twx(Popover) `
1042
+ tu-tooltip__container
1043
+ `;
1044
+ const Content = tailwindStyledComponents.tw.div `
1045
+ tu-tooltip__content
1046
+ ${p => (p.$mode === "light" ? tailwindStyledComponents.tws `tu-tooltip--light` : null)}
1047
+ `;
1048
+
1049
+ /**
1050
+ * The Tip component is used to show helpful tips or contextual information to the users.
1051
+ * The tip can optionally be rendered as an anchor tag, which redirects to users to an external link on click.
1052
+ *
1053
+ * @param {TipProps} props - The props for the Tip component
1054
+ * @returns {JSX.Element} Tip component
1055
+ */
1056
+ const Tip = ({ children, iconProps, dataTestId, link, renderAs = "span", className, placement = "bottom", mode, }) => {
1057
+ const ifAnchorTag = renderAs === "a";
1058
+ 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)) })) })));
1059
+ };
1060
+ const TipContainer = tailwindStyledComponents.tw.text `
1061
+ tu-tip
1062
+ `;
1063
+
1064
+ /**
1065
+ * The FormGroup component should be used to wrap any Input element that needs a label.
1066
+ * Besides a label the component supplies an optional Tip, HelpText and HelpAddon support.
1067
+ *
1068
+ * @param {FormGroupProps} props - The props for the FormGroup component
1069
+ * @returns {JSX.Element} FormGroup component
1070
+ */
1071
+ const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, children, disabled = false, }) => {
1072
+ 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` }, { 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 }))] }))] })));
1073
+ };
1074
+ const FormGroupRoot = tailwindStyledComponents.tw.label `
1075
+ tu-form-group
1076
+ ${({ $disabled }) => {
1077
+ return $disabled ? "pointer-events-none " : null;
1078
+ }}
1079
+ `;
1080
+ const ContainerBefore = tailwindStyledComponents.tw.div `
1081
+ tu-form-group__container-before
1082
+ `;
1083
+ const FormGroupLabel = tailwindStyledComponents.twx(Label$2) `
1084
+ component-formGroup-font
1085
+ `;
1086
+ const ContainerAfter = tailwindStyledComponents.tw.div `
1087
+ tu-form-group__container-after
1088
+ ${({ $isInvalid }) => ($isInvalid ? tailwindStyledComponents.tws `tu-form-group__container-after--invalid` : null)}
1089
+ `;
1090
+ const HelpAddon = tailwindStyledComponents.tw.span `
1091
+ tu-form-group__help-addon
1092
+ `;
1093
+
1094
+ /**
1095
+ * The date field component is used for entering date values.
1096
+ *
1097
+ * _**Do use**_ the DateField for date input.
1098
+ *
1099
+ * _**Do not use**_ this fields for non-serialized dates. Use TextField instead.
1100
+ */
1101
+ const DateField = React.forwardRef((_a, ref) => {
1102
+ var { label, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "className", "defaultValue", "dataTestId"]);
1103
+ const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
1104
+ return (jsxRuntime.jsx(FormGroup, Object.assign({ 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({ ref: ref, defaultValue: defaultValue, isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
1105
+ });
1106
+
1107
+ const localeLookup = {
1108
+ en: locale.enGB,
1109
+ "en-US": locale.enUS,
1110
+ "en-GB": locale.enGB,
1111
+ da: locale.da,
1112
+ de: locale.de,
1113
+ cs: locale.cs,
1114
+ nl: locale.nl,
1115
+ fr: locale.fr,
1116
+ fi: locale.fi,
1117
+ hu: locale.hu,
1118
+ it: locale.it,
1119
+ nb: locale.nb,
1120
+ pl: locale.pl,
1121
+ pt: locale.pt,
1122
+ ru: locale.ru,
1123
+ ro: locale.ro,
1124
+ es: locale.es,
1125
+ sv: locale.sv,
1126
+ ja: locale.ja,
1127
+ th: locale.th,
1128
+ };
1129
+ /**
1130
+ * A helper function to get the matching Locale object for a given language.
1131
+ *
1132
+ * @param {string} language The language to match
1133
+ * @returns {Locale} The corresponding Locale object
1134
+ */
1135
+ const useLocale = (language) => {
1136
+ return localeLookup[language] || localeLookup.en;
1137
+ };
1138
+
1139
+ /**
1140
+ * The DayPicker component is used when the user needs to select a date.
1141
+ *
1142
+ * @param {DayPickerProps} props - The props for the DayPicker component
1143
+ * @returns {JSX.Element} DayPicker component
1144
+ */
1145
+ const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, className, dataTestId, max, }) => {
1146
+ const locale = useLocale(language);
1147
+ 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 }) }));
1148
+ };
1149
+
1150
+ /**
1151
+ * The DayPickerPopover component returns a button which when clicked shows the daypicker.
1152
+ *
1153
+ * @param {DayPickerPopoverProps} props - The props for the DayPickerPopover component
1154
+ * @returns {JSX.Element} DayPickerPopover component
1155
+ */
1156
+ const DayPickerPopover = ({ disabledDays, className, dataTestId, selectedDay, onDaySelect, color = "secondary", placement, size = "small", buttonContent, language, }) => {
1157
+ return (jsxRuntime.jsx(Popover, Object.assign({ placement: placement, render: () => (jsxRuntime.jsx(PopoverList, { children: jsxRuntime.jsx(DayPicker, { disabledDays: disabledDays, onDaySelect: onDaySelect, selectedDays: selectedDay, language: language }) })) }, { children: jsxRuntime.jsx(Button, Object.assign({ color: color, size: size, className: className, prefix: jsxRuntime.jsx(Icon, { name: "CalendarIcon", size: "small" }), dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "show-day-picker" }, { children: buttonContent })) })));
1158
+ };
1159
+
1160
+ /**
1161
+ * The DayRangePicker component should be used when the user needs to select a range of dates.
1162
+ *
1163
+ * @param {DayRangePickerProps} props - The props for the DayRangePicker component
1164
+ * @returns {JSX.Element} DayRangePicker component
1165
+ */
1166
+ const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId, language, className, max, }) => {
1167
+ const locale = useLocale(language);
1168
+ const onSelect = React.useCallback((range) => {
1169
+ if (onRangeSelect && range === undefined) {
1170
+ onRangeSelect(undefined);
1171
+ }
1172
+ if (onRangeSelect && range) {
1173
+ const from = range.from;
1174
+ const to = range.to ? range.to : range.from;
1175
+ onRangeSelect({ from, to });
1176
+ }
1177
+ }, [onRangeSelect]);
1178
+ return (jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "range", onSelect: onSelect, selected: selectedDays, defaultMonth: selectedDays && selectedDays.from, locale: locale, disabled: disabledDays, className: `custom-day-picker range-picker ${className !== null && className !== void 0 ? className : ""}`, max: max, footer: jsxRuntime.jsx("div", { "data-testid": dataTestId }) }));
1179
+ };
1180
+
1181
+ /**
1182
+ * The drawer provides a slideover which can be used to provide access to different locations in the application.
1183
+ *
1184
+ * @param {DrawerProps} props - The props for the Drawer component
1185
+ * @returns {JSX.Element} Drawer component
1186
+ */
1187
+ const Drawer = ({ open, onClose = () => { }, children, disableOverlay = false, position = "left", className, dataTestId, }) => {
1188
+ const { context } = react.useFloating();
1189
+ React.useEffect(() => {
1190
+ // Close overlay when pressing escape button.
1191
+ const onKeyPress = (e) => {
1192
+ if (e.key === "Escape") {
1193
+ onClose();
1194
+ }
1195
+ };
1196
+ if (open) {
1197
+ window.addEventListener("keyup", onKeyPress);
1198
+ }
1199
+ return () => {
1200
+ window.removeEventListener("keyup", onKeyPress);
1201
+ };
1202
+ }, [open, onClose]);
1203
+ return (jsxRuntime.jsx(react.FloatingFocusManager, Object.assign({ context: context }, { children: open ? (jsxRuntime.jsxs(Root$6, 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 }))] }))) : (
1204
+ // eslint-disable-next-line react/jsx-no-useless-fragment
1205
+ jsxRuntime.jsx(jsxRuntime.Fragment, {})) })));
1206
+ };
1207
+ const getPositionStyles = ($position) => {
1208
+ switch ($position) {
1209
+ case "top":
1210
+ return tailwindStyledComponents.tws `tu-drawer__card--top`;
1211
+ case "right":
1212
+ return tailwindStyledComponents.tws `tu-drawer__card--right`;
1213
+ case "bottom":
1214
+ return tailwindStyledComponents.tws `tu-drawer__card--bottom`;
1215
+ case "left":
1216
+ default:
1217
+ return tailwindStyledComponents.tws `tu-drawer__card--left`;
1218
+ }
1219
+ };
1220
+ const StyledCard$1 = tailwindStyledComponents.twx(Card) `
1221
+ tu-drawer__card
1222
+ ${({ $open }) => $open && tailwindStyledComponents.tws `tu-drawer__card--open`}
1223
+ ${({ $position }) => getPositionStyles($position)}
1224
+ `;
1225
+ const Root$6 = tailwindStyledComponents.tw.div `
1226
+ tu-drawer
1227
+ `;
1228
+ const Overlay = tailwindStyledComponents.tw.div `
1229
+ tu-drawer__overlay
1230
+ ${({ $open }) => $open && tailwindStyledComponents.tws `tu-drawer__overlay--open`}
1231
+ `;
1232
+
1233
+ /**
1234
+ * The Drop Zone can be used to drag and drop files
1235
+ *
1236
+ * @param {DropZoneProps} props - The props for the DropZone component
1237
+ * @returns {JSX.Element} DropZone component
1238
+ */
1239
+ const DropZone = (_a) => {
1240
+ var { className, dataTestId, filesSelected, label, size = "large", isInvalid = false, disabled = false } = _a, rest = __rest(_a, ["className", "dataTestId", "filesSelected", "label", "size", "isInvalid", "disabled"]);
1241
+ const [dragActive, setDragActive] = React__default["default"].useState(false);
1242
+ const [fileDropped, setFileDropped] = React__default["default"].useState(false);
1243
+ // function that handles drag enter, drag leave and drag over
1244
+ const handleDrag = (e) => {
1245
+ e.preventDefault();
1246
+ e.stopPropagation();
1247
+ if ((e.type === "dragenter" || e.type === "dragover") && !disabled) {
1248
+ setDragActive(true);
1249
+ }
1250
+ else if (e.type === "dragleave") {
1251
+ setDragActive(false);
1252
+ }
1253
+ };
1254
+ //function to handle when user clicks on dropzone to upload
1255
+ const handleChange = (e) => {
1256
+ e.preventDefault();
1257
+ e.stopPropagation();
1258
+ if (e.target.files && !disabled) {
1259
+ filesSelected(e.target.files);
1260
+ }
1261
+ };
1262
+ //funtion to handle drop
1263
+ const handleDrop = (e) => {
1264
+ e.preventDefault();
1265
+ e.stopPropagation();
1266
+ setDragActive(false);
1267
+ if (e.dataTransfer.files && e.dataTransfer.files[0] && !disabled) {
1268
+ filesSelected(e.dataTransfer.files);
1269
+ setFileDropped(true);
1270
+ }
1271
+ };
1272
+ 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 => {
1273
+ if (disabled) {
1274
+ e.preventDefault();
1275
+ e.stopPropagation();
1276
+ }
1277
+ } }, 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 })] }))] })));
1278
+ };
1279
+ const Root$5 = tailwindStyledComponents.tw.div `
1280
+ tu-drop-zone
1281
+ ${({ $size }) => ($size === "small" ? tailwindStyledComponents.tws `tu-drop-zone--small` : null)}
1282
+ ${({ $size }) => ($size === "medium" ? tailwindStyledComponents.tws `tu-drop-zone--medium` : null)}
1283
+ ${({ $size }) => ($size === "large" ? tailwindStyledComponents.tws `tu-drop-zone--large` : null)}
1284
+ ${({ $dragActive }) => ($dragActive ? tailwindStyledComponents.tws `tu-drop-zone--drag-active` : null)}
1285
+ ${({ $fileDropped }) => ($fileDropped ? tailwindStyledComponents.tws `tu-drop-zone--drop-complete` : null)}
1286
+ ${({ $isInvalid }) => ($isInvalid ? tailwindStyledComponents.tws `tu-drop-zone--invalid` : null)}
1287
+ ${({ $disabled }) => ($disabled ? tailwindStyledComponents.tws `tu-drop-zone--disabled` : null)}
1288
+ `;
1289
+ const DropZoneLabel = tailwindStyledComponents.tw.label `
1290
+ tu-drop-zone__label
1291
+ `;
1292
+
1293
+ /**
1294
+ * A Email Input component is used for input of the type Email.
1295
+ *
1296
+ * It has an ActionButton which sends an email to the specified address using "mailto:" link.
1297
+ *
1298
+ * Extends props of BaseInput.
1299
+ *
1300
+ * A reference to the input element is provided as the `ref` prop.
1301
+ * For specific input types make sure to use the corresponding input component.
1302
+ */
1303
+ const EmailInput = React__namespace.forwardRef((_a, ref) => {
1304
+ var { fieldSize = "medium", disabled = false, dataTestId } = _a, rest = __rest(_a, ["fieldSize", "disabled", "dataTestId"]);
1305
+ const [email, setEmail] = React__namespace.useState("");
1306
+ const sendEmail = () => {
1307
+ return window.open(`mailto:${email}`);
1308
+ };
1309
+ 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 }) })));
1310
+ });
1311
+
1312
+ /**
1313
+ * The EmailField component is used to enter email.
1314
+ * EmailField validates that user enters a valid email address.
1315
+ *
1316
+ */
1317
+ const EmailField = React.forwardRef((_a, ref) => {
1318
+ var { label, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "className", "defaultValue", "dataTestId"]);
1319
+ const [value, setValue] = React.useState(defaultValue);
1320
+ // Type guard to check if value is a string
1321
+ function isString(inputValue) {
1322
+ return typeof inputValue === "string";
1323
+ }
1324
+ // Check the regular expression only if value is a string
1325
+ const renderAsInvalid = !!errorMessage || (isString(value) && !/^\S+@\S+\.\S+$/.test(value));
1326
+ return (jsxRuntime.jsx(FormGroup, Object.assign({ 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({ ref: ref, value: value, onChange: e => setValue(e.target.value), isInvalid: renderAsInvalid, disabled: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
1327
+ });
1328
+
1329
+ /**
1330
+ * The external link component is used to link to an external page outside the Trackunit Manager.
1331
+ *
1332
+ * @param {ExternalLinkProps} props - The props for the external link component
1333
+ * @returns {JSX.Element} External Link component
1334
+ */
1335
+ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className, children = href, title = href, dataTestId, }) => {
1336
+ return (jsxRuntime.jsx("a", Object.assign({ "data-testid": dataTestId, className: className, title: title, href: href, rel: rel, target: target }, { children: children })));
1337
+ };
1338
+
1339
+ /**
1340
+ * Indicators are non-interactive elements that communicate essential aspects of the state of an asset.
1341
+ *
1342
+ * Whenever an asset is presented, indicators provide the necessary information for a user to comprehend the state of the asset.
1343
+ *
1344
+ * _**Do use** indicators to communicate essential aspects of the state of an asset._
1345
+ *
1346
+ * _**Do not use** indicators for non-essential information, or to communicate information unrelated to the state of an asset._
1347
+ *
1348
+ * @param {IndicatorProps} props - The props for the Indicator component
1349
+ * @returns {JSX.Element} Indicator component
1350
+ */
1351
+ const Indicator = (_a) => {
1352
+ var { dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false } = _a, rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping"]);
1353
+ return (jsxRuntime.jsxs(Container$4, 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 })))] })));
1354
+ };
1355
+ const Container$4 = tailwindStyledComponents.tw.div `
1356
+ tu-indicator
1357
+ ${({ $color }) => {
1358
+ switch ($color) {
1359
+ case "primary":
1360
+ return tailwindStyledComponents.tws `tu-indicator--primary`;
1361
+ case "secondary":
1362
+ return tailwindStyledComponents.tws `tu-indicator--secondary`;
1363
+ case "accent":
1364
+ return tailwindStyledComponents.tws `tu-indicator--accent`;
1365
+ case "neutral":
1366
+ return tailwindStyledComponents.tws `tu-indicator--neutral`;
1367
+ case "info":
1368
+ return tailwindStyledComponents.tws `tu-indicator--info`;
1369
+ case "success":
1370
+ return tailwindStyledComponents.tws `tu-indicator--success`;
1371
+ case "warning":
1372
+ return tailwindStyledComponents.tws `tu-indicator--warning`;
1373
+ case "danger":
1374
+ return tailwindStyledComponents.tws `tu-indicator--danger`;
1375
+ case "good":
1376
+ return tailwindStyledComponents.tws `tu-indicator--good`;
1377
+ case "low":
1378
+ return tailwindStyledComponents.tws `tu-indicator--low`;
1379
+ case "critical":
1380
+ return tailwindStyledComponents.tws `tu-indicator--critical`;
1381
+ case "working":
1382
+ return tailwindStyledComponents.tws `tu-indicator--working`;
1383
+ case "idle":
1384
+ return tailwindStyledComponents.tws `tu-indicator--idle`;
1385
+ case "stopped":
1386
+ return tailwindStyledComponents.tws `tu-indicator--stopped`;
1387
+ case "moving":
1388
+ return tailwindStyledComponents.tws `tu-indicator--moving`;
1389
+ case "unknown":
1390
+ return tailwindStyledComponents.tws `tu-indicator--unknown`;
1391
+ case "unused":
1392
+ return tailwindStyledComponents.tws `tu-indicator--unused`;
1393
+ case "utilized":
1394
+ return tailwindStyledComponents.tws `tu-indicator--utilized`;
1395
+ case "heavily_utilized":
1396
+ return tailwindStyledComponents.tws `tu-indicator--heavily-utilized`;
1397
+ case "on_rent":
1398
+ return tailwindStyledComponents.tws `tu-indicator--on-rent`;
1399
+ case "available":
1400
+ return tailwindStyledComponents.tws `tu-indicator--available`;
1401
+ case "pickup_ready":
1402
+ return tailwindStyledComponents.tws `tu-indicator--pickup-ready`;
1403
+ case "transfer":
1404
+ return tailwindStyledComponents.tws `tu-indicator--transfer`;
1405
+ case "in_repair":
1406
+ return tailwindStyledComponents.tws `tu-indicator--in-repair`;
1407
+ case "returned":
1408
+ return tailwindStyledComponents.tws `tu-indicator--returned`;
1409
+ case "other_rental_status":
1410
+ return tailwindStyledComponents.tws `tu-indicator--other-rental-status`;
1411
+ default:
1412
+ return "";
1413
+ }
1414
+ }}
1415
+ `;
1416
+ const IconBackground = tailwindStyledComponents.tw.div `
1417
+ tu-indicator__icon-background
1418
+
1419
+ ${({ $withBackground }) => {
1420
+ return $withBackground ? "" : "tu-indicator__icon-background--none";
1421
+ }}
1422
+ `;
1423
+ const Label$1 = tailwindStyledComponents.tw.div `
1424
+ tu-indicator__label
1425
+ `;
1426
+ const Ping = tailwindStyledComponents.tw.span `
1427
+ tu-indicator__ping
1428
+ `;
1429
+
1430
+ /**
1431
+ * The MenuItem component is used to display a menu, primarily meant to be used in a list form.
1432
+ *
1433
+ * @param {MenuItemProps} props - The props for the MenuItem component
1434
+ * @returns {JSX.Element} MenuItem component
1435
+ */
1436
+ const MenuItem = ({ className, dataTestId, label, children, selected, focused, prefix, suffix, disabled, onClick, }) => {
1437
+ const containerProps = useContainerProps({ className, dataTestId });
1438
+ return (jsxRuntime.jsxs(Container$3, Object.assign({}, containerProps, { onClick: e => {
1439
+ e.stopPropagation();
1440
+ onClick && onClick(e);
1441
+ }, "$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 !== null && children !== void 0 ? children : jsxRuntime.jsx(Label, Object.assign({ "data-testid": dataTestId && `${dataTestId}-label` }, { children: label })), suffix && (jsxRuntime.jsx(Suffix, Object.assign({ "$selected": selected, "data-testid": dataTestId && `${dataTestId}-suffix` }, { children: suffix })))] })));
1442
+ };
1443
+ const Container$3 = tailwindStyledComponents.tw.div `
1444
+ group tu-menu-item
1445
+ ${({ $selected }) => ($selected ? tailwindStyledComponents.tws `tu-menu-item--selected ` : "tu-menu-item--unselected")}
1446
+ ${({ $focused }) => ($focused ? tailwindStyledComponents.tws `tu-menu-item--focused ` : "")}
1447
+ ${({ $disabled }) => ($disabled ? tailwindStyledComponents.tws `tu-menu-item--disabled ` : "")}
1448
+
1449
+ `;
1450
+ const Suffix = tailwindStyledComponents.tw.div `
1451
+ tu-menu-item__suffix
1452
+ ${({ $selected }) => ($selected ? tailwindStyledComponents.tws `tu-menu-item__suffix--selected ` : "")}
1453
+ `;
1454
+ const Prefix = tailwindStyledComponents.tw.div `
1455
+ tu-menu-item__prefix
1456
+ ${({ $selected }) => ($selected ? tailwindStyledComponents.tws `tu-menu-item__prefix--selected ` : "")}
1457
+ `;
1458
+ const Label = tailwindStyledComponents.tw.div `
1459
+ tu-menu-item__label
1460
+ `;
1461
+
1462
+ /**
1463
+ * The MenuList component is used for menus and selects.
1464
+ *
1465
+ * @param {MenuListProps} props - The props for the MenuList component
1466
+ * @returns {JSX.Element} MenuList component
1467
+ */
1468
+ const MenuList = (_a) => {
1469
+ var { dataTestId, className, children, withStickyHeader = false, showDivider = false } = _a; __rest(_a, ["dataTestId", "className", "children", "withStickyHeader", "showDivider"]);
1470
+ const childrenArr = React.Children.toArray(children);
1471
+ const isLastItem = (index) => index === childrenArr.length - 1;
1472
+ return (jsxRuntime.jsx(Container$2, Object.assign({ "$withStickyHeader": withStickyHeader, "data-testid": dataTestId, className: className, tabIndex: 0 }, { children: React.Children.map(childrenArr, (menuItem, index) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [menuItem, showDivider && !isLastItem(index) && jsxRuntime.jsx(Divider, {})] }))) })));
1473
+ };
1474
+ const Container$2 = tailwindStyledComponents.tw.div `
1475
+ tu-menu-list
1476
+ ${props => props.$withStickyHeader && tailwindStyledComponents.tws `tu-menu-list--sticky-header`}
1477
+ `;
1478
+ const Divider = tailwindStyledComponents.tw.hr `
1479
+ tu-menu-list__divider
1480
+ `;
1481
+
1482
+ /**
1483
+ * A kebab menu component.
1484
+ * Advice: fill it with MenuList
1485
+ *
1486
+ * @param {MoreMenuProps} props - The props for the MoreMenu component
1487
+ * @returns {JSX.Element} MoreMenu component
1488
+ */
1489
+ const MoreMenu = ({ className, dataTestId, dotsDirection = "horizontal", menuPlacement, iconProps = {
1490
+ size: "medium",
1491
+ }, iconButtonProps = {
1492
+ size: "small",
1493
+ circular: true,
1494
+ square: true,
1495
+ color: "tertiary",
1496
+ }, children, }) => {
1497
+ const [actionMenuIsOpen, setActionMenuIsOpen] = React.useState(false);
1498
+ const dotsName = dotsDirection === "horizontal" ? "EllipsisHorizontalIcon" : "EllipsisVerticalIcon";
1499
+ const actionMenuRef = React.useRef(null);
1500
+ reactBrowserHooks.useClickOutside(actionMenuRef, () => {
1501
+ setActionMenuIsOpen(false);
1502
+ });
1503
+ return (jsxRuntime.jsx(Root$4, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxRuntime.jsx(Popover, Object.assign({ render: () => children, placement: menuPlacement }, { children: jsxRuntime.jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsxRuntime.jsx(Icon, Object.assign({ name: dotsName }, iconProps)), onClick: () => {
1504
+ setActionMenuIsOpen(!actionMenuIsOpen);
1505
+ } })) })) })));
1506
+ };
1507
+ const Root$4 = tailwindStyledComponents.tw.div `
1508
+ tu-more-menu
1509
+ ${({ variant }) => (variant === "primary" ? tailwindStyledComponents.tws `tu-more-menu--primary` : "")}
1510
+ `;
1511
+
1512
+ /**
1513
+ * The Backdrop for the modal.
1514
+ *
1515
+ * @param {ModalBackdropProps} props - The props for the ModalBackdrop component
1516
+ * @returns {JSX.Element} ModalBackdrop component
1517
+ */
1518
+ const ModalBackdrop = ({ children, isVisible, onClick }) => {
1519
+ const ref = React__namespace.useRef(null);
1520
+ return (jsxRuntime.jsx(Backdrop, Object.assign({ ref: ref, "$isVisible": isVisible, onMouseDown: e => {
1521
+ var _a, _b;
1522
+ // only react on click on backdrop - accessing first child to get around styled element element
1523
+ if (ref.current !== null) {
1524
+ if ((e === null || e === void 0 ? void 0 : e.target) === ((_b = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[0])) {
1525
+ onClick();
1526
+ }
1527
+ }
1528
+ } }, { children: children })));
1529
+ };
1530
+ const Backdrop = tailwindStyledComponents.tw.div `
1531
+ tu-modal-backdrop
1532
+ ${({ $isVisible }) => {
1533
+ return $isVisible && tailwindStyledComponents.tws `tu-modal-backdrop--show`;
1534
+ }}
1535
+ `;
1536
+
1537
+ /**
1538
+ * - Modals are used to present critical information or request user input needed to complete a user's workflow.
1539
+ * - Modals interrupt a user's workflow by design.
1540
+ * - The modal component provides a foundation for creating dialogs, lightboxes, etc.
1541
+ */
1542
+ const Modal = React__namespace.forwardRef(({ isOpen, children, dataTestId, className, role = "", onDismissClick = () => {
1543
+ return;
1544
+ }, }, ref) => {
1545
+ return (jsxRuntime.jsx(ModalBackdrop, Object.assign({ isVisible: isOpen, onClick: onDismissClick }, { children: isOpen && (jsxRuntime.jsx(StyledDiv, Object.assign({ ref: ref, role: role }, { children: jsxRuntime.jsx(StyledCard, Object.assign({ dataTestId: dataTestId, className: className }, { children: children })) }))) })));
1546
+ });
1547
+ const StyledCard = tailwindStyledComponents.twx(Card) `
1548
+ tu-modal__card
1549
+ `;
1550
+ const StyledDiv = tailwindStyledComponents.tw.div `
1551
+ tu-modal__container
1552
+ `;
1553
+
1554
+ /**
1555
+ * The useModal component should be used to inform the user of important information.
1556
+ *
1557
+ * @param {UseModalProps} props - The props for the useModal hook
1558
+ * @returns {*} useModal return
1559
+ */
1560
+ const useModal = ({ closeOnOutsideClick } = {}) => {
1561
+ const modalRef = React.useRef(null);
1562
+ const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal__default["default"]({
1563
+ closeOnOutsideClick,
1564
+ onPortalClick: ({ target }) => {
1565
+ if (!closeOnOutsideClick) {
1566
+ return;
1567
+ }
1568
+ const clickingOutsideModal = modalRef && modalRef.current && !modalRef.current.contains(target);
1569
+ if (clickingOutsideModal) {
1570
+ closePortal();
1571
+ }
1572
+ },
1573
+ });
1574
+ const PortalWrapper = (props) => (jsxRuntime.jsx(Portal, { children: jsxRuntime.jsx(Modal, Object.assign({ ref: modalRef, isOpen: isOpen }, props)) }));
1575
+ PortalWrapper.displayName = "Modal";
1576
+ const WrappedModal = React.useCallback(PortalWrapper, [Portal, isOpen]);
1577
+ return {
1578
+ Modal: WrappedModal,
1579
+ toggleModal: togglePortal,
1580
+ openModal: openPortal,
1581
+ closeModal: closePortal,
1582
+ isOpen,
1583
+ };
1584
+ };
1585
+
1586
+ /**
1587
+ * A thin wrapper around the `BaseInput` component for number input fields.
1588
+ *
1589
+ * NOTE: If shown with a label, please use the `NumberField` component instead.
1590
+ */
1591
+ const NumberInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BaseInput, Object.assign({ ref: ref, type: "number" }, props))));
1592
+
1593
+ /**
1594
+ * The number field component is used for entering numeric values and includes controls for incrementally increasing or decreasing the value.
1595
+ *
1596
+ * _**Do use**_ the NumberField when the controls to incrementally increase or decrease makes the task easier for the user.
1597
+ *
1598
+ * _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
1599
+ */
1600
+ const NumberField = React.forwardRef((_a, ref) => {
1601
+ var { label, tip, helpText, errorMessage, helpAddon, isInvalid, maxLength, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "maxLength", "className", "value", "dataTestId"]);
1602
+ const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
1603
+ return (jsxRuntime.jsx(FormGroup, Object.assign({ label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(NumberInput, Object.assign({ ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
1604
+ });
1605
+
1606
+ /**
1607
+ * The tag component is used to categorize elements in the ui.
1608
+ *
1609
+ * This could be to tell the state of an asset, or label a page as Beta.
1610
+ *
1611
+ * The tag is also used in multiselect components to show selected options.
1612
+ *
1613
+ * **Do:** Use short labels for easy scanning.
1614
+ *
1615
+ * @param {TagProps} props - The props for the tag component
1616
+ * @returns {JSX.Element} tag component
1617
+ */
1618
+ const Tag = React__namespace.forwardRef((_a, ref) => {
1619
+ var { className, dataTestId, children, size = "medium", onClose, color = "primary" } = _a; __rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color"]);
1620
+ return (jsxRuntime.jsxs(StyledText, Object.assign({ className: className, "$size": size, "data-testid": dataTestId && `${dataTestId}-tag`, "$as": "span", "$color": color, "$withXIcon": !!onClose, ref: ref }, { children: [children, onClose && (
1621
+ // a fix for multiselect deselecting tags working together with fade out animation
1622
+ jsxRuntime.jsx(IconContainer, Object.assign({ onMouseDown: onClose }, { children: jsxRuntime.jsx(Icon, { name: "XCircleIcon", dataTestId: dataTestId + "Icon", type: "solid", style: { WebkitTransition: "-webkit-transform 0.150s" }, className: size === "medium" ? tailwindStyledComponents.tws `tu-tag__icon` : tailwindStyledComponents.tws `tu-tag__icon tu-tag__icon--small` }) })))] })));
1623
+ });
1624
+ const getSizeModifierClass = () => ({ $size, $withXIcon }) => {
1625
+ const tagSizeModifierClass = {
1626
+ medium: $withXIcon ? tailwindStyledComponents.tws `tu-tag--with-icon ` : tailwindStyledComponents.tws ` `,
1627
+ small: $withXIcon ? tailwindStyledComponents.tws `tu-tag--small tu-tag--with-icon` : tailwindStyledComponents.tws `tu-tag--small`,
1628
+ };
1629
+ return tagSizeModifierClass[$size];
1630
+ };
1631
+ const getColorModifierClass = () => ({ $color }) => {
1632
+ const colorClasses = {
1633
+ primary: tailwindStyledComponents.tws `tu-tag--primary`,
1634
+ secondary: tailwindStyledComponents.tws `tu-tag--secondary`,
1635
+ accent: tailwindStyledComponents.tws `tu-tag--accent`,
1636
+ success: tailwindStyledComponents.tws `tu-tag--success`,
1637
+ danger: tailwindStyledComponents.tws `tu-tag--danger`,
1638
+ warning: tailwindStyledComponents.tws `tu-tag--warning`,
1639
+ info: tailwindStyledComponents.tws `tu-tag--info`,
1640
+ neutral: tailwindStyledComponents.tws `tu-tag--neutral`,
1641
+ good: tailwindStyledComponents.tws `tu-tag--good`,
1642
+ low: tailwindStyledComponents.tws `tu-tag--low`,
1643
+ critical: tailwindStyledComponents.tws `tu-tag--critical`,
1644
+ working: tailwindStyledComponents.tws `tu-tag--working`,
1645
+ idle: tailwindStyledComponents.tws `tu-tag--idle`,
1646
+ stopped: tailwindStyledComponents.tws `tu-tag--stopped`,
1647
+ unknown: tailwindStyledComponents.tws `tu-tag--unknown`,
1648
+ };
1649
+ return colorClasses[$color];
1650
+ };
1651
+ const StyledText = tailwindStyledComponents.tw.span `
1652
+ tu-tag
1653
+ ${getSizeModifierClass()}
1654
+ ${getColorModifierClass()}
1655
+ `;
1656
+ const IconContainer = tailwindStyledComponents.tw.div `
1657
+ tu-tag__icon-container
1658
+ `;
1659
+
1660
+ /**
1661
+ * Pageheader component is used to display a page header.
1662
+ *
1663
+ * PageHeader can be used to highlight the page topic, display important information about the page, and carry the action items related to the current page.
1664
+ *
1665
+ * @param {PageHeaderProps} props - The props for the PageHeader component
1666
+ * @returns {JSX.Element} PageHeader component
1667
+ */
1668
+ const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, children, }) => {
1669
+ return (jsxRuntime.jsxs(StyledPageHeader, Object.assign({ className: className, "data-testid": dataTestId }, { children: [jsxRuntime.jsxs(HeadingAndAccessoriesContainer, Object.assign({ "data-testid": dataTestId && `${dataTestId}-heading-container` }, { children: [jsxRuntime.jsxs(HeadingContainer, { children: [backTo && (jsxRuntime.jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsxRuntime.jsx(Icon, { name: "ArrowLeftIcon" }) })), jsxRuntime.jsx(Heading, Object.assign({ "data-testid": dataTestId && `${dataTestId}-heading` }, { children: title })), description && (jsxRuntime.jsx(StyledTip, Object.assign({ link: isValidHttpUrl(link) ? link : undefined, dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircleIcon" }, renderAs: link ? "a" : "span" }, { children: description })))] }), tag && jsxRuntime.jsx(Tag, Object.assign({ dataTestId: dataTestId }, { children: tag })), showLoading && jsxRuntime.jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] })), jsxRuntime.jsx(ChildContainer$1, { children: children })] })));
1670
+ };
1671
+ function isValidHttpUrl(link) {
1672
+ if (!link) {
1673
+ return false;
1674
+ }
1675
+ let url;
1676
+ try {
1677
+ url = new URL(link);
1678
+ }
1679
+ catch (_) {
1680
+ return false;
1681
+ }
1682
+ return url.protocol === "http:" || url.protocol === "https:";
1683
+ }
1684
+ const StyledPageHeader = tailwindStyledComponents.tw.div `
1685
+ tu-page-header
1686
+ `;
1687
+ const HeadingAndAccessoriesContainer = tailwindStyledComponents.tw.div `
1688
+ tu-page-header__heading-accessories-container
1689
+ `;
1690
+ const HeadingContainer = tailwindStyledComponents.tw.div `
1691
+ tu-page-header__heading-container
1692
+ `;
1693
+ const Heading = tailwindStyledComponents.tw.h1 `
1694
+ tu-page-header__heading
1695
+ `;
1696
+ const ChildContainer$1 = tailwindStyledComponents.tw.div `
1697
+ tu-page-header__child-container
1698
+ `;
1699
+ const StyledTip = tailwindStyledComponents.twx(Tip) `
1700
+ ${p => (p.link ? tailwindStyledComponents.tws `tu-page-header__tip` : null)}
1701
+ `;
1702
+
1703
+ /**
1704
+ * Display placeholder lines before the data gets loaded to reduce load-time frustration.
1705
+ */
1706
+ const SkeletonLines = React.memo(({ margin = "10px 0", lines = 1, height, width = "100%", className, dataTestId }) => {
1707
+ const skeletonLines = [];
1708
+ const getWidth = (index) => {
1709
+ if (width instanceof Array) {
1710
+ return width[index] || "100%";
1711
+ }
1712
+ return width;
1713
+ };
1714
+ const getHeight = (index) => {
1715
+ if (height instanceof Array) {
1716
+ return height[index] || "auto";
1717
+ }
1718
+ return height;
1719
+ };
1720
+ for (let i = 0; i < lines; i++) {
1721
+ skeletonLines.push(jsxRuntime.jsx(SkeletonLine, Object.assign({ "data-testid": dataTestId, "data-type": "loading-skeleton-line", className: className, style: { height: getHeight(i), width: getWidth(i), margin: lines > 1 ? margin : "" } }, { children: lines > 1 && jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u00A0" }) }), i));
1722
+ }
1723
+ // eslint-disable-next-line react/jsx-no-useless-fragment
1724
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: skeletonLines });
1725
+ });
1726
+ const SkeletonLine = tailwindStyledComponents.tw.div `
1727
+ tu-skeleton-line
1728
+ `;
1729
+
1730
+ /**
1731
+ * Pagination Description. It could be used when you need navigation for your paging feature.
1732
+ *
1733
+ * @param {IPaginationProps} props - The props for the Pagination component
1734
+ * @returns {JSX.Element} Pagination component
1735
+ */
1736
+ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, pageCount, pageIndex, loading, className, dataTestId, getTranslatedCount, onPageChange, cursorBase, }) => {
1737
+ const [page, setPage] = React.useState(pageIndex);
1738
+ const [currentPage, setCurrentPage] = React.useState(String(pageIndex !== undefined ? pageIndex + 1 : 1));
1739
+ if (!loading && pageCount === undefined) {
1740
+ throw Error("Pagination should be provided with a pageCount");
1741
+ }
1742
+ React.useEffect(() => {
1743
+ if (pageIndex !== undefined && (isNaN(pageIndex) || pageIndex < 0)) {
1744
+ setPage(pageIndex);
1745
+ setCurrentPage(String(pageIndex + 1));
1746
+ }
1747
+ }, [pageIndex, setPage, setCurrentPage, pageCount]);
1748
+ const handlePageChange = React.useCallback((action) => {
1749
+ const from = page;
1750
+ let to = from;
1751
+ let description = "";
1752
+ switch (action) {
1753
+ case "prev":
1754
+ to = from !== undefined ? from - 1 : 0;
1755
+ previousPage();
1756
+ description = "Previous Page";
1757
+ break;
1758
+ case "next":
1759
+ to = from !== undefined ? from + 1 : 0;
1760
+ nextPage();
1761
+ description = "Next Page";
1762
+ break;
1763
+ }
1764
+ if (to !== undefined && to >= 0) {
1765
+ setPage(to);
1766
+ setCurrentPage(String(to + 1));
1767
+ }
1768
+ onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange({ from, to, description });
1769
+ }, [page, onPageChange, previousPage, nextPage]);
1770
+ if (loading) {
1771
+ return (jsxRuntime.jsx(Root$3, Object.assign({ className: className }, { children: jsxRuntime.jsx(SkeletonLines, { height: 16, width: 150 }) })));
1772
+ }
1773
+ return (jsxRuntime.jsxs(Root$3, 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
1774
+ ? !canNextPage || false
1775
+ : 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" })] })));
1776
+ };
1777
+ const Root$3 = tailwindStyledComponents.tw.div `
1778
+ tu-pagination
1779
+ `;
1780
+ const TextStyled = tailwindStyledComponents.twx(Text$1) `
1781
+ tu-pagination__text
1782
+ `;
1783
+
1784
+ /**
1785
+ * A Phone Input component is used for input of the type tel.
1786
+ *
1787
+ * It has an ActionButton which sends an phone call to the specified number using "tel:" link.
1788
+ *
1789
+ * Extends props of BaseInput.
1790
+ *
1791
+ * A reference to the input element is provided as the `ref` prop.
1792
+ * For specific input types make sure to use the corresponding input component.
1793
+ */
1794
+ const PhoneInput = React__namespace.forwardRef((_a, ref) => {
1795
+ var { dataTestId, fieldSize = "medium", disableAction = false } = _a, rest = __rest(_a, ["dataTestId", "fieldSize", "disableAction"]);
1796
+ const [phoneNumber, setPhoneNumber] = React__namespace.useState("");
1797
+ const callNumber = () => {
1798
+ return window.open(`tel:${phoneNumber}`);
1799
+ };
1800
+ return (jsxRuntime.jsx(BaseInput, Object.assign({ ref: ref, dataTestId: dataTestId, fieldSize: fieldSize, type: "tel", onChange: e => setPhoneNumber(e.target.value), actions: !disableAction && (jsxRuntime.jsx(ActionButton, { value: phoneNumber, type: "PHONE_NUMBER", onClick: callNumber, dataTestId: dataTestId && `${dataTestId}-phoneIcon`, iconSize: fieldSize })) }, rest)));
1801
+ });
1802
+
1803
+ function useConfirmExit(confirmExit, when = true) {
1804
+ const { navigator } = React.useContext(reactRouterDom.UNSAFE_NavigationContext);
1805
+ React.useEffect(() => {
1806
+ if (!when) {
1807
+ return;
1808
+ }
1809
+ const push = navigator.push;
1810
+ navigator.push = (...args) => {
1811
+ const result = confirmExit();
1812
+ if (result !== false) {
1813
+ push(...args);
1814
+ }
1815
+ };
1816
+ return () => {
1817
+ navigator.push = push;
1818
+ };
1819
+ }, [navigator, confirmExit, when]);
1820
+ }
1821
+ /**
1822
+ * The usePrompt hook.
1823
+ *
1824
+ * @param {string} message -
1825
+ * @param {boolean} when -
1826
+ * @returns {void} void
1827
+ */
1828
+ const usePrompt = (message, when = true) => {
1829
+ React.useEffect(() => {
1830
+ if (when) {
1831
+ window.onbeforeunload = function () {
1832
+ return message;
1833
+ };
1834
+ }
1835
+ return () => {
1836
+ window.onbeforeunload = null;
1837
+ };
1838
+ }, [message, when]);
1839
+ const confirmExit = React.useCallback(() => {
1840
+ const confirm = window.confirm(message);
1841
+ return confirm;
1842
+ }, [message]);
1843
+ useConfirmExit(confirmExit, when);
1844
+ };
1845
+ /**
1846
+ * The Prompt function.
1847
+ *
1848
+ * @param {PromptProps} Props -
1849
+ * @returns {void} void
1850
+ */
1851
+ const Prompt = ({ when, message }) => {
1852
+ usePrompt(message, when);
1853
+ return null;
1854
+ };
1855
+
1856
+ const RadioGroupContext = React__namespace.createContext(null);
1857
+
1858
+ /**
1859
+ * Use radio buttons when you have a group of mutually exclusive choices and only one selection from the group is allowed.
1860
+ *
1861
+ * 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.
1862
+ *
1863
+ * _**Do use** Radio buttons in forms, settings, or selections in a list._
1864
+ *
1865
+ * _**Do not use** Radio buttons if a user can select many option from a list, use checkboxes instead of radio buttons._
1866
+ *
1867
+ * @param {RadioGroupProps} props - The props for the RadioGroup component
1868
+ * @returns {JSX.Element} RadioGroup component
1869
+ */
1870
+ const RadioGroup = ({ children, id, name, value, disabled, onChange, label, inline, className, dataTestId, isInvalid, }) => {
1871
+ 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: {
1872
+ id,
1873
+ value,
1874
+ name: name || id,
1875
+ onChange,
1876
+ disabled,
1877
+ isInvalid,
1878
+ } }, { children: children })) })) })));
1879
+ };
1880
+ RadioGroup.displayName = "RadioGroup";
1881
+ const Flex = tailwindStyledComponents.tw.div `
1882
+ ${({ $inline }) => ($inline ? tailwindStyledComponents.tws `tu-radiogroup--inline` : tailwindStyledComponents.tws `tu-radiogroup`)}
1883
+ `;
1884
+
1885
+ /**
1886
+ * The RadioItem component.
1887
+ *
1888
+ * @param {RadioItemProps} props - The props for the RadioItem component
1889
+ * @returns {JSX.Element} RadioItem component
1890
+ */
1891
+ const RadioItem = ({ label, value, dataTestId, className, description }) => {
1892
+ const groupCtx = React__namespace.useContext(RadioGroupContext);
1893
+ const isChecked = (groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.value) === value;
1894
+ return (jsxRuntime.jsxs(InputWrapper, Object.assign({ className: className, htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id} ${label}`, "data-testid": dataTestId && `${dataTestId}-Wrapper` }, { children: [jsxRuntime.jsx(Input, { id: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id} ${label}`, type: "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} ${label}`, 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} ${label}`, "data-testid": dataTestId && `${dataTestId}-Description`, "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled }, { children: description })))] })] })));
1895
+ };
1896
+ const InputWrapper = tailwindStyledComponents.tw.label `tu-radioitem__wrapper`;
1897
+ const Input = tailwindStyledComponents.tw.input `
1898
+ tu-radioitem
1899
+ ${({ $checked }) => $checked && tailwindStyledComponents.tws `tu-radioitem--checked`}
1900
+ ${({ $disabled }) => $disabled && tailwindStyledComponents.tws `tu-radioitem--disabled`}
1901
+ ${({ $isInvalid }) => $isInvalid && tailwindStyledComponents.tws `tu-radioitem--invalid`}
1902
+ `;
1903
+ const LabelContainer$1 = tailwindStyledComponents.tw.div `tu-radioitem__label-container`;
1904
+ const Description$1 = tailwindStyledComponents.tw.label `
1905
+ tu-radioitem__description
1906
+ ${({ $disabled }) => $disabled && tailwindStyledComponents.tws `tu-radioitem__description--disabled`}
1907
+ `;
1908
+
1909
+ /**
1910
+ * A thin wrapper around the `BaseInput` component for text input fields.
1911
+ *
1912
+ * NOTE: If shown with a label, please use the `TextField` component instead.
1913
+ */
1914
+ const TextInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BaseInput, Object.assign({ ref: ref, type: "text" }, props))));
1915
+
1916
+ /**
1917
+ * The Search component is used to render a search input field.
1918
+ *
1919
+ * @param {SearchProps} props - The props for the Search component
1920
+ * @returns {JSX.Element} Search component
1921
+ */
1922
+ const Search = (_a) => {
1923
+ 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"]);
1924
+ 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: () => {
1925
+ onClear();
1926
+ } }, { children: jsxRuntime.jsx(Icon, { name: "XMarkIcon", size: "small" }) }))) : undefined, value: value, disabled: disabled, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, autoComplete: autoComplete })));
1927
+ };
1928
+ const StyledTextInput = tailwindStyledComponents.twx(TextInput) `
1929
+ tu-search
1930
+ ${({ $showBorderWhenNotInFocus }) => $showBorderWhenNotInFocus && tailwindStyledComponents.tws `tu-search--border`}
1931
+ ${({ $widenOnFocus }) => $widenOnFocus && tailwindStyledComponents.tws `tu-search--widen-on-focus`}
1932
+ `;
1933
+
1934
+ /**
1935
+ * The Spacer component is used for adding a bit of space in the ui.
1936
+ *
1937
+ * @param {SpacerProps} props - The props for the Spacer component
1938
+ * @returns {JSX.Element} Spacer component
1939
+ */
1940
+ const Spacer = ({ minHeight, border = false, dataTestId }) => {
1941
+ return jsxRuntime.jsx(Space, { "data-testid": dataTestId, "$minHeight": minHeight, "$border": border });
1942
+ };
1943
+ const GetSpacerHeight = () => ({ $minHeight }) => {
1944
+ switch ($minHeight) {
1945
+ case "normal":
1946
+ return tailwindStyledComponents.tws `tu-spacer--normal`;
1947
+ case "large":
1948
+ return tailwindStyledComponents.tws `tu-spacer--large`;
1949
+ default:
1950
+ return "";
1951
+ }
1952
+ };
1953
+ const Space = tailwindStyledComponents.tw.div `
1954
+ ${p => `${p.$border ? `tu-spacer--border` : null}`}
1955
+ ${GetSpacerHeight()}
1956
+ `;
1957
+
1958
+ /**
1959
+ * The SectionHeader component is used on sections to set the section title.
1960
+ *
1961
+ * @param {SectionHeaderProps} props - The props for the section header component
1962
+ * @returns {JSX.Element} SectionHeader component
1963
+ */
1964
+ const SectionHeader = ({ title, subtitle, dataTestId, addon }) => {
1965
+ return (jsxRuntime.jsxs(SectionHeaderContainer, { children: [jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(reactHelmetAsync.Helmet, { title: title }) }), jsxRuntime.jsxs(StyledFlex, { children: [jsxRuntime.jsx(Heading$1, Object.assign({ variant: "secondary", dataTestId: dataTestId }, { children: title })), addon] }), subtitle && (jsxRuntime.jsx(Heading$1, Object.assign({ variant: "subtitle", subtle: true }, { children: subtitle }))), jsxRuntime.jsx(Spacer, { minHeight: "normal" })] }));
1966
+ };
1967
+ const SectionHeaderContainer = tailwindStyledComponents.tw.div `tu-section-header`;
1968
+ const StyledFlex = tailwindStyledComponents.tw.div `tu-section-header__flex`;
1969
+
1970
+ /**
1971
+ * The SelectContainer component.
1972
+ *
1973
+ * @param {SelectContainerProps} props - The props for the SelectContainer component
1974
+ * @returns {JSX.Element} SelectContainer component
1975
+ */
1976
+ const SelectContainer$1 = ({ children, label, hideLabel, id, hasError, error, description, info, dataTestId, isDisabled, }) => {
1977
+ return (jsxRuntime.jsxs(Container$1, 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 })))] })));
1978
+ };
1979
+ const Container$1 = tailwindStyledComponents.tw.label `
1980
+ tu-select__container
1981
+ tu-select
1982
+ ${({ $hasError }) => ($hasError ? tailwindStyledComponents.tws `tu-select--invalid` : null)}
1983
+ ${({ $isDisabled }) => ($isDisabled ? tailwindStyledComponents.tws `tu-select--disabled` : null)}
1984
+ `;
1985
+ const InformativeText = tailwindStyledComponents.twx(Text$1) `
1986
+ tu-informative-text
1987
+ ${p => (p.$hasError ? `tu-informative-text--error` : null)}
1988
+ `;
1989
+
1990
+ /**
1991
+ * @param {MultiValue<Option> | SingleValue<Option>} arg option to check type
1992
+ * @returns {arg is MultiValue<Option> } is Multivalue
1993
+ */
1994
+ function isMultiValue(arg) {
1995
+ return Array.isArray(arg);
1996
+ }
1997
+ function isGroupBase(arg) {
1998
+ return arg.options !== undefined;
1999
+ }
2000
+ const isSelectedOption = (option, selected) => {
2001
+ if (isGroupBase(option)) {
2002
+ return false;
2003
+ }
2004
+ return isMultiValue(selected)
2005
+ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
2006
+ selected.some(v => v.value === option.value)
2007
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
2008
+ option.value === (selected === null || selected === void 0 ? void 0 : selected.value);
2009
+ };
2010
+ const removeSelectedFromGroups = (group, selected) => {
2011
+ if (isGroupBase(group)) {
2012
+ return Object.assign(Object.assign({}, group), { options: group.options.filter(option => !isSelectedOption(option, selected)) });
2013
+ }
2014
+ return group;
2015
+ };
2016
+ /**
2017
+ * @template IsMulti
2018
+ * @template Group
2019
+ * @param {OptionsOrGroups<Option, Group> | undefined} options An array of options to select from
2020
+ * @param {PropsValue<Option> | undefined} value Selected values
2021
+ * @returns {OptionsOrGroups<Option, Group>} An array of ordered options with selected on top
2022
+ */
2023
+ const getOrderedOptions = (options, value) => {
2024
+ if (value && options) {
2025
+ const orderedValues = isMultiValue(value)
2026
+ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
2027
+ [...value].sort((a, b) => a.label.localeCompare(b.label))
2028
+ : [value];
2029
+ const selectableOptions = options
2030
+ .filter(option => !isSelectedOption(option, value))
2031
+ .map(option => removeSelectedFromGroups(option, value));
2032
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2033
+ return orderedValues.concat(selectableOptions) || [];
2034
+ }
2035
+ return options || [];
2036
+ };
2037
+ const SelectPrefix = tailwindStyledComponents.tw.div `
2038
+ tu-select__prefix
2039
+ `;
2040
+
2041
+ /**
2042
+ * A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
2043
+ *
2044
+ * @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
2045
+ * @returns {JSX.Element} SingleSelectMenuItem
2046
+ */
2047
+ const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, focused, disabled, }) => {
2048
+ 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 }));
2049
+ };
2050
+ /**
2051
+ * A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
2052
+ *
2053
+ * @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
2054
+ * @returns {JSX.Element} multi select menu item
2055
+ */
2056
+ const MultiSelectMenuItem = ({ label, onClick, selected, dataTestId, focused, disabled, }) => {
2057
+ return (jsxRuntime.jsx(MenuItem, { dataTestId: dataTestId, label: label, disabled: disabled, prefix: jsxRuntime.jsx(Checkbox, { checked: selected, readOnly: false, onChange: () => null, disabled: disabled, onClick: e => {
2058
+ e.stopPropagation();
2059
+ } }), onClick: e => {
2060
+ e.stopPropagation();
2061
+ onClick && onClick(e);
2062
+ }, selected: selected, focused: focused }));
2063
+ };
2064
+
2065
+ /**
2066
+ * Extended Tag component with information about its own width.
2067
+ * Used in the select component.
2068
+ *
2069
+ * @param {TagProps} props - The props for the tag component
2070
+ * @returns {JSX.Element} TagWithWidth component
2071
+ */
2072
+ const TagWithWidth = (_a) => {
2073
+ var { onWidthKnown, children } = _a, rest = __rest(_a, ["onWidthKnown", "children"]);
2074
+ const ref = React__default["default"].useRef(null);
2075
+ React__default["default"].useLayoutEffect(() => {
2076
+ var _a;
2077
+ onWidthKnown && onWidthKnown({ width: ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0 });
2078
+ }, [ref, onWidthKnown]);
2079
+ return (jsxRuntime.jsx(Tag, Object.assign({ ref: ref }, rest, { children: children })));
2080
+ };
2081
+
2082
+ /**
2083
+ * TagsContainer component to display tags in limited space when children can't fit space it displays counter
2084
+ *
2085
+ * @param {TagsContainerProps} props - The props for the TagContainer
2086
+ * @returns {JSX.Element} TagsContainer
2087
+ */
2088
+ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix }) => {
2089
+ const [isReady, setIsReady] = React__default["default"].useState(false);
2090
+ const [counterWidth, setCounterWidth] = React__default["default"].useState(0);
2091
+ const containerRef = React__default["default"].useRef(null);
2092
+ const availableWidth = React__default["default"].useRef();
2093
+ const childrenWidth = React__default["default"].useRef([]);
2094
+ const itemsCount = items.length;
2095
+ React__default["default"].useLayoutEffect(() => {
2096
+ var _a;
2097
+ availableWidth.current = ((_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0;
2098
+ }, [containerRef]);
2099
+ const onWidthKnownHandler = ({ width: reportedWidth }) => {
2100
+ childrenWidth.current.push({ width: reportedWidth + itemsGap });
2101
+ if (childrenWidth.current.length === itemsCount) {
2102
+ setIsReady(true);
2103
+ }
2104
+ };
2105
+ const requiredSpace = childrenWidth.current.reduce((previous, current) => {
2106
+ return previous + current.width;
2107
+ }, 0);
2108
+ let counter = 0;
2109
+ const availableSpace = ((availableWidth === null || availableWidth === void 0 ? void 0 : availableWidth.current) || 0) - counterWidth;
2110
+ const renderedElements = items
2111
+ .concat({ text: "", onClick: () => null, disabled: false }) // reserved element for a potential counter
2112
+ .map((item, index) => {
2113
+ const spaceNeeded = childrenWidth.current.slice(0, index + 1).reduce((previous, current) => {
2114
+ return previous + current.width;
2115
+ }, 0);
2116
+ const isLast = index === items.length;
2117
+ const counterRequired = requiredSpace > availableSpace && counter !== 0;
2118
+ if (isLast && counterRequired) {
2119
+ return (jsxRuntime.jsx(TagWithWidth, Object.assign({ onWidthKnown: ({ width: reportedWidth }) => setCounterWidth(reportedWidth), color: "neutral" }, { children: jsxRuntime.jsxs(Counter, { children: ["+", counter] }) }), item.text + index));
2120
+ }
2121
+ if (isLast) {
2122
+ return null;
2123
+ }
2124
+ const itemCanFit = spaceNeeded <= availableSpace;
2125
+ if (itemCanFit) {
2126
+ return (jsxRuntime.jsx(TagWithWidth, Object.assign({ onWidthKnown: onWidthKnownHandler, className: tailwindStyledComponents.tws `shrink-0 inline-flex`, onClose: e => {
2127
+ e.stopPropagation();
2128
+ item.onClick();
2129
+ }, color: item.disabled ? "unknown" : "primary", dataTestId: item.text }, { children: item.text }), item.text + index));
2130
+ }
2131
+ const fromTheItems = item.text !== "";
2132
+ if (fromTheItems) {
2133
+ counter = counter + 1;
2134
+ }
2135
+ return null;
2136
+ })
2137
+ .filter(element => element !== null);
2138
+ return (jsxRuntime.jsxs(Container, Object.assign({ style: {
2139
+ width: `${width}`,
2140
+ }, "$ready": isReady, ref: containerRef }, { children: [renderedElements, postFix] })));
2141
+ };
2142
+ const Container = tailwindStyledComponents.tw.div `
2143
+ tu-select__dynamic-tag--container
2144
+ ${({ $ready }) => {
2145
+ return $ready ? tailwindStyledComponents.tws `visible` : tailwindStyledComponents.tws `invisible`;
2146
+ }}
2147
+ `;
2148
+ const Counter = tailwindStyledComponents.tw.div `
2149
+ tu-select__counter
2150
+ `;
2151
+
2152
+ /**
2153
+ * A hook to retrieve components override object.
2154
+ * 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.
2155
+ *
2156
+ * @template IsMulti
2157
+ * @template Group
2158
+ * @param {Partial<SelectComponents<Option, IsMulti, Group>> | undefined} componentsProps a custom component prop that you can to override defaults
2159
+ * @param {boolean} disabled decide to override disabled variant
2160
+ * @param {boolean} menuIsOpen menu is open state
2161
+ * @param {React.MutableRefObject<boolean>} refMenuIsEnabled a flag to block menu from open
2162
+ * @param {string} dataTestId a test id
2163
+ * @param {number} maxSelectedDisplayCount a number of max display count
2164
+ * @param {JSX.Element} dropdownIcon an custom dropdown icon
2165
+ * @returns {Partial<SelectComponents<Option, boolean, GroupBase<Option>>> | undefined} components object to override react-select default components
2166
+ */
2167
+ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon) => {
2168
+ // perhaps it should not be wrap in memo (causing some issues with opening and closing on mobiles)
2169
+ const customComponents = React__namespace.useMemo(() => {
2170
+ return Object.assign({ ValueContainer: props => {
2171
+ if (props.isMulti) {
2172
+ const PLACEHOLDER_KEY = "placeholder";
2173
+ const key = props && props.children && props.children[0] ? props.children[0].key : "";
2174
+ const values = props && props.children ? props.children[0] : [];
2175
+ const tags = key === PLACEHOLDER_KEY ? [] : values;
2176
+ const searchInput = props && props.children && props.children[1];
2177
+ return (jsxRuntime.jsx(ReactSelect.components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled }, { children: maxSelectedDisplayCount === undefined ? (jsxRuntime.jsx(TagsContainer, { width: "100%", items: tags
2178
+ ? tags.map(({ props: tagProps }) => {
2179
+ return {
2180
+ text: tagProps.children,
2181
+ onClick: disabled
2182
+ ? undefined
2183
+ : (e) => {
2184
+ var _a, _b;
2185
+ refMenuIsEnabled.current = false;
2186
+ ((_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));
2187
+ },
2188
+ disabled: disabled,
2189
+ };
2190
+ })
2191
+ : [], postFix: searchInput })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [tags &&
2192
+ tags.slice(0, maxSelectedDisplayCount).map(({ props: tagProps }) => {
2193
+ var _a, _b;
2194
+ return (jsxRuntime.jsx(Tag, Object.assign({ className: tailwindStyledComponents.tws `shrink-0 inline-flex`, onClose: e => {
2195
+ var _a, _b;
2196
+ e.stopPropagation();
2197
+ refMenuIsEnabled.current = false;
2198
+ ((_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));
2199
+ }, 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()));
2200
+ }), tags && tags.length > maxSelectedDisplayCount && (jsxRuntime.jsxs(Tag, Object.assign({ color: "neutral", dataTestId: "counter" }, { children: ["+", tags.length - maxSelectedDisplayCount] }))), searchInput] })) })));
2201
+ }
2202
+ return (jsxRuntime.jsx(ReactSelect.components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled }, { children: props.children })));
2203
+ }, LoadingIndicator: props => {
2204
+ return jsxRuntime.jsx(Spinner, { size: "small", className: tailwindStyledComponents.tws `mt-1.5 mr-1` });
2205
+ }, DropdownIndicator: props => {
2206
+ const icon = props.selectProps.menuIsOpen ? (jsxRuntime.jsx(Icon, { name: "ChevronUpIcon", size: "medium" })) : (jsxRuntime.jsx(Icon, { name: "ChevronDownIcon", size: "medium" }));
2207
+ return props.selectProps.isLoading ? null : (jsxRuntime.jsx(ReactSelect.components.DropdownIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(StyledIcon, { children: dropdownIcon ? dropdownIcon : icon }) })));
2208
+ }, IndicatorSeparator: () => null, ClearIndicator: props => {
2209
+ if (disabled) {
2210
+ return null;
2211
+ }
2212
+ 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" }) })) })));
2213
+ }, Control: props => {
2214
+ return (jsxRuntime.jsx(ReactSelect.components.Control, Object.assign({}, props, { className: props.isDisabled ? tailwindStyledComponents.tws `tu-select__control--disabled` : "" })));
2215
+ }, SingleValue: props => {
2216
+ 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 })) })));
2217
+ }, Menu: props => {
2218
+ return (jsxRuntime.jsx(ReactSelect.components.Menu, Object.assign({}, props, { className: props.selectProps.menuIsOpen
2219
+ ? tailwindStyledComponents.tws `tu-select__menu-list animate-fade-in-fast`
2220
+ : tailwindStyledComponents.tws `tu-select__menu-list animate-fade-out-fast` })));
2221
+ }, Option: props => {
2222
+ const componentProps = {
2223
+ label: props.label,
2224
+ focused: props.isFocused,
2225
+ selected: props.isSelected,
2226
+ onClick: props.innerProps.onClick,
2227
+ };
2228
+ 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 }))) })));
2229
+ } }, componentsProps);
2230
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2231
+ }, [componentsProps, disabled, maxSelectedDisplayCount]); // do not add dropdownIcon (it will cause issue with opening/closing list for selects with custom icon)
2232
+ return customComponents;
2233
+ };
2234
+ const StyledIcon = tailwindStyledComponents.tw.div `
2235
+ tu-select--icon
2236
+ `;
2237
+ const XMarkIcon = tailwindStyledComponents.tw.div `
2238
+ tu-select--icon
2239
+ tu-select__x-icon
2240
+ `;
2241
+
2242
+ /**
2243
+ * @template IsMulti
2244
+ * @template Group
2245
+ * @param {React.RefObject<HTMLDivElement>} refContainer react ref to container element
2246
+ * @param {React.RefObject<HTMLDivElement>} refPrefix react ref to prefix element
2247
+ * @param {number | undefined} maxSelectedDisplayCount a number of max display count
2248
+ * @param {StylesConfig<Option, IsMulti, Group> | undefined} styles a optional object to override styles of react-select
2249
+ * @returns {StylesConfig<Option, boolean>} styles to override in select
2250
+ */
2251
+ const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, styles) => {
2252
+ const customStyles = React__namespace.useMemo(() => {
2253
+ return Object.assign({ control: base => {
2254
+ return Object.assign(Object.assign({}, base), { border: "0", boxShadow: "0", "&:hover": {
2255
+ border: "0",
2256
+ }, marginRight: "2px", backgroundColor: "" });
2257
+ }, singleValue: base => (Object.assign({}, base)), multiValue: base => (Object.assign({}, base)), multiValueLabel: base => (Object.assign({}, base)), indicatorsContainer: base => (Object.assign({}, base)), indicatorSeparator: () => ({
2258
+ width: "0px",
2259
+ }), menu: base => {
2260
+ return Object.assign(Object.assign({}, base), { width: "100%", marginTop: "4px", marginBottom: "18px", transition: "all 1s ease-in-out" });
2261
+ }, 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 => {
2262
+ 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" });
2263
+ }, valueContainer: base => {
2264
+ return Object.assign(Object.assign({}, base), { flexWrap: maxSelectedDisplayCount !== undefined ? "wrap" : "nowrap", gap: "0.25rem" });
2265
+ }, 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 => {
2266
+ return Object.assign(Object.assign({}, base), { padding: "0px" });
2267
+ } }, styles);
2268
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2269
+ }, [refContainer, refPrefix]);
2270
+ return { customStyles };
2271
+ };
2272
+
2273
+ /**
2274
+ * A hook used by selects to share the common code
2275
+ *
2276
+ * @param {SelectProps} props - The props for the Select component
2277
+ * @returns {IUseSelect} Select component
2278
+ */
2279
+ const useSelect = (_a) => {
2280
+ var _b;
2281
+ 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"]);
2282
+ const refContainer = React__default["default"].useRef(null);
2283
+ const refPrefix = React__default["default"].useRef(null);
2284
+ const { customStyles } = useCustomStyles(refContainer, refPrefix, maxSelectedDisplayCount, styles);
2285
+ const [menuIsOpen, setMenuIsOpen] = React__default["default"].useState((_b = props.menuIsOpen) !== null && _b !== void 0 ? _b : false);
2286
+ const refMenuIsEnabled = React__default["default"].useRef(true);
2287
+ const customComponents = useCustomComponents(components, disabled || false, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon);
2288
+ const menuPlacement = "auto";
2289
+ const openMenuHandler = () => __awaiter(void 0, void 0, void 0, function* () {
2290
+ onMenuOpen && onMenuOpen();
2291
+ if (refMenuIsEnabled.current) {
2292
+ setMenuIsOpen(true);
2293
+ }
2294
+ else {
2295
+ refMenuIsEnabled.current = true;
2296
+ }
2297
+ });
2298
+ const closeMenuHandler = () => {
2299
+ setMenuIsOpen(false);
2300
+ onMenuClose && onMenuClose();
2301
+ };
2302
+ const orderedOptions = React__default["default"].useMemo(() => {
2303
+ return disabled
2304
+ ? getOrderedOptions(options, value).map(option => {
2305
+ return Object.assign(Object.assign({}, option), { disabled: true });
2306
+ })
2307
+ : getOrderedOptions(options, value);
2308
+ }, [options, value, disabled]);
2309
+ return {
2310
+ refContainer,
2311
+ refPrefix,
2312
+ customStyles,
2313
+ menuIsOpen,
2314
+ customComponents,
2315
+ menuPlacement,
2316
+ openMenuHandler,
2317
+ closeMenuHandler,
2318
+ orderedOptions,
2319
+ };
2320
+ };
2321
+
2322
+ /**
2323
+ * The CreatableSelect component.
2324
+ *
2325
+ * @param {CreateableSelectProps} props - The props for the CreatableSelect component
2326
+ * @returns {JSX.Element} CreatableSelect component
2327
+ */
2328
+ const CreatableSelect = (props) => {
2329
+ const { id, dataTestId = "select", async, maxMenuHeight = 200, label, error, disabled, isMulti, value, hideLabel, description, info, options, onChange, isLoading, classNamePrefix = "", filterOption, prefix, } = props;
2330
+ const hasError = !!error;
2331
+ const { refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
2332
+ const selectProps = {
2333
+ value,
2334
+ menuPlacement,
2335
+ maxMenuHeight,
2336
+ onChange,
2337
+ "aria-label": label,
2338
+ "data-testid": dataTestId,
2339
+ components: customComponents,
2340
+ styles: customStyles,
2341
+ tabSelectsValue: false,
2342
+ blurInputOnSelect: !isMulti,
2343
+ menuPortalTarget: document.body,
2344
+ isSearchable: disabled ? false : true,
2345
+ menuShouldBlockScroll: true,
2346
+ menuShouldScrollIntoView: true,
2347
+ openMenuOnFocus: disabled ? false : true,
2348
+ menuIsOpen: disabled ? false : menuIsOpen,
2349
+ openMenuOnClick: true,
2350
+ closeMenuOnSelect: false,
2351
+ isMulti: isMulti,
2352
+ classNamePrefix,
2353
+ isLoading,
2354
+ id,
2355
+ };
2356
+ 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: () => {
2357
+ !disabled && openMenuHandler();
2358
+ }, onMenuClose: () => {
2359
+ closeMenuHandler();
2360
+ } }))) : (jsxRuntime.jsx(ReactCreatableSelect__default["default"], Object.assign({}, selectProps, { options: filterOption ? orderedOptions : options, isMulti: isMulti, onMenuOpen: () => {
2361
+ !disabled && openMenuHandler();
2362
+ }, onMenuClose: () => {
2363
+ closeMenuHandler();
2364
+ } })))] }) })));
2365
+ };
2366
+
2367
+ /**
2368
+ * Selects are input components used to choose a value from a set.
2369
+ *
2370
+ * @param {SelectProps} props - The props for the Select component
2371
+ * @returns {JSX.Element} Select component
2372
+ */
2373
+ const Select = (props) => {
2374
+ const { className } = props, propsNoClassName = __rest(props, ["className"]);
2375
+ const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = "", onMenuScrollToBottom, filterOption, onInputChange, isSearchable, isClearable, } = props;
2376
+ const { refContainer, refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
2377
+ const selectProps = {
2378
+ value,
2379
+ menuPlacement,
2380
+ maxMenuHeight,
2381
+ onChange,
2382
+ "aria-label": label,
2383
+ "data-testid": dataTestId,
2384
+ components: customComponents,
2385
+ styles: customStyles,
2386
+ tabSelectsValue: false,
2387
+ blurInputOnSelect: !isMulti,
2388
+ menuPortalTarget: props.menuPortalTarget || document.body,
2389
+ isSearchable: disabled ? false : isSearchable,
2390
+ menuShouldBlockScroll: true,
2391
+ menuShouldScrollIntoView: true,
2392
+ openMenuOnFocus: true,
2393
+ menuIsOpen,
2394
+ openMenuOnClick: true,
2395
+ closeMenuOnSelect: false,
2396
+ isMulti,
2397
+ classNamePrefix,
2398
+ isLoading,
2399
+ isClearable,
2400
+ id,
2401
+ onMenuScrollToBottom,
2402
+ onInputChange,
2403
+ };
2404
+ 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 })))] })));
2405
+ };
2406
+ const SelectContainer = tailwindStyledComponents.tw.div `
2407
+ tu-select
2408
+ ${({ $hasError }) => ($hasError ? tailwindStyledComponents.tws `tu-select--invalid` : null)}
2409
+ ${({ $isDisabled }) => ($isDisabled ? tailwindStyledComponents.tws `tu-select--disabled` : null)}
2410
+ `;
2411
+ Select.displayName = "Select";
2412
+
2413
+ /**
2414
+ * A hook used to detect what children are overflowing a container.
2415
+ *
2416
+ * @param {OverflowItemsOptions} root0 The options for the hook.
2417
+ * @param {OverflowItemsOptions.threshold} root0.threshold The threshold for the intersection observer.
2418
+ * @returns {object} The overflow items and the ref to the container.
2419
+ */
2420
+ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id", children, }) => {
2421
+ const [itemOverflowMap, setItemOverflowMap] = React.useState({});
2422
+ const overflowContainerRef = React.useRef(null); // TODO: Handle other elements than div
2423
+ const observerRef = React.useRef(null);
2424
+ const handleIntersection = React.useCallback(entries => {
2425
+ const updatedEntries = {};
2426
+ entries.forEach(entry => {
2427
+ const targetElementId = entry.target[childUniqueIdentifierAttribute];
2428
+ if (targetElementId) {
2429
+ updatedEntries[targetElementId] = entry.isIntersecting ? false : true;
2430
+ }
2431
+ });
2432
+ setItemOverflowMap(prev => (Object.assign(Object.assign({}, prev), updatedEntries)));
2433
+ }, [childUniqueIdentifierAttribute]);
2434
+ const observe = React.useCallback(() => {
2435
+ const node = overflowContainerRef.current;
2436
+ if (node && node.children) {
2437
+ const root = overflowContainerRef.current;
2438
+ const options = { root, threshold };
2439
+ const observer = new IntersectionObserver(handleIntersection, options);
2440
+ Array.from(node.children).forEach(child => {
2441
+ observer.observe(child);
2442
+ });
2443
+ observer.observe(node);
2444
+ observerRef.current = observer;
2445
+ }
2446
+ }, [handleIntersection, threshold]);
2447
+ const unobserve = React.useCallback(() => {
2448
+ const currentObserver = observerRef.current;
2449
+ currentObserver === null || currentObserver === void 0 ? void 0 : currentObserver.disconnect();
2450
+ observerRef.current = null;
2451
+ }, []);
2452
+ const initializeObserver = React.useCallback(() => {
2453
+ unobserve();
2454
+ observe();
2455
+ }, [observe, unobserve]);
2456
+ React.useEffect(() => {
2457
+ initializeObserver();
2458
+ return () => {
2459
+ unobserve();
2460
+ };
2461
+ }, [initializeObserver, unobserve, children]);
2462
+ return { overflowContainerRef, itemOverflowMap };
2463
+ };
2464
+
2465
+ /**
2466
+ * The sidebar components is used to render a responsive sidebar.
2467
+ * - The sidebar will be rendered horizontally until a given breakpoint where it will be stacked vertically.
2468
+ * - The sidebar hides items that does not fit in the sidebar and show them in a more menu.
2469
+ * - **_The sidebar is just a wrapper. You are responsible for styling the children._**
2470
+ *
2471
+ * When using this component make sure to add `setupIntersectionObserver();` to your jest.setup.ts file.
2472
+ *
2473
+ * @param {SidebarProps} props - The props for the Sidebar component
2474
+ * @returns {JSX.Element} Sidebar component
2475
+ */
2476
+ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", className, dataTestId = "sidebar", moreMenuProps, menuListProps, overflowThreshold, }) => {
2477
+ const { overflowContainerRef, itemOverflowMap } = useOverflowItems({
2478
+ children,
2479
+ childUniqueIdentifierAttribute: "id",
2480
+ threshold: overflowThreshold !== null && overflowThreshold !== void 0 ? overflowThreshold : 0.8,
2481
+ });
2482
+ const overflowItemCount = Object.values(itemOverflowMap).filter(isOverflowing => isOverflowing).length;
2483
+ const itemVisibilityClassName = (id) => {
2484
+ if (itemOverflowMap[id]) {
2485
+ return tailwindStyledComponents.tws `invisible`;
2486
+ }
2487
+ return tailwindStyledComponents.tws `visible`;
2488
+ };
2489
+ return (jsxRuntime.jsxs(Root$2, 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 => {
2490
+ return React__default["default"].cloneElement(child, {
2491
+ className: `${child.props.className} ${itemVisibilityClassName(child.props.id)}`,
2492
+ });
2493
+ }) })), overflowItemCount > 0 ? (jsxRuntime.jsx(MoreMenu, Object.assign({ iconButtonProps: {
2494
+ circular: false,
2495
+ variant: "transparent",
2496
+ color: "secondary",
2497
+ }, menuPlacement: "bottom-end" }, moreMenuProps, { className: `${(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className) || ""} !p-0`, dataTestId: dataTestId && `${dataTestId}-more-menu` }, { children: jsxRuntime.jsx(MenuList, Object.assign({}, menuListProps, { dataTestId: dataTestId && `${dataTestId}-menu-list` }, { children: React__default["default"].Children.map(children, child => {
2498
+ return itemOverflowMap[child.props.id] ? child : null;
2499
+ }) })) }))) : null] })));
2500
+ };
2501
+ const Root$2 = tailwindStyledComponents.tw.div `
2502
+ tu-sidebar
2503
+ `;
2504
+ const breakpointClasses = {
2505
+ xs: tailwindStyledComponents.tws `tu-sidebar__child-container--xs`,
2506
+ sm: tailwindStyledComponents.tws `tu-sidebar__child-container--sm`,
2507
+ md: tailwindStyledComponents.tws `tu-sidebar__child-container--md`,
2508
+ lg: tailwindStyledComponents.tws `tu-sidebar__child-container--lg`,
2509
+ xl: tailwindStyledComponents.tws `tu-sidebar__child-container--xl`,
2510
+ "2xl": tailwindStyledComponents.tws `tu-sidebar__child-container--2xl`,
2511
+ "3xl": tailwindStyledComponents.tws `tu-sidebar__child-container--3xl`,
2512
+ };
2513
+ const ChildContainer = tailwindStyledComponents.tw.div `
2514
+ tu-sidebar__child-container
2515
+ ${({ $breakpoint }) => breakpointClasses[$breakpoint]}
2516
+ `;
2517
+
2518
+ /**
2519
+ * The TextArea is a base component, and should not be used very often.
2520
+ * For most cases the TextAreaField is the correct component.
2521
+ */
2522
+ const TextArea = React__namespace.forwardRef((_a, ref) => {
2523
+ 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"]);
2524
+ return (jsxRuntime.jsx(StyledTextArea, Object.assign({ 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 })));
2525
+ });
2526
+ const StyledTextArea = tailwindStyledComponents.tw.textarea `
2527
+ tu-textarea
2528
+ ${({ $invalid }) => ($invalid ? tailwindStyledComponents.tws `tu-textarea--invalid` : null)}
2529
+ ${({ disabled }) => (disabled ? tailwindStyledComponents.tws `tu-textarea--disabled` : null)}
2530
+ ${({ $resize }) => {
2531
+ switch ($resize) {
2532
+ case "both":
2533
+ return tailwindStyledComponents.tws `resize`;
2534
+ case "horizontal":
2535
+ return tailwindStyledComponents.tws `resize-x`;
2536
+ case "vertical":
2537
+ return tailwindStyledComponents.tws `resize-y`;
2538
+ case "none":
2539
+ return tailwindStyledComponents.tws `resize-none`;
2540
+ default:
2541
+ return null;
2542
+ }
2543
+ }};
2544
+ `;
2545
+
2546
+ /**
2547
+ * The TextLengthIndicator component shows a `{length}/{maxLength}` label.
2548
+ * Used for TextFields to communicate a maximum allowed input length.
2549
+ *
2550
+ * @param {TextLengthIndicatorProps} props - The props for the TextLengthIndicator component
2551
+ * @returns {JSX.Element} TextLengthIndicator component
2552
+ */
2553
+ const TextLengthIndicator = ({ length, maxLength }) => {
2554
+ return (jsxRuntime.jsxs(Root$1, { children: [length, "/", maxLength] }));
2555
+ };
2556
+ const Root$1 = tailwindStyledComponents.tw.span `
2557
+ font-mono
2558
+ `;
2559
+
2560
+ const TextAreaField = React__namespace.forwardRef((_a, ref) => {
2561
+ var { label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
2562
+ const [valueLength, setValueLength] = React__namespace.useState(value ? `${value}`.length : 0);
2563
+ const renderAsInvalid = isInvalid || Boolean(errorMessage);
2564
+ const handleChange = React__namespace.useCallback((event) => {
2565
+ setValueLength(event.target.value.length);
2566
+ if (onChange) {
2567
+ onChange(event);
2568
+ }
2569
+ }, [onChange]);
2570
+ return (jsxRuntime.jsx(FormGroup, Object.assign({ label: label, tip: tip, isInvalid: renderAsInvalid, helpText: errorMessage || helpText, helpAddon: helpAddon ||
2571
+ (maxLength !== null && maxLength !== undefined && (jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), className: className, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(TextArea, Object.assign({ ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, onChange: handleChange, dataTestId: dataTestId })) })));
2572
+ });
2573
+
2574
+ /**
2575
+ * 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.
2576
+ *
2577
+ * _**Do use** when the user has to input or edit simple text based information, such as metadata._
2578
+ *
2579
+ * _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
2580
+ */
2581
+ const TextField = React__namespace.forwardRef((_a, ref) => {
2582
+ var { label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
2583
+ const [valueLength, setValueLength] = React__namespace.useState(value ? `${value}`.length : 0);
2584
+ const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
2585
+ const handleChange = React__namespace.useCallback((event) => {
2586
+ setValueLength(event.target.value.length);
2587
+ if (onChange) {
2588
+ onChange(event);
2589
+ }
2590
+ }, [onChange]);
2591
+ return (jsxRuntime.jsx(FormGroup, Object.assign({ label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon ||
2592
+ (maxLength !== null && maxLength !== undefined && (jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), dataTestId: dataTestId && `${dataTestId}-FormGroup`, disabled: rest.readOnly }, { children: jsxRuntime.jsx(TextInput, Object.assign({ ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, onChange: handleChange, dataTestId: dataTestId })) })));
2593
+ });
2594
+
2595
+ /**
2596
+ * Timeline - used to contain TimelineElements for building a sequence of timed entries - each rendered on a line
2597
+ * - with an indicator (dot)
2598
+ * - a header (next to the dot)
2599
+ * - and a body.
2600
+ *
2601
+ * @param {TimelineProps} props - The props for the Timeline component
2602
+ * @returns {JSX.Element} Timeline component
2603
+ */
2604
+ const Timeline = ({ className, dataTestId, children }) => {
2605
+ return (jsxRuntime.jsx("ol", Object.assign({ className: `${className !== null && className !== void 0 ? className : ""} ${tailwindStyledComponents.tws `tu-timeline`}`, "data-testid": dataTestId }, { children: children })));
2606
+ };
2607
+ /**
2608
+ * TimelineElement - entry on a timeline - rendered with an icon on the timeline
2609
+ * - a date as the header and the children provided as body.
2610
+ *
2611
+ * @param {TimeLineElementProps} props the props
2612
+ * @returns {JSX.Element} component
2613
+ */
2614
+ const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", dot = jsxRuntime.jsx(Indicator, { className: tailwindStyledComponents.tws `mt-[-1px]`, color: "neutral", icon: jsxRuntime.jsx(Icon, { name: "CalendarIcon", size: "large" }) }), header = defaultHeader(date, showTime), onClick, }) => {
2615
+ var _a;
2616
+ return (jsxRuntime.jsxs("li", Object.assign({ className: `${tailwindStyledComponents.tws `tu-timeline-element`}${(_a = " " + className) !== null && _a !== void 0 ? _a : ""} `, "data-date": `${date}`, "data-testid": dataTestId && `${dataTestId}`, onClick: () => onClick && onClick() }, { children: [jsxRuntime.jsx("div", Object.assign({ className: tailwindStyledComponents.tws `tu-timeline-element__dot` }, { children: dot })), jsxRuntime.jsx("div", { children: header }), jsxRuntime.jsx("div", {}), jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { children: children }) })] })));
2617
+ };
2618
+ function defaultHeader(date, showTime) {
2619
+ return `${dateFns.format(date, showTime ? "MMM d, yyyy H:mm" : "MMM d, yyyy")} (${dateFns.formatDistance(date, new Date(), {
2620
+ addSuffix: true,
2621
+ })})`;
2622
+ }
2623
+
2624
+ /**
2625
+ * Use Toggle when you have to only enable/disable a feature.
2626
+ *
2627
+ * _**Do use** Toggle in forms or settings._
2628
+ *
2629
+ * _**Do not use** Toggle if a user can select many option from a list, use checkboxes instead of toggle._
2630
+ *
2631
+ * @param {ToggleProps} props - The props for the Toggle component
2632
+ * @returns {JSX.Element} Toggle component
2633
+ */
2634
+ const Toggle = React__namespace.forwardRef(({ toggled = false, onChange, disabled, size = "medium", id, tabIndex, required, className, dataTestId, onBlur, name, description = "", }, ref) => {
2635
+ 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 => {
2636
+ e.stopPropagation();
2637
+ onChange(!toggled, e);
2638
+ }, 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 })))] })] }));
2639
+ });
2640
+ Toggle.displayName = "Toggle";
2641
+ const ToggleWrapper = tailwindStyledComponents.tw.div `tu-toggle__wrapper`;
2642
+ const InputContainer = tailwindStyledComponents.tw.label `tu-toggle__input-container `;
2643
+ const HiddenInput = tailwindStyledComponents.tw.input `tu-toggle__input`;
2644
+ const Switch = tailwindStyledComponents.tw.label `
2645
+ ${({ $toggled }) => ($toggled ? tailwindStyledComponents.tws `tu-toggle__switch` : tailwindStyledComponents.tws `tu-toggle`)}`;
2646
+ const SwitchContainer = tailwindStyledComponents.tw.label `
2647
+ tu-toggle__switch-container
2648
+ ${({ $disabled }) => $disabled && tailwindStyledComponents.tws `tu-toggle--disabled`};
2649
+ ${({ $size }) => ($size === "small" ? tailwindStyledComponents.tws `tu-toggle--small` : tailwindStyledComponents.tws `tu-toggle--medium`)};
2650
+ ${({ $toggled }) => $toggled && tailwindStyledComponents.tws `tu-toggle--toggled`}`;
2651
+ const LabelContainer = tailwindStyledComponents.tw.div `tu-toggle__label-container`;
2652
+ const Description = tailwindStyledComponents.tw.label `
2653
+ tu-toggle__description
2654
+ ${({ $disabled }) => $disabled && tailwindStyledComponents.tws `tu-toggle__description--disabled`}
2655
+ `;
2656
+
2657
+ /**
2658
+ * A thin wrapper around the `BaseInput` component for upload input fields.
2659
+ *
2660
+ * NOTE: If shown with a label, please use the `UploadField` component instead.
2661
+ */
2662
+ const UploadInput = React.forwardRef((_a, ref) => {
2663
+ var { disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles } = _a, rest = __rest(_a, ["disabled", "acceptedTypes", "nonInteractive", "uploadLabel", "multipleFiles"]);
2664
+ return (jsxRuntime.jsx(UploadInputContainer, { children: jsxRuntime.jsx(BaseInput, Object.assign({ addonBefore: uploadLabel, ref: ref, disabled: disabled, accept: acceptedTypes, multiple: multipleFiles, type: "file", nonInteractive: nonInteractive,
2665
+ // onClick used to work with nonInteractive option
2666
+ onClick: event => {
2667
+ if (nonInteractive) {
2668
+ event.preventDefault();
2669
+ event.stopPropagation();
2670
+ }
2671
+ } }, rest)) }));
2672
+ });
2673
+ const UploadInputContainer = tailwindStyledComponents.tw.label `
2674
+ tu-upload-input`;
2675
+
2676
+ /**
2677
+ * Upload fields enable the user to upload Files.
2678
+ */
2679
+ const UploadField = React.forwardRef((_a, ref) => {
2680
+ var { label, tip, helpText, errorMessage, isInvalid, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "isInvalid", "className", "value", "dataTestId"]);
2681
+ const renderAsInvalid = isInvalid || Boolean(errorMessage);
2682
+ return (jsxRuntime.jsx(FormGroup, Object.assign({ label: label, tip: tip, isInvalid: renderAsInvalid, helpText: errorMessage || helpText, dataTestId: `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(UploadInput, Object.assign({ ref: ref, isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
2683
+ });
2684
+
2685
+ /**
2686
+ * Helper function to get normalized score in range 0-1 used by the ValueBar
2687
+ *
2688
+ * @param {number} value - value for which score should be returned
2689
+ * @param {number} min - min range value
2690
+ * @param {number} max - max range value
2691
+ * @returns {number} normalized score
2692
+ */
2693
+ const getScore = (value, min, max) => {
2694
+ if (value <= min) {
2695
+ return 0.01; // always render at least some small fragment
2696
+ }
2697
+ if (value >= max) {
2698
+ return 1;
2699
+ }
2700
+ return (value - min) / (max - min);
2701
+ };
2702
+ /**
2703
+ * Helper function to get default color used by the ValueBar
2704
+ *
2705
+ * @param {number} score - score number for which color should be returned
2706
+ * @returns {string} color value
2707
+ */
2708
+ const getDefaultFillColor = (score) => {
2709
+ if (score < 0.3) {
2710
+ return uiDesignTokens.color("DANGER", 500, "CSS");
2711
+ }
2712
+ if (score >= 0.6) {
2713
+ return uiDesignTokens.color("SUCCESS", 600, "CSS");
2714
+ }
2715
+ return uiDesignTokens.color("WARNING", 300, "CSS");
2716
+ };
2717
+ /**
2718
+ * Helper function to get custom color used by the ValueBar
2719
+ *
2720
+ * @param {number} score - score number for which color should be returned
2721
+ * @param {LevelColors} levelColors - custom colors and levels definitions
2722
+ * @returns {string} color value
2723
+ */
2724
+ const getFillColor = (score, levelColors) => {
2725
+ var _a, _b;
2726
+ if (levelColors.low && score < (levelColors.low.level || 0)) {
2727
+ return levelColors.low.color;
2728
+ }
2729
+ if (levelColors.high && score >= (levelColors.high.level || 0)) {
2730
+ return levelColors.high.color;
2731
+ }
2732
+ return (_b = (_a = levelColors.medium) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : uiDesignTokens.color("WARNING", 300);
2733
+ };
2734
+ /**
2735
+ * Helper function to get color used by the ValueBar
2736
+ *
2737
+ * @param {number} value - value for which color should be returned
2738
+ * @param {number} min - min range value
2739
+ * @param {number} max - max range value
2740
+ * @param {LevelColors} levelColors - level colors used to coloring the bar
2741
+ * @returns {JSX.Element} ValueBar component
2742
+ */
2743
+ const getValueBarColorByValue = (value, min, max, levelColors) => {
2744
+ const score = getScore(value, min, max);
2745
+ return getFillColor(score, levelColors);
2746
+ };
2747
+
2748
+ /**
2749
+ * ValueBar component is used to display value on a colorful bar within provided range.
2750
+ *
2751
+ * @param {ValueBarProps} props - The props for the ValueBar component
2752
+ * @returns {JSX.Element} ValueBar component
2753
+ */
2754
+ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, }) => {
2755
+ const score = getScore(value, min, max);
2756
+ const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
2757
+ const barWidth = showValue && size === "small" ? 90 : 100;
2758
+ return (jsxRuntime.jsx(Root, Object.assign({ className: className, "data-testid": dataTestId, "$size": size }, { children: jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx(Background, { width: `${barWidth}%`, rx: "5" }), jsxRuntime.jsx(Bar, { width: `${score * barWidth}%`, fill: barFillColor, rx: "5" }), showValue && size === "large" && (jsxRuntime.jsxs(Text, Object.assign({ "$size": size, x: "12", y: "23", fill: valueColor !== null && valueColor !== void 0 ? valueColor : "white" }, { children: [Number(value.toFixed(1)), unit || ""] }))), showValue && size === "small" && (jsxRuntime.jsxs(Text, Object.assign({ "$size": size, x: `${barWidth + 2}%`, y: "11", fill: valueColor !== null && valueColor !== void 0 ? valueColor : uiDesignTokens.color("NEUTRAL", 400, "CSS") }, { children: [Number(value.toFixed(1)), unit || ""] })))] }) })));
2759
+ };
2760
+ const Root = tailwindStyledComponents.tw.svg `
2761
+ tu-value-bar
2762
+ ${({ $size }) => ($size === "small" ? tailwindStyledComponents.tws `tu-value-bar--small` : tailwindStyledComponents.tws `tu-value-bar--large`)}
2763
+ `;
2764
+ const Text = tailwindStyledComponents.tw.text `
2765
+ tu-value-bar__text
2766
+ ${({ $size }) => ($size === "small" ? tailwindStyledComponents.tws `tu-value-bar__text--small` : tailwindStyledComponents.tws `tu-value-bar__text--large`)}
2767
+ `;
2768
+ const Background = tailwindStyledComponents.tw.rect `
2769
+ tu-value-bar__background
2770
+ `;
2771
+ const Bar = tailwindStyledComponents.tw.rect `
2772
+ tu-value-bar__bar
2773
+ `;
2774
+
2775
+ /**
2776
+ * The useDebounce hook works like useState, but adds a delay where previous values will be ignored.
2777
+ *
2778
+ * @param {any} value The value to set
2779
+ * @param {number} delay The debounce time
2780
+ * @returns {any} value The latest values received
2781
+ */
2782
+ const useDebounce = (value, delay = 500) => {
2783
+ const [debouncedValue, setDebouncedValue] = React.useState(value);
2784
+ React.useEffect(() => {
2785
+ const handler = setTimeout(() => {
2786
+ setDebouncedValue(value);
2787
+ }, delay);
2788
+ return () => {
2789
+ clearTimeout(handler);
2790
+ };
2791
+ }, [value, delay]);
2792
+ return debouncedValue;
2793
+ };
2794
+
2795
+ // Copied from https://github.com/rexxars/use-device-pixel-ratio
2796
+ /**
2797
+ * Get the device pixel ratio, potentially rounded and capped.
2798
+ * Will emit new values if it changes.
2799
+ *
2800
+ * @param {DevicePixelRatioOptions} options the options object
2801
+ * @returns { number } The current device pixel ratio, or the default if none can be resolved
2802
+ */
2803
+ function useDevicePixelRatio(options) {
2804
+ const dpr = getDevicePixelRatio(options);
2805
+ const [currentDpr, setCurrentDpr] = React.useState(dpr);
2806
+ const { defaultDpr, maxDpr, round } = options || {};
2807
+ React.useEffect(() => {
2808
+ const canListen = typeof window !== "undefined" && "matchMedia" in window;
2809
+ if (!canListen) {
2810
+ return;
2811
+ }
2812
+ const updateDpr = () => setCurrentDpr(getDevicePixelRatio({ defaultDpr, maxDpr, round }));
2813
+ const mediaMatcher = window.matchMedia(`screen and (resolution: ${currentDpr}dppx)`);
2814
+ // Safari 13.1 does not have `addEventListener`, but does have `addListener`
2815
+ if (mediaMatcher.addEventListener) {
2816
+ mediaMatcher.addEventListener("change", updateDpr);
2817
+ }
2818
+ else {
2819
+ mediaMatcher.addListener(updateDpr);
2820
+ }
2821
+ return () => {
2822
+ if (mediaMatcher.removeEventListener) {
2823
+ mediaMatcher.removeEventListener("change", updateDpr);
2824
+ }
2825
+ else {
2826
+ mediaMatcher.removeListener(updateDpr);
2827
+ }
2828
+ };
2829
+ }, [currentDpr, defaultDpr, maxDpr, round]);
2830
+ return currentDpr;
2831
+ }
2832
+ /**
2833
+ * Returns the current device pixel ratio (DPR) given the passed options
2834
+ *
2835
+ * @param { DevicePixelRatioOptions } options the options object
2836
+ * @returns { number } current device pixel ratio
2837
+ */
2838
+ function getDevicePixelRatio(options) {
2839
+ const { defaultDpr = 1, maxDpr = 3, round = true } = options || {};
2840
+ const hasDprProp = typeof window !== "undefined" && typeof window.devicePixelRatio === "number";
2841
+ const dpr = hasDprProp ? window.devicePixelRatio : defaultDpr;
2842
+ const rounded = Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
2843
+ return rounded;
2844
+ }
2845
+
2846
+ /**
2847
+ * The useLocalStorage hook works like useState, but saves to localstorage.
2848
+ *
2849
+ * @param {string} key - The key the values is saved under.
2850
+ * @param {string | null | undefined} initialValue - The initial value for the state/local storage item
2851
+ * @returns {string | null | undefined} value
2852
+ */
2853
+ const useLocalStorage = (key, initialValue) => {
2854
+ if (!key) {
2855
+ throw new Error("useLocalStorage key may not be falsy");
2856
+ }
2857
+ const setLocalStorageItem = React.useCallback((value) => window.localStorage.setItem(key, typeof value === "object" ? JSON.stringify(value) : `${value}`), [key]);
2858
+ const removeLocalStorageItem = React.useCallback(() => window.localStorage.removeItem(key), [key]);
2859
+ const [item, setValue] = React.useState(() => {
2860
+ const value = window.localStorage.getItem(key);
2861
+ if (value !== undefined && value !== null) {
2862
+ const parsedValue = tryParse(value);
2863
+ return parsedValue;
2864
+ }
2865
+ return initialValue !== null && initialValue !== void 0 ? initialValue : null;
2866
+ });
2867
+ React.useEffect(() => {
2868
+ if (item !== undefined && item !== null) {
2869
+ setLocalStorageItem(item);
2870
+ }
2871
+ else {
2872
+ removeLocalStorageItem();
2873
+ }
2874
+ }, [item, setLocalStorageItem, removeLocalStorageItem, key]);
2875
+ /*
2876
+ // Sync local storage between tabs / windows
2877
+ useEffect(() => {
2878
+ const handleStorageChange = (e: StorageEvent) => {
2879
+ if (e.key === key) {
2880
+ setValue(tryParse(e.newValue));
2881
+ }
2882
+ };
2883
+
2884
+ window.addEventListener("storage", handleStorageChange);
2885
+
2886
+ return () => {
2887
+ window.removeEventListener("storage", handleStorageChange);
2888
+ };
2889
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2890
+ }, []);
2891
+ */
2892
+ const removeItem = () => {
2893
+ setValue(null);
2894
+ };
2895
+ return [item, setValue, removeItem];
2896
+ };
2897
+ function tryParse(value) {
2898
+ try {
2899
+ return JSON.parse(value);
2900
+ }
2901
+ catch (_a) {
2902
+ return value;
2903
+ }
2904
+ }
2905
+
2906
+ /**
2907
+ * @param {UseTimeoutProps} props The props
2908
+ * @returns {{ startTimeout: () => void; stopTimeout: () => void; isReady: boolean | null}} return
2909
+ */
2910
+ const useTimeout = ({ onTimeout, duration }) => {
2911
+ const ready = React.useRef(false);
2912
+ const timeout = React.useRef();
2913
+ const callback = React.useRef(onTimeout);
2914
+ const isReady = React.useCallback(() => ready.current, []);
2915
+ const startTimeout = React.useCallback(() => {
2916
+ ready.current = false;
2917
+ timeout.current && clearTimeout(timeout.current);
2918
+ timeout.current = setTimeout(() => {
2919
+ ready.current = true;
2920
+ callback.current();
2921
+ }, duration);
2922
+ }, [duration]);
2923
+ const stopTimeout = React.useCallback(() => {
2924
+ ready.current = null;
2925
+ timeout.current && clearTimeout(timeout.current);
2926
+ }, []);
2927
+ // update ref when function changes
2928
+ React.useEffect(() => {
2929
+ callback.current = onTimeout;
2930
+ }, [onTimeout]);
2931
+ // startTimeout on mount, stopTimeout on unmount
2932
+ React.useEffect(() => {
2933
+ startTimeout();
2934
+ return stopTimeout;
2935
+ }, [duration, startTimeout, stopTimeout]);
2936
+ return [isReady, stopTimeout, startTimeout];
2937
+ };
2938
+
2939
+ /**
2940
+ * The MinTopFullContentLayout component.
2941
+ *
2942
+ * @param {MinTopFullContentLayoutProps} props - The props for the MinTopFullContentLayout component
2943
+ * @returns {JSX.Element} MinTopFullContentLayout component
2944
+ */
2945
+ const MinTopFullContentLayout = ({ children, className, dataTestId }) => (jsxRuntime.jsx(Layout$5, Object.assign({ className: className, "data-testid": dataTestId }, { children: children })));
2946
+ const Layout$5 = tailwindStyledComponents.tw.span `
2947
+ grid
2948
+ h-full
2949
+ grid-rows-min-fr
2950
+ `;
2951
+
2952
+ /**
2953
+ * Responsive layout component setting up three grid areas
2954
+ * one for filtering, (result-)list and (result-map)
2955
+ *
2956
+ * List needs to handle its own min size - and map takes up the rest.
2957
+ *
2958
+ * Will be inlined to
2959
+ * - filter
2960
+ * - list
2961
+ * - map
2962
+ * on screens < mediaQuery.xxl
2963
+ *
2964
+ *
2965
+ * @param {FilterListMapLayoutProps} props - The props for the FilterListMapLayout component
2966
+ * @returns {JSX.Element} FilterListMapLayout component
2967
+ */
2968
+ const FilterListMapLayout = ({ children }) => jsxRuntime.jsx(Layout$4, { children: children });
2969
+ const Layout$4 = tailwindStyledComponents.tw.span `
2970
+ tu-layout-FilterListMap
2971
+ `;
2972
+
2973
+ /**
2974
+ * Layout component with repeating full width areas, default one height fraction each but option to use content height instead
2975
+ * Row min height can optionally be set here or managed by children
2976
+ * Scrolling happens if/when children's a min-height is reached
2977
+ *
2978
+ * @param {FullWidthRepeatingLayoutProps} props - The props for the FullWidthRepeatingLayout component
2979
+ * @returns {JSX.Element} FullWidthRepeatingLayout component
2980
+ */
2981
+ const FullWidthRepeatingLayout = ({ children, rowSizing = "Unmanaged", rowMinHeight, dataTestId, className, }) => (jsxRuntime.jsx(Layout$3, Object.assign({ "data-testid": dataTestId, className: className, "$rowSizing": rowSizing, "$rowMinHeight": rowMinHeight !== null && rowMinHeight !== void 0 ? rowMinHeight : 0 }, { children: children })));
2982
+ const Layout$3 = tailwindStyledComponents.tw.span `
2983
+ tu-layout-FullWidthRepeatingLayout
2984
+
2985
+ ${({ $rowSizing }) => {
2986
+ switch ($rowSizing) {
2987
+ case "MinContent":
2988
+ return tailwindStyledComponents.tws ` tu-layout-FullWidthRepeatingLayout--MinContent`;
2989
+ case "Equal":
2990
+ return tailwindStyledComponents.tws ` tu-layout-FullWidthRepeatingLayout--Equal`;
2991
+ case "Unmanaged":
2992
+ default:
2993
+ return null;
2994
+ }
2995
+ }}
2996
+ `;
2997
+
2998
+ /**
2999
+ * Simply applies a Grid Area to the element
3000
+ *
3001
+ * @param {GridAreaProps} props - The props for the GridArea component
3002
+ * @returns {JSX.Element} GridArea component
3003
+ */
3004
+ const GridArea = ({ area, dataTestId, className, children }) => (jsxRuntime.jsx("section", Object.assign({ className: className, "data-testid": dataTestId, style: { gridArea: area } }, { children: children })));
3005
+
3006
+ /**
3007
+ * A grid container that has a flexible number of columns.
3008
+ * Adds more columns if constraints allow it, otherwise wraps to next row
3009
+ *
3010
+ * @param {IntrinsicallyResponsiveGridProps} props - The props for the IntrinsicallyResponsiveGrid component
3011
+ * @returns {JSX.Element} IntrinsicallyResponsiveGrid component
3012
+ */
3013
+ const IntrinsicallyResponsiveGrid = ({ children, occupation = "auto-fill", minColumnWidth = "md", rowHeight = "1fr", gap = "auto", dataTestId, className, }) => (jsxRuntime.jsx(Layout$2, Object.assign({ "$minColumnWidth": minColumnWidth, "data-testid": dataTestId, "$gap": gap, "$rowHeight": rowHeight, "$occupation": occupation, className: className }, { children: children })));
3014
+ const Layout$2 = tailwindStyledComponents.tw.span `
3015
+ tu-layout-IntrinsicallyResponsiveGrid
3016
+ ${({ $occupation }) => {
3017
+ switch ($occupation) {
3018
+ case "auto-fit":
3019
+ return tailwindStyledComponents.tws `tu-layout-IntrinsicallyResponsiveGrid--fit`;
3020
+ case "auto-fill":
3021
+ default:
3022
+ return tailwindStyledComponents.tws `tu-layout-IntrinsicallyResponsiveGrid--fill`;
3023
+ }
3024
+ }}
3025
+
3026
+ ${({ $minColumnWidth }) => {
3027
+ switch ($minColumnWidth) {
3028
+ case "xs":
3029
+ return tailwindStyledComponents.tws `tu-layout-IntrinsicallyResponsiveGrid--xs`;
3030
+ case "sm":
3031
+ return tailwindStyledComponents.tws `tu-layout-IntrinsicallyResponsiveGrid--sm`;
3032
+ case "lg":
3033
+ return tailwindStyledComponents.tws `tu-layout-IntrinsicallyResponsiveGrid--lg`;
3034
+ case "xl":
3035
+ return tailwindStyledComponents.tws `tu-layout-IntrinsicallyResponsiveGrid--xl`;
3036
+ case "md":
3037
+ default:
3038
+ return tailwindStyledComponents.tws `tu-layout-IntrinsicallyResponsiveGrid--md`;
3039
+ }
3040
+ }}
3041
+
3042
+ ${({ $gap }) => {
3043
+ switch ($gap) {
3044
+ case "tiny":
3045
+ return tailwindStyledComponents.tws `gap-1`;
3046
+ case "mini":
3047
+ return tailwindStyledComponents.tws `gap-2`;
3048
+ case "small":
3049
+ return tailwindStyledComponents.tws `gap-3`;
3050
+ case "medium":
3051
+ return tailwindStyledComponents.tws `gap-4`;
3052
+ case "large":
3053
+ return tailwindStyledComponents.tws `gap-6`;
3054
+ case "giant":
3055
+ return tailwindStyledComponents.tws `gap-8`;
3056
+ case "enormous":
3057
+ return tailwindStyledComponents.tws `gap-10`;
3058
+ case "none":
3059
+ return tailwindStyledComponents.tws `gap-0`;
3060
+ case "inherit":
3061
+ return tailwindStyledComponents.tws `gap-[inherit]`;
3062
+ case "auto":
3063
+ default:
3064
+ return tailwindStyledComponents.tws `tu-gap-responsive`;
3065
+ }
3066
+ }};
3067
+
3068
+ ${({ $rowHeight }) => {
3069
+ switch ($rowHeight) {
3070
+ case "auto":
3071
+ return tailwindStyledComponents.tws `tu-layout-IntrinsicallyResponsiveGrid--row-auto`;
3072
+ case "1fr":
3073
+ default:
3074
+ return tailwindStyledComponents.tws `tu-layout-IntrinsicallyResponsiveGrid--row-1fr`;
3075
+ }
3076
+ }};
3077
+ `;
3078
+
3079
+ /**
3080
+ * The TitleNavContentLayout.
3081
+ * Use the `TitleGridArea`, `NavGridArea` and `ContentGridArea` components to define the layout elements.
3082
+ *
3083
+ * @param {TitleNavContentLayoutProps} props - The props for the TitleNavContentLayout component
3084
+ * @returns {JSX.Element} TitleNavContentLayout component
3085
+ */
3086
+ const TitleNavContentLayout = ({ children, className }) => (jsxRuntime.jsx(Layout$1, Object.assign({ className: className }, { children: children })));
3087
+ const Layout$1 = tailwindStyledComponents.tw.div `
3088
+ tu-layout-TitleNavContentLayout
3089
+ lg:tu-layout-TitleNavContentLayout-lg
3090
+ `;
3091
+ /**
3092
+ * A component to define the title area of the TitleNavContentLayout.
3093
+ */
3094
+ const TitleGridArea = tailwindStyledComponents.tw.header `
3095
+ tu-layout-area-title
3096
+ `;
3097
+ /**
3098
+ * A component to define the navigation area of the TitleNavContentLayout.
3099
+ * Adds the needed left padding on large screens.
3100
+ */
3101
+ const NavGridArea = tailwindStyledComponents.tw.aside `
3102
+ tu-layout-area-nav
3103
+ `;
3104
+ /**
3105
+ * A component to define the content area of the TitleNavContentLayout.
3106
+ * Adds the needed right padding on large screens.
3107
+ */
3108
+ const ContentGridArea = tailwindStyledComponents.tw.article `
3109
+ tu-layout-area-content
3110
+ `;
3111
+
3112
+ /**
3113
+ * TwoColumnLayout.
3114
+ *
3115
+ * @param {TwoColumnLayoutProps} props - The props for the TwoColumnLayout component
3116
+ * @returns {JSX.Element} TwoColumnLayout component
3117
+ */
3118
+ const TwoColumnLayout = ({ children }) => jsxRuntime.jsx(Layout, { children: children });
3119
+ const Layout = tailwindStyledComponents.tw.div `
3120
+ tu-layout-TwoColumnLayout
3121
+ `;
3122
+
3123
+ Object.defineProperty(exports, 'ValueType', {
3124
+ enumerable: true,
3125
+ get: function () { return ReactSelect__default["default"]; }
3126
+ });
3127
+ exports.ActionButton = ActionButton;
3128
+ exports.Alert = Alert;
3129
+ exports.Badge = Badge;
3130
+ exports.BaseInput = BaseInput;
3131
+ exports.Button = Button;
3132
+ exports.Card = Card;
3133
+ exports.CardBody = CardBody;
3134
+ exports.CardFooter = CardFooter;
3135
+ exports.CardHeader = CardHeader;
3136
+ exports.Checkbox = Checkbox;
3137
+ exports.Collapse = Collapse;
3138
+ exports.ContentGridArea = ContentGridArea;
3139
+ exports.CopyableText = CopyableText;
3140
+ exports.CreatableSelect = CreatableSelect;
3141
+ exports.DateField = DateField;
3142
+ exports.DateInput = DateInput;
3143
+ exports.DayPicker = DayPicker;
3144
+ exports.DayPickerPopover = DayPickerPopover;
3145
+ exports.DayRangePicker = DayRangePicker;
3146
+ exports.DensityContainer = DensityContainer;
3147
+ exports.Drawer = Drawer;
3148
+ exports.DropZone = DropZone;
3149
+ exports.EmailField = EmailField;
3150
+ exports.EmailInput = EmailInput;
3151
+ exports.ExternalLink = ExternalLink;
3152
+ exports.FilterListMapLayout = FilterListMapLayout;
3153
+ exports.FormGroup = FormGroup;
3154
+ exports.FullWidthRepeatingLayout = FullWidthRepeatingLayout;
3155
+ exports.GridArea = GridArea;
3156
+ exports.Heading = Heading$1;
3157
+ exports.Icon = Icon;
3158
+ exports.IconButton = IconButton;
3159
+ exports.Indicator = Indicator;
3160
+ exports.IntrinsicallyResponsiveGrid = IntrinsicallyResponsiveGrid;
3161
+ exports.Label = Label$2;
3162
+ exports.MenuItem = MenuItem;
3163
+ exports.MenuList = MenuList;
3164
+ exports.MinTopFullContentLayout = MinTopFullContentLayout;
3165
+ exports.Modal = Modal;
3166
+ exports.ModalBackdrop = ModalBackdrop;
3167
+ exports.MoreMenu = MoreMenu;
3168
+ exports.MultiSelectMenuItem = MultiSelectMenuItem;
3169
+ exports.NavGridArea = NavGridArea;
3170
+ exports.NumberField = NumberField;
3171
+ exports.NumberInput = NumberInput;
3172
+ exports.PageHeader = PageHeader;
3173
+ exports.Pagination = Pagination;
3174
+ exports.PhoneInput = PhoneInput;
3175
+ exports.Popover = Popover;
3176
+ exports.PopoverList = PopoverList;
3177
+ exports.PopoverListItem = PopoverListItem;
3178
+ exports.PopoverTitle = PopoverTitle;
3179
+ exports.Prompt = Prompt;
3180
+ exports.ROLE_CARD = ROLE_CARD;
3181
+ exports.RadioGroup = RadioGroup;
3182
+ exports.RadioItem = RadioItem;
3183
+ exports.Search = Search;
3184
+ exports.SectionHeader = SectionHeader;
3185
+ exports.Select = Select;
3186
+ exports.SelectPrefix = SelectPrefix;
3187
+ exports.Sidebar = Sidebar;
3188
+ exports.SingleSelectMenuItem = SingleSelectMenuItem;
3189
+ exports.SkeletonLines = SkeletonLines;
3190
+ exports.Spacer = Spacer;
3191
+ exports.Spinner = Spinner;
3192
+ exports.StarButton = StarButton;
3193
+ exports.Tag = Tag;
3194
+ exports.Text = Text$1;
3195
+ exports.TextArea = TextArea;
3196
+ exports.TextAreaField = TextAreaField;
3197
+ exports.TextField = TextField;
3198
+ exports.TextInput = TextInput;
3199
+ exports.Timeline = Timeline;
3200
+ exports.TimelineElement = TimelineElement;
3201
+ exports.Tip = Tip;
3202
+ exports.TitleGridArea = TitleGridArea;
3203
+ exports.TitleNavContentLayout = TitleNavContentLayout;
3204
+ exports.Toggle = Toggle;
3205
+ exports.Tooltip = Tooltip;
3206
+ exports.TwoColumnLayout = TwoColumnLayout;
3207
+ exports.UploadField = UploadField;
3208
+ exports.UploadInput = UploadInput;
3209
+ exports.ValueBar = ValueBar;
3210
+ exports.docs = docs;
3211
+ exports.getDevicePixelRatio = getDevicePixelRatio;
3212
+ exports.getOrderedOptions = getOrderedOptions;
3213
+ exports.getValueBarColorByValue = getValueBarColorByValue;
3214
+ exports.isMultiValue = isMultiValue;
3215
+ exports.useContainerProps = useContainerProps;
3216
+ exports.useCustomComponents = useCustomComponents;
3217
+ exports.useDebounce = useDebounce;
3218
+ exports.useDevicePixelRatio = useDevicePixelRatio;
3219
+ exports.useLocalStorage = useLocalStorage;
3220
+ exports.useModal = useModal;
3221
+ exports.usePrompt = usePrompt;
3222
+ exports.useTimeout = useTimeout;