@trackunit/react-components 0.1.113 → 0.1.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +757 -503
- package/index.js +748 -502
- package/package.json +4 -5
- package/src/components/Alert/Alert.d.ts +1 -1
- package/src/components/Badge/Badge.d.ts +1 -6
- package/src/components/Badge/Badge.variants.d.ts +3 -0
- package/src/components/Drawer/Drawer.variants.d.ts +4 -0
- package/src/components/Heading/Heading.variants.d.ts +5 -0
- package/src/components/Icon/Icon.d.ts +4 -3
- package/src/components/Icon/Icon.variants.d.ts +8 -0
- package/src/components/Indicator/Indicator.d.ts +1 -1
- package/src/components/Indicator/Indicator.variants.d.ts +10 -0
- package/src/components/PageHeader/PageHeader.variants.d.ts +5 -0
- package/src/components/Pagination/Pagination.variants.d.ts +2 -0
- package/src/components/Popover/Popover.variants.d.ts +5 -0
- package/src/components/Sidebar/Sidebar.variants.d.ts +4 -0
- package/src/components/SkeletonLines/SkeletonLines.variants.d.ts +1 -0
- package/src/components/Spacer/Spacer.d.ts +3 -3
- package/src/components/Spacer/Spacer.variants.d.ts +4 -0
- package/src/components/Spinner/Spinner.variants.d.ts +7 -0
- package/src/components/Tag/Tag.d.ts +3 -2
- package/src/components/Tag/Tag.variants.d.ts +7 -0
- package/src/components/Timeline/Timeline.variants.d.ts +3 -0
- package/src/components/Tip/Tip.d.ts +3 -7
- package/src/components/Tip/Tip.variants.d.ts +4 -0
- package/src/components/Tooltip/Tooltip.variants.d.ts +6 -0
- package/src/components/ValueBar/ValueBar.variants.d.ts +9 -0
- package/src/components/buttons/BackToTopButton/BackToTopButton.d.ts +1 -1
- package/src/components/buttons/BackToTopButton/BackToTopButton.variants.d.ts +3 -0
- package/src/components/buttons/Button/Button.d.ts +1 -10
- package/src/components/buttons/IconButton/IconButton.d.ts +0 -5
- package/src/components/buttons/shared/Button.variants.d.ts +13 -0
- package/src/components/buttons/shared/ButtonProps.d.ts +5 -1
- package/src/index.d.ts +2 -0
- package/index.css +0 -194
- package/src/components/buttons/shared/helpers.d.ts +0 -20
package/index.cjs
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var tailwindStyledComponents = require('@trackunit/tailwind-styled-components');
|
|
8
|
-
var uiIcons = require('@trackunit/ui-icons');
|
|
9
8
|
var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
|
|
9
|
+
var uiIcons = require('@trackunit/ui-icons');
|
|
10
10
|
var reactUse = require('react-use');
|
|
11
11
|
var reactDayPicker = require('react-day-picker');
|
|
12
12
|
var locale = require('date-fns/locale');
|
|
@@ -95,6 +95,45 @@ function __rest(s, e) {
|
|
|
95
95
|
return t;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
const cvaSpinner = cssClassVarianceUtilities.cvaMerge([
|
|
99
|
+
"bg-transparent",
|
|
100
|
+
"rounded-full",
|
|
101
|
+
"border-2",
|
|
102
|
+
"border-solid",
|
|
103
|
+
"inline-block",
|
|
104
|
+
"animate-spin",
|
|
105
|
+
"cursor-wait",
|
|
106
|
+
"text-current",
|
|
107
|
+
], {
|
|
108
|
+
variants: {
|
|
109
|
+
size: {
|
|
110
|
+
small: ["w-4", "h-4"],
|
|
111
|
+
medium: ["w-6", "h-6"],
|
|
112
|
+
large: ["w-8", "h-8"],
|
|
113
|
+
},
|
|
114
|
+
mode: {
|
|
115
|
+
dark: ["border-white/[0.32]", "border-b-white/75"],
|
|
116
|
+
light: ["border-slate-900/25", "border-b-slate-900/50"],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
defaultVariants: {
|
|
120
|
+
size: "medium",
|
|
121
|
+
mode: "light",
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
const cvaSpinnerContainer = cssClassVarianceUtilities.cvaMerge(["box-border", "p-0.5", "overflow-hidden"], {
|
|
125
|
+
variants: {
|
|
126
|
+
centering: {
|
|
127
|
+
centered: ["grid", "h-full", "w-full", "place-items-center"],
|
|
128
|
+
vertically: ["grid", "h-full", "items-center"],
|
|
129
|
+
horizontally: ["grid", "w-full", "justify-items-center"],
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
defaultVariants: {
|
|
133
|
+
centering: "centered",
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
|
|
98
137
|
/**
|
|
99
138
|
* The spinner component provides visual feedback that data is being processed.
|
|
100
139
|
*
|
|
@@ -110,81 +149,195 @@ function __rest(s, e) {
|
|
|
110
149
|
* @returns {JSX.Element} Spinner component
|
|
111
150
|
*/
|
|
112
151
|
const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId, }) => {
|
|
113
|
-
return (jsxRuntime.jsx(
|
|
114
|
-
};
|
|
115
|
-
const getSpinnerStyles = () => ({ $size }) => {
|
|
116
|
-
switch ($size) {
|
|
117
|
-
case "small":
|
|
118
|
-
return tailwindStyledComponents.tws `tu-spinner--small`;
|
|
119
|
-
case "large":
|
|
120
|
-
return tailwindStyledComponents.tws `tu-spinner--large`;
|
|
121
|
-
case "medium":
|
|
122
|
-
default:
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
const getCenteringStyles = () => ({ $centering }) => {
|
|
127
|
-
switch ($centering) {
|
|
128
|
-
case "centered":
|
|
129
|
-
return tailwindStyledComponents.tws `tu-spinner--container-centered`;
|
|
130
|
-
case "horizontally":
|
|
131
|
-
return tailwindStyledComponents.tws `tu-spinner--container-centered-horizontally`;
|
|
132
|
-
case "vertically":
|
|
133
|
-
return tailwindStyledComponents.tws `tu-spinner--container-centered-vertically`;
|
|
134
|
-
default:
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
const StyledSpinner$1 = tailwindStyledComponents.tw.span `
|
|
139
|
-
tu-spinner
|
|
140
|
-
${p => (p.$mode === "dark" ? tailwindStyledComponents.tws `tu-spinner--dark` : null)}
|
|
141
|
-
${getSpinnerStyles()}
|
|
142
|
-
`;
|
|
143
|
-
const Container$4 = tailwindStyledComponents.tw.div `
|
|
144
|
-
tu-spinner--container
|
|
145
|
-
${getCenteringStyles()}
|
|
146
|
-
|
|
147
|
-
`;
|
|
152
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: cvaSpinnerContainer({ centering, className: containerClassName }) }, { children: jsxRuntime.jsx("div", { role: "spinbutton", className: cvaSpinner({ size, mode, className }), "data-testid": dataTestId }) })));
|
|
153
|
+
};
|
|
148
154
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
const cvaButton = cssClassVarianceUtilities.cvaMerge([
|
|
156
|
+
"flex-row",
|
|
157
|
+
"inline-flex",
|
|
158
|
+
"gap-2",
|
|
159
|
+
"box-border",
|
|
160
|
+
"justify-center",
|
|
161
|
+
"items-center",
|
|
162
|
+
"whitespace-nowrap",
|
|
163
|
+
"max-w-full",
|
|
164
|
+
"outline-0",
|
|
165
|
+
"outline-current",
|
|
166
|
+
"transition-all",
|
|
167
|
+
"ease-in-out",
|
|
168
|
+
"component-button-border",
|
|
169
|
+
"cursor-pointer",
|
|
170
|
+
"flex-none",
|
|
171
|
+
"py-1.5",
|
|
172
|
+
"component-button-padding",
|
|
173
|
+
"component-button-height",
|
|
174
|
+
"focus:ring",
|
|
175
|
+
"focus:ring-offset-1",
|
|
176
|
+
"focus:outline-none",
|
|
177
|
+
"disabled:cursor-not-allowed",
|
|
178
|
+
"text-sm",
|
|
179
|
+
"font-medium",
|
|
180
|
+
"align-middle",
|
|
181
|
+
], {
|
|
182
|
+
variants: {
|
|
183
|
+
color: {
|
|
184
|
+
primary: [
|
|
185
|
+
"bg-primary-600",
|
|
186
|
+
"text-white",
|
|
187
|
+
"hover:bg-primary-800",
|
|
188
|
+
"active:bg-primary-700",
|
|
189
|
+
"focus:ring-primary-300",
|
|
190
|
+
"disabled:hover:bg-slate-400",
|
|
191
|
+
"disabled:bg-slate-400",
|
|
192
|
+
"disabled:text-slate-200",
|
|
193
|
+
],
|
|
194
|
+
secondary: [
|
|
195
|
+
"component-button-secondary-color",
|
|
196
|
+
"hover:bg-secondary-400",
|
|
197
|
+
"hover:text-secondary-800",
|
|
198
|
+
"active:text-secondary-700",
|
|
199
|
+
"active:bg-secondary-300",
|
|
200
|
+
"focus:ring-secondary-300",
|
|
201
|
+
"disabled:bg-secondary-200",
|
|
202
|
+
"disabled:hover:bg-secondary-200",
|
|
203
|
+
"disabled:text-secondary-400",
|
|
204
|
+
],
|
|
205
|
+
danger: [
|
|
206
|
+
"bg-danger-600",
|
|
207
|
+
"text-white",
|
|
208
|
+
"hover:bg-danger-800",
|
|
209
|
+
"active:bg-danger-700",
|
|
210
|
+
"focus:ring-danger-300",
|
|
211
|
+
"disabled:bg-slate-200",
|
|
212
|
+
"disabled:hover:bg-slate-200",
|
|
213
|
+
"disabled:text-slate-400",
|
|
214
|
+
],
|
|
215
|
+
warning: [
|
|
216
|
+
"bg-warning-50",
|
|
217
|
+
"text-warning-600",
|
|
218
|
+
"hover:bg-warning-200",
|
|
219
|
+
"hover:text-warning-800",
|
|
220
|
+
"active:text-warning-700",
|
|
221
|
+
"active:bg-warning-100",
|
|
222
|
+
"focus:ring-warning-300",
|
|
223
|
+
"disabled:bg-warning-50",
|
|
224
|
+
"disabled:hover:bg-warning-50",
|
|
225
|
+
"disabled:text-slate-400",
|
|
226
|
+
],
|
|
227
|
+
tertiary: [
|
|
228
|
+
"bg-white",
|
|
229
|
+
"border",
|
|
230
|
+
"text-slate-600",
|
|
231
|
+
"active:bg-slate-100",
|
|
232
|
+
"active:text-slate-700",
|
|
233
|
+
"focus:ring-slate-300",
|
|
234
|
+
"hover:bg-slate-200",
|
|
235
|
+
"hover:text-slate-800",
|
|
236
|
+
"border-slate-300",
|
|
237
|
+
"disabled:bg-slate-200",
|
|
238
|
+
"disabled:hover:bg-slate-200",
|
|
239
|
+
"disabled:text-slate-400",
|
|
240
|
+
],
|
|
162
241
|
},
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
tertiary: tailwindStyledComponents.tws `tu-button--transparent-tertiary`,
|
|
168
|
-
warning: tailwindStyledComponents.tws `tu-button--transparent-warning`,
|
|
242
|
+
size: {
|
|
243
|
+
small: ["py-1", "px-2"],
|
|
244
|
+
medium: "",
|
|
245
|
+
large: ["py-2", "px-4"],
|
|
169
246
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
247
|
+
rounded: {
|
|
248
|
+
true: ["rounded-full"],
|
|
249
|
+
false: [],
|
|
250
|
+
},
|
|
251
|
+
fullWidth: {
|
|
252
|
+
true: ["w-full", "flex-auto"],
|
|
253
|
+
false: [],
|
|
254
|
+
},
|
|
255
|
+
square: {
|
|
256
|
+
true: "aspect-square",
|
|
257
|
+
false: "",
|
|
258
|
+
},
|
|
259
|
+
disabled: {
|
|
260
|
+
true: ["cursor-not-allowed", "pointer-events-none", "bg-slate-200", "hover:bg-slate-200", "text-slate-400"],
|
|
261
|
+
false: [],
|
|
262
|
+
},
|
|
263
|
+
variant: {
|
|
264
|
+
transparent: "bg-transparent disabled:hover:bg-transparent border-none",
|
|
265
|
+
filled: "",
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
compoundVariants: [
|
|
269
|
+
{
|
|
270
|
+
color: "primary",
|
|
271
|
+
variant: "transparent",
|
|
272
|
+
className: [
|
|
273
|
+
"text-primary-600",
|
|
274
|
+
"hover:text-primary-700",
|
|
275
|
+
"active:bg-primary-700",
|
|
276
|
+
"focus:ring-primary-300",
|
|
277
|
+
"hover:bg-primary-500/10",
|
|
278
|
+
],
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
color: "secondary",
|
|
282
|
+
variant: "transparent",
|
|
283
|
+
className: [
|
|
284
|
+
"text-secondary-600",
|
|
285
|
+
"hover:text-secondary-800",
|
|
286
|
+
"active:text-secondary-700",
|
|
287
|
+
"active:bg-black/10",
|
|
288
|
+
"focus:ring-secondary-300",
|
|
289
|
+
"hover:bg-black/5",
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
color: "warning",
|
|
294
|
+
variant: "transparent",
|
|
295
|
+
className: [
|
|
296
|
+
"text-warning-600",
|
|
297
|
+
"active:bg-warning-500/20",
|
|
298
|
+
"focus:ring-warning-300",
|
|
299
|
+
"hover:bg-warning-500/10",
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
color: "danger",
|
|
304
|
+
variant: "transparent",
|
|
305
|
+
className: ["text-danger-600", "active:bg-danger-600/10", "focus:ring-danger-300", "hover:bg-danger-600/10"],
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
color: "tertiary",
|
|
309
|
+
variant: "transparent",
|
|
310
|
+
className: ["text-slate-600", "active:bg-slate-200/20", "focus:ring-slate-300", "hover:bg-slate-600/10"],
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
disabled: true,
|
|
314
|
+
variant: "transparent",
|
|
315
|
+
className: ["cursor-not-allowed", "pointer-events-none", "hover:bg-transparent"],
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
defaultVariants: {
|
|
319
|
+
color: "primary",
|
|
320
|
+
size: "medium",
|
|
321
|
+
rounded: false,
|
|
322
|
+
fullWidth: false,
|
|
323
|
+
square: false,
|
|
324
|
+
disabled: false,
|
|
325
|
+
variant: "filled",
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
const cvaButtonSpinner = cssClassVarianceUtilities.cvaMerge(["!w-[1em]", "!h-[1em]"]);
|
|
329
|
+
const cvaIconButtonContainer = cssClassVarianceUtilities.cvaMerge(["w-5", "h-5", "flex", "justify-center", "items-center", "box-border"], {
|
|
330
|
+
variants: {
|
|
331
|
+
size: {
|
|
332
|
+
small: ["flex", "justify-center", "items-center", "box-border"],
|
|
333
|
+
medium: "",
|
|
334
|
+
large: "",
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
defaultVariants: {
|
|
338
|
+
size: "medium",
|
|
339
|
+
},
|
|
340
|
+
});
|
|
188
341
|
|
|
189
342
|
/**
|
|
190
343
|
* Buttons allow users to perform an action when triggered.
|
|
@@ -193,40 +346,75 @@ const getPadding = () => ({ $size }) => {
|
|
|
193
346
|
* @returns {JSX.Element} Button component
|
|
194
347
|
*/
|
|
195
348
|
const Button = React__namespace.forwardRef((_a, ref) => {
|
|
196
|
-
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"]);
|
|
197
|
-
return (jsxRuntime.jsxs(StyledButton
|
|
349
|
+
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", circular } = _a, rest = __rest(_a, ["onClick", "children", "loading", "disabled", "className", "fullWidth", "prefix", "suffix", "color", "variant", "type", "size", "square", "dataTestId", "title", "role", "tabIndex", "renderAs", "circular"]);
|
|
350
|
+
return (jsxRuntime.jsxs(StyledButton, Object.assign({ "$as": renderAs, onClick: onClick, disabled: disabled || loading, type: type, className: cvaButton({ rounded: circular, disabled, size, square, color, variant, fullWidth, className }), title: title, "aria-label": title, role: role, tabIndex: tabIndex, "data-testid": dataTestId, ref: ref }, rest, { children: [loading && jsxRuntime.jsx(Spinner, { className: cvaButtonSpinner(), centering: "vertically" }), prefix, children, suffix] })));
|
|
198
351
|
});
|
|
199
|
-
const StyledButton
|
|
200
|
-
tu-button
|
|
201
|
-
${p => p.$square && tailwindStyledComponents.tws `tu-button--square`}
|
|
202
|
-
${p => p.$fullWidth && tailwindStyledComponents.tws `tu-button--full-width`}
|
|
203
|
-
${p => p.disabled &&
|
|
204
|
-
p.$as !== "button" &&
|
|
205
|
-
(p.$variant === "transparent" ? tailwindStyledComponents.tws `tu-button__disabled--transparent` : tailwindStyledComponents.tws `tu-button__disabled`)}
|
|
206
|
-
${getStyles()}
|
|
207
|
-
${getPadding()}
|
|
208
|
-
`;
|
|
209
|
-
const StyledSpinner = tailwindStyledComponents.twx(Spinner) `
|
|
210
|
-
tu-button__spinner
|
|
211
|
-
`;
|
|
352
|
+
const StyledButton = tailwindStyledComponents.tw.button ``;
|
|
212
353
|
|
|
213
354
|
const IconButton = React__namespace.forwardRef((_a, ref) => {
|
|
214
|
-
var { icon, size = "small", square = true,
|
|
215
|
-
return (jsxRuntime.jsx(
|
|
355
|
+
var { icon, size = "small", square = true, loading, disabled } = _a, rest = __rest(_a, ["icon", "size", "square", "loading", "disabled"]);
|
|
356
|
+
return (jsxRuntime.jsx(Button, Object.assign({ size: size, square: square, disabled: disabled || loading, ref: ref }, rest, { children: jsxRuntime.jsx("div", Object.assign({ className: cvaIconButtonContainer({ size }) }, { children: loading ? jsxRuntime.jsx(Spinner, { size: size }) : icon })) })));
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
360
|
+
variants: {
|
|
361
|
+
color: {
|
|
362
|
+
primary: "text-primary-600",
|
|
363
|
+
secondary: "text-secondary-600",
|
|
364
|
+
accent: "text-accent-600",
|
|
365
|
+
neutral: "text-neutral-600",
|
|
366
|
+
info: "text-info-600",
|
|
367
|
+
success: "text-success-600",
|
|
368
|
+
warning: "text-warning-600",
|
|
369
|
+
danger: "text-danger-600",
|
|
370
|
+
good: "text-good-600",
|
|
371
|
+
low: "text-low-600",
|
|
372
|
+
critical: "text-critical-600",
|
|
373
|
+
working: "text-working-600",
|
|
374
|
+
idle: "text-idle-600",
|
|
375
|
+
moving: "text-moving",
|
|
376
|
+
active: "text-active",
|
|
377
|
+
stopped: "text-stopped-600",
|
|
378
|
+
unknown: "text-unknown-600",
|
|
379
|
+
default: "text-current",
|
|
380
|
+
black: "text-black",
|
|
381
|
+
white: "text-white",
|
|
382
|
+
},
|
|
383
|
+
size: {
|
|
384
|
+
small: "w-4",
|
|
385
|
+
medium: "w-5",
|
|
386
|
+
large: "w-6",
|
|
387
|
+
font: "w-[1em]",
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
defaultVariants: {
|
|
391
|
+
color: "default",
|
|
392
|
+
size: "large",
|
|
393
|
+
},
|
|
216
394
|
});
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
395
|
+
const cvaIconComponent = cssClassVarianceUtilities.cvaMerge([], {
|
|
396
|
+
variants: {
|
|
397
|
+
iconType: {
|
|
398
|
+
solid: "fill-current stroke-transparent",
|
|
399
|
+
outline: "fill-transparent stroke-current",
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
});
|
|
403
|
+
const cvaLoadingDot = cssClassVarianceUtilities.cvaMerge([
|
|
404
|
+
"relative",
|
|
405
|
+
"aspect-square",
|
|
406
|
+
"after:content-['']",
|
|
407
|
+
"after:absolute",
|
|
408
|
+
"after:h-2",
|
|
409
|
+
"after:w-2",
|
|
410
|
+
"after:bg-current",
|
|
411
|
+
"after:rounded-full",
|
|
412
|
+
"after:inset-1/2",
|
|
413
|
+
"after:-translate-x-1/2",
|
|
414
|
+
"after:-translate-y-1/2",
|
|
415
|
+
"after:opacity-50",
|
|
416
|
+
]);
|
|
224
417
|
|
|
225
|
-
const IconSizeClassMap = {
|
|
226
|
-
small: tailwindStyledComponents.tws `tu-icon--small`,
|
|
227
|
-
medium: tailwindStyledComponents.tws `tu-icon--medium`,
|
|
228
|
-
large: tailwindStyledComponents.tws `tu-icon--large`, // 24x24px
|
|
229
|
-
};
|
|
230
418
|
/**
|
|
231
419
|
* - The Icon component is used to display an Icon.
|
|
232
420
|
* - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
|
|
@@ -236,9 +424,7 @@ const IconSizeClassMap = {
|
|
|
236
424
|
* @returns {JSX.Element} Icon component
|
|
237
425
|
*/
|
|
238
426
|
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
|
|
239
|
-
const iconSizeClassName = React__namespace.useMemo(() => IconSizeClassMap[size], [size]);
|
|
240
427
|
const correctIconType = React__namespace.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
|
|
241
|
-
const colorClassNames = React__namespace.useMemo(() => (correctIconType === "solid" ? tailwindStyledComponents.tws `fill-current stroke-transparent` : tailwindStyledComponents.tws `fill-transparent stroke-current`), [correctIconType]);
|
|
242
428
|
let IconComponent = null;
|
|
243
429
|
if (uiIcons.HeroIconsArray.find(icon => icon === name)) {
|
|
244
430
|
IconComponent = uiIcons.heroIconLookup(name, correctIconType);
|
|
@@ -250,54 +436,10 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fil
|
|
|
250
436
|
if (!IconComponent) {
|
|
251
437
|
return null;
|
|
252
438
|
}
|
|
253
|
-
return (jsxRuntime.jsx(React__namespace.Suspense, Object.assign({ fallback: jsxRuntime.jsx(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
`;
|
|
258
|
-
const Root$5 = tailwindStyledComponents.tw.span `
|
|
259
|
-
tu-icon
|
|
260
|
-
${({ $color }) => {
|
|
261
|
-
switch ($color) {
|
|
262
|
-
case "primary":
|
|
263
|
-
return tailwindStyledComponents.tws `tu-icon--primary`;
|
|
264
|
-
case "secondary":
|
|
265
|
-
return tailwindStyledComponents.tws `tu-icon--secondary`;
|
|
266
|
-
case "accent":
|
|
267
|
-
return tailwindStyledComponents.tws `tu-icon--accent`;
|
|
268
|
-
case "neutral":
|
|
269
|
-
return tailwindStyledComponents.tws `tu-icon--neutral`;
|
|
270
|
-
case "info":
|
|
271
|
-
return tailwindStyledComponents.tws `tu-icon--info`;
|
|
272
|
-
case "success":
|
|
273
|
-
return tailwindStyledComponents.tws `tu-icon--success`;
|
|
274
|
-
case "warning":
|
|
275
|
-
return tailwindStyledComponents.tws `tu-icon--warning`;
|
|
276
|
-
case "danger":
|
|
277
|
-
return tailwindStyledComponents.tws `tu-icon--danger`;
|
|
278
|
-
case "good":
|
|
279
|
-
return tailwindStyledComponents.tws `tu-icon--good`;
|
|
280
|
-
case "low":
|
|
281
|
-
return tailwindStyledComponents.tws `tu-icon--low`;
|
|
282
|
-
case "critical":
|
|
283
|
-
return tailwindStyledComponents.tws `tu-icon--critical`;
|
|
284
|
-
case "working":
|
|
285
|
-
return tailwindStyledComponents.tws `tu-icon--working`;
|
|
286
|
-
case "idle":
|
|
287
|
-
return tailwindStyledComponents.tws `tu-icon--idle`;
|
|
288
|
-
case "stopped":
|
|
289
|
-
return tailwindStyledComponents.tws `tu-icon--stopped`;
|
|
290
|
-
case "moving":
|
|
291
|
-
return tailwindStyledComponents.tws `tu-icon--moving`;
|
|
292
|
-
case "unknown":
|
|
293
|
-
return tailwindStyledComponents.tws `tu-icon--unknown`;
|
|
294
|
-
case "white":
|
|
295
|
-
return tailwindStyledComponents.tws `text-white`;
|
|
296
|
-
default:
|
|
297
|
-
return "tu-icon--default";
|
|
298
|
-
}
|
|
299
|
-
}}
|
|
300
|
-
`;
|
|
439
|
+
return (jsxRuntime.jsx(React__namespace.Suspense, Object.assign({ fallback: jsxRuntime.jsx("span", { className: cvaLoadingDot(), "data-testid": dataTestId }) }, { children: jsxRuntime.jsx("span", Object.assign({ className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef }, { children: jsxRuntime.jsx(IconComponent, { "data-testid": dataTestId ? `${dataTestId}-${name}` : name, className: cvaIconComponent({
|
|
440
|
+
iconType: correctIconType,
|
|
441
|
+
}), style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style) }) })) })));
|
|
442
|
+
};
|
|
301
443
|
|
|
302
444
|
/**
|
|
303
445
|
* The StarButton component is used for favorite actions or similar.
|
|
@@ -306,20 +448,8 @@ const Root$5 = tailwindStyledComponents.tw.span `
|
|
|
306
448
|
* @returns {JSX.Element} StarButton component
|
|
307
449
|
*/
|
|
308
450
|
const StarButton = ({ starred, onClick }) => {
|
|
309
|
-
return (jsxRuntime.jsx(
|
|
310
|
-
};
|
|
311
|
-
const Flex$1 = tailwindStyledComponents.tw.div `
|
|
312
|
-
flex
|
|
313
|
-
items-center
|
|
314
|
-
`;
|
|
315
|
-
const CustomIcon = tailwindStyledComponents.twx(Icon) `
|
|
316
|
-
cursor-pointer
|
|
317
|
-
w-5
|
|
318
|
-
h-5
|
|
319
|
-
hover:!fill-primary-400
|
|
320
|
-
hover:!stroke-transparent
|
|
321
|
-
${p => (p.$starred ? tailwindStyledComponents.tws `!fill-primary-600 !stroke-transparent` : tailwindStyledComponents.tws `!fill-transparent !stroke-neutral-800`)}
|
|
322
|
-
`;
|
|
451
|
+
return (jsxRuntime.jsx("div", Object.assign({ onClick: onClick, "data-test-id": "starred-filter" }, { children: jsxRuntime.jsx(Icon, { name: "StarIcon", color: starred ? "primary" : "neutral", type: starred ? "solid" : "outline", size: "medium" }) })));
|
|
452
|
+
};
|
|
323
453
|
|
|
324
454
|
/**
|
|
325
455
|
* The Text component is used to apply Trackunit default typography styles to text.
|
|
@@ -331,8 +461,8 @@ const CustomIcon = tailwindStyledComponents.twx(Icon) `
|
|
|
331
461
|
* @param {TextProps} props - The props for the Text component
|
|
332
462
|
* @returns {JSX.Element} Text component
|
|
333
463
|
*/
|
|
334
|
-
const Text
|
|
335
|
-
return (jsxRuntime.jsx(StyledText
|
|
464
|
+
const Text = ({ children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, className, dataTestId, }) => {
|
|
465
|
+
return (jsxRuntime.jsx(StyledText, 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 })));
|
|
336
466
|
};
|
|
337
467
|
const getTextSize = () => ({ $size }) => {
|
|
338
468
|
const sizes = {
|
|
@@ -350,7 +480,7 @@ const getTextWeight = () => ({ $weight }) => {
|
|
|
350
480
|
};
|
|
351
481
|
return weights[$weight];
|
|
352
482
|
};
|
|
353
|
-
const getFontColor
|
|
483
|
+
const getFontColor = () => ({ $inverted, $subtle }) => {
|
|
354
484
|
const subtle = $inverted ? tailwindStyledComponents.tws `tu-text--subtle-inverted` : tailwindStyledComponents.tws `tu-text--subtle`;
|
|
355
485
|
const inverted = $inverted ? tailwindStyledComponents.tws `tu-text--inverted` : null;
|
|
356
486
|
return $subtle ? subtle : inverted;
|
|
@@ -363,9 +493,9 @@ const getTextAlignment = () => ({ $align }) => {
|
|
|
363
493
|
};
|
|
364
494
|
return alignments[$align];
|
|
365
495
|
};
|
|
366
|
-
const StyledText
|
|
496
|
+
const StyledText = tailwindStyledComponents.tw.text `
|
|
367
497
|
tu-text
|
|
368
|
-
${getFontColor
|
|
498
|
+
${getFontColor()}
|
|
369
499
|
${p => (p.$italicize ? tailwindStyledComponents.tws `tu-text--italic` : "")}
|
|
370
500
|
${p => (p.$uppercase ? tailwindStyledComponents.tws `tu-text--uppercase` : "")}
|
|
371
501
|
${getTextAlignment()}
|
|
@@ -469,7 +599,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
469
599
|
return "primary";
|
|
470
600
|
}
|
|
471
601
|
};
|
|
472
|
-
const body = inline ? (jsxRuntime.jsxs("div", { children: [title && jsxRuntime.jsx(Text
|
|
602
|
+
const body = inline ? (jsxRuntime.jsxs("div", { children: [title && jsxRuntime.jsx(Text, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && jsxRuntime.jsx(Text, Object.assign({ weight: !title ? "bold" : "normal" }, { children: children }))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [title && jsxRuntime.jsx(Text, Object.assign({ weight: "bold" }, { children: title !== null && title !== void 0 ? title : children })), children && jsxRuntime.jsx(Text, Object.assign({ weight: !title ? "bold" : "normal" }, { children: children }))] }));
|
|
473
603
|
React__namespace.useEffect(() => {
|
|
474
604
|
if (autoScroll) {
|
|
475
605
|
ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
|
|
@@ -479,6 +609,37 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
479
609
|
return (jsxRuntime.jsxs("div", Object.assign({ className: cvaAlert({ color, layout, className }), "data-testid": dataTestId, ref: ref, role: "alert" }, { children: [jsxRuntime.jsx("div", Object.assign({ className: cvaAlertIconContainer({ layout }) }, { children: getIconFromColor() })), jsxRuntime.jsxs("div", Object.assign({ className: cvaAlertContent({ layout }) }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: cvaAlertDetails() }, { children: [jsxRuntime.jsx("div", Object.assign({ className: cvaAlertContentBody() }, { children: body })), onClose && !inline ? (jsxRuntime.jsx("div", Object.assign({ className: cvaAlertCloseButtonContainer({ layout }) }, { 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("div", Object.assign({ className: cvaAlertRightAligned({ layout }) }, { 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("div", Object.assign({ className: cvaAlertCloseButtonContainer({ layout }) }, { 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] })))] }))] })));
|
|
480
610
|
};
|
|
481
611
|
|
|
612
|
+
const cvaBadge = cssClassVarianceUtilities.cvaMerge([
|
|
613
|
+
"uppercase",
|
|
614
|
+
"align-middle",
|
|
615
|
+
"box-border",
|
|
616
|
+
"whitespace-nowrap",
|
|
617
|
+
"overflow-hidden",
|
|
618
|
+
"text-ellipsis",
|
|
619
|
+
"inline-block",
|
|
620
|
+
"rounded-full",
|
|
621
|
+
"font-bold",
|
|
622
|
+
"text-center",
|
|
623
|
+
"tabular-nums",
|
|
624
|
+
"w-min",
|
|
625
|
+
"h-min",
|
|
626
|
+
"min-h-[0.5rem]",
|
|
627
|
+
"min-w-[1.5rem]",
|
|
628
|
+
"text-xs",
|
|
629
|
+
"px-1",
|
|
630
|
+
"py-0.5",
|
|
631
|
+
], {
|
|
632
|
+
variants: {
|
|
633
|
+
color: {
|
|
634
|
+
primary: "bg-primary-600 text-white",
|
|
635
|
+
danger: "bg-danger-700 text-white",
|
|
636
|
+
},
|
|
637
|
+
},
|
|
638
|
+
defaultVariants: {
|
|
639
|
+
color: "primary",
|
|
640
|
+
},
|
|
641
|
+
});
|
|
642
|
+
|
|
482
643
|
/**
|
|
483
644
|
* The Badge component is used to display a notification badge with an optional number value.
|
|
484
645
|
*
|
|
@@ -486,25 +647,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
486
647
|
* @returns {JSX.Element} Badge component
|
|
487
648
|
*/
|
|
488
649
|
const Badge = (_a) => {
|
|
489
|
-
var { color = "primary",
|
|
650
|
+
var { color = "primary", className, count, max, hideZero = false, dataTestId } = _a; __rest(_a, ["color", "className", "count", "max", "hideZero", "dataTestId"]);
|
|
490
651
|
if (hideZero && count === 0) {
|
|
491
652
|
return null;
|
|
492
653
|
}
|
|
493
654
|
const displayedCount = count && max ? (count > max ? `${max}+` : count) : count;
|
|
494
|
-
return (jsxRuntime.jsx(
|
|
495
|
-
};
|
|
496
|
-
const getBadgeModifierClass = () => ({ $color, $subtle }) => {
|
|
497
|
-
const colorClasses = {
|
|
498
|
-
primary: $subtle ? tailwindStyledComponents.tws `tu-badge--primary-subtle` : tailwindStyledComponents.tws `tu-badge--primary`,
|
|
499
|
-
danger: $subtle ? tailwindStyledComponents.tws `tu-badge--danger-subtle` : tailwindStyledComponents.tws `tu-badge--danger`,
|
|
500
|
-
};
|
|
501
|
-
return colorClasses[$color];
|
|
502
|
-
};
|
|
503
|
-
const StyledText$2 = tailwindStyledComponents.tw.text `
|
|
504
|
-
tu-badge
|
|
505
|
-
${({ $count }) => ($count === null || $count === undefined) && tailwindStyledComponents.tws `tu-badge--square`}
|
|
506
|
-
${getBadgeModifierClass()}
|
|
507
|
-
`;
|
|
655
|
+
return (jsxRuntime.jsx("span", Object.assign({ className: cvaBadge({ color, className }), "data-testid": dataTestId }, { children: displayedCount })));
|
|
656
|
+
};
|
|
508
657
|
|
|
509
658
|
const cvaCard = cssClassVarianceUtilities.cvaMerge([
|
|
510
659
|
"flex",
|
|
@@ -643,40 +792,53 @@ const CardFooter = ({ dataTestId, className, children, density, hideSeparator =
|
|
|
643
792
|
return (jsxRuntime.jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardFooterDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, direction: "row" }, { children: children })));
|
|
644
793
|
};
|
|
645
794
|
|
|
795
|
+
const cvaHeading = cssClassVarianceUtilities.cvaMerge(["m-0", "leading-normal", "text-black"], {
|
|
796
|
+
variants: {
|
|
797
|
+
subtle: {
|
|
798
|
+
true: "text-neutral-600",
|
|
799
|
+
false: "",
|
|
800
|
+
},
|
|
801
|
+
inverted: {
|
|
802
|
+
true: "text-white",
|
|
803
|
+
false: "",
|
|
804
|
+
},
|
|
805
|
+
size: {
|
|
806
|
+
primary: "text-3xl font-semibold",
|
|
807
|
+
secondary: "text-lg font-semibold",
|
|
808
|
+
tertiary: "text-base font-semibold",
|
|
809
|
+
subtitle: "text-base font-normal",
|
|
810
|
+
},
|
|
811
|
+
},
|
|
812
|
+
compoundVariants: [
|
|
813
|
+
{
|
|
814
|
+
inverted: true,
|
|
815
|
+
subtle: true,
|
|
816
|
+
className: "text-neutral-300",
|
|
817
|
+
},
|
|
818
|
+
],
|
|
819
|
+
defaultVariants: {
|
|
820
|
+
subtle: false,
|
|
821
|
+
inverted: false,
|
|
822
|
+
size: "primary",
|
|
823
|
+
},
|
|
824
|
+
});
|
|
825
|
+
|
|
646
826
|
/**
|
|
647
827
|
* The Heading is used for a heading of a section (h1,h2,h3,h4).
|
|
648
828
|
*
|
|
649
829
|
* @param {HeadingProps} props - The props for the Heading component
|
|
650
830
|
* @returns {JSX.Element} Heading component
|
|
651
831
|
*/
|
|
652
|
-
const Heading
|
|
832
|
+
const Heading = ({ children, variant = "primary", inverted = false, subtle = false, className, dataTestId, }) => {
|
|
653
833
|
const semanticType = {
|
|
654
834
|
primary: "h1",
|
|
655
835
|
secondary: "h2",
|
|
656
836
|
tertiary: "h3",
|
|
657
837
|
subtitle: "h4",
|
|
658
838
|
};
|
|
659
|
-
return (jsxRuntime.jsx(StyledHeading, Object.assign({ "$as": semanticType[variant], className:
|
|
660
|
-
};
|
|
661
|
-
const getVariantStyles = () => ({ $variant }) => {
|
|
662
|
-
const variants = {
|
|
663
|
-
primary: tailwindStyledComponents.tws `tu-heading--primary`,
|
|
664
|
-
secondary: tailwindStyledComponents.tws `tu-heading--secondary`,
|
|
665
|
-
tertiary: tailwindStyledComponents.tws `tu-heading--tertiary`,
|
|
666
|
-
subtitle: tailwindStyledComponents.tws `tu-heading--subtitle`,
|
|
667
|
-
};
|
|
668
|
-
return variants[$variant];
|
|
839
|
+
return (jsxRuntime.jsx(StyledHeading, Object.assign({ "$as": semanticType[variant], className: cvaHeading({ subtle, inverted, size: variant, className }), "data-testid": dataTestId }, { children: children })));
|
|
669
840
|
};
|
|
670
|
-
const
|
|
671
|
-
const subtle = $inverted ? tailwindStyledComponents.tws `tu-heading--subtle-inverted` : tailwindStyledComponents.tws `tu-heading--subtle`;
|
|
672
|
-
const inverted = $inverted ? tailwindStyledComponents.tws `tu-heading--inverted` : null;
|
|
673
|
-
return $subtle ? subtle : inverted;
|
|
674
|
-
};
|
|
675
|
-
const StyledHeading = tailwindStyledComponents.tw.div `
|
|
676
|
-
tu-heading
|
|
677
|
-
${getFontColor()}
|
|
678
|
-
${getVariantStyles()}
|
|
679
|
-
`;
|
|
841
|
+
const StyledHeading = tailwindStyledComponents.tw.div ``;
|
|
680
842
|
|
|
681
843
|
/**
|
|
682
844
|
* Header for Cards and Modals.
|
|
@@ -685,7 +847,7 @@ const StyledHeading = tailwindStyledComponents.tw.div `
|
|
|
685
847
|
* @returns {JSX.Element} CardHeader component
|
|
686
848
|
*/
|
|
687
849
|
const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
|
|
688
|
-
return (jsxRuntime.jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density }, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaCardHeader() }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: cvaCardHeaderHeadingContainer() }, { children: [jsxRuntime.jsx(Heading
|
|
850
|
+
return (jsxRuntime.jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density }, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaCardHeader() }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: cvaCardHeaderHeadingContainer() }, { children: [jsxRuntime.jsx(Heading, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] })), subHeading && (jsxRuntime.jsx(Heading, 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" }))] })) })));
|
|
689
851
|
};
|
|
690
852
|
|
|
691
853
|
const cvaCollapse = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -731,7 +893,7 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
|
|
|
731
893
|
}
|
|
732
894
|
setExpanded(!expanded);
|
|
733
895
|
}, [expanded, onToggle]);
|
|
734
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: cvaCollapse({ className }), "data-testid": dataTestId }, { children: [jsxRuntime.jsx("div", Object.assign({ className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaCollapseLabelContainer() }, { children: [jsxRuntime.jsx(Text
|
|
896
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: cvaCollapse({ className }), "data-testid": dataTestId }, { children: [jsxRuntime.jsx("div", Object.assign({ className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaCollapseLabelContainer() }, { children: [jsxRuntime.jsx(Text, Object.assign({ weight: "bold" }, { children: label })), jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "ChevronDownIcon", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] })) })), jsxRuntime.jsx(Collapsible, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
|
|
735
897
|
};
|
|
736
898
|
const Collapsible = ({ children, expanded, id }) => {
|
|
737
899
|
const [ref, { height }] = reactUse.useMeasure();
|
|
@@ -910,12 +1072,23 @@ const Popover = (_a) => {
|
|
|
910
1072
|
return jsxRuntime.jsx(PopoverContext.Provider, Object.assign({ value: popover }, { children: children }));
|
|
911
1073
|
};
|
|
912
1074
|
|
|
1075
|
+
const cvaPopoverContainer = cssClassVarianceUtilities.cvaMerge(["component-popover-border", "z-popover", "animate-fade-in-fast"]);
|
|
1076
|
+
const cvaPopoverTitleContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "px-2", "py-1"], {
|
|
1077
|
+
variants: {
|
|
1078
|
+
divider: {
|
|
1079
|
+
true: ["border-b", "border-solid", "border-b-neutral-100", "mb-1"],
|
|
1080
|
+
false: "",
|
|
1081
|
+
},
|
|
1082
|
+
},
|
|
1083
|
+
});
|
|
1084
|
+
const cvaPopoverTitleText = cssClassVarianceUtilities.cvaMerge(["flex-1", "text-neutral-500"]);
|
|
1085
|
+
|
|
913
1086
|
const PopoverContent = React__default["default"].forwardRef(function PopoverContent(_a, propRef) {
|
|
914
|
-
var _b, _c, _d
|
|
1087
|
+
var _b, _c, _d;
|
|
915
1088
|
var { className, dataTestId, children } = _a, props = __rest(_a, ["className", "dataTestId", "children"]);
|
|
916
|
-
const
|
|
1089
|
+
const _e = usePopoverContext(), { context: floatingContext, customProps } = _e, context = __rest(_e, ["context", "customProps"]);
|
|
917
1090
|
const ref = react.useMergeRefs([context.refs.setFloating, propRef]);
|
|
918
|
-
return (jsxRuntime.jsx(react.FloatingPortal, Object.assign({ id: "tu-floating-ui" }, { children: context.isOpen && (jsxRuntime.jsx(react.FloatingFocusManager, Object.assign({ guards: false, context: floatingContext, modal: context.isModal, order: ["reference", "content"], returnFocus: false }, { children: jsxRuntime.jsx("div", Object.assign({ ref: ref, className:
|
|
1091
|
+
return (jsxRuntime.jsx(react.FloatingPortal, Object.assign({ id: "tu-floating-ui" }, { children: context.isOpen && (jsxRuntime.jsx(react.FloatingFocusManager, Object.assign({ guards: false, context: floatingContext, modal: context.isModal, order: ["reference", "content"], returnFocus: false }, { children: jsxRuntime.jsx("div", Object.assign({ ref: ref, className: cvaPopoverContainer({ className: className !== null && className !== void 0 ? className : customProps.className }), "data-testid": (_b = dataTestId !== null && dataTestId !== void 0 ? dataTestId : customProps.dataTestId) !== null && _b !== void 0 ? _b : "popover-content", style: Object.assign({ position: context.strategy, top: (_c = context.y) !== null && _c !== void 0 ? _c : 0, left: (_d = context.x) !== null && _d !== void 0 ? _d : 0, width: "max-content" }, props.style), "aria-labelledby": context.labelId, "aria-describedby": context.descriptionId }, context.getFloatingProps(props), { children: typeof children === "function" ? children(() => context.setIsOpen(false)) : children })) }))) })));
|
|
919
1092
|
});
|
|
920
1093
|
|
|
921
1094
|
/**
|
|
@@ -925,15 +1098,8 @@ const PopoverContent = React__default["default"].forwardRef(function PopoverCont
|
|
|
925
1098
|
* @returns {JSX.Element} PopoverTitle component
|
|
926
1099
|
*/
|
|
927
1100
|
const PopoverTitle = ({ children, action, divider = false, className, dataTestId }) => {
|
|
928
|
-
return (jsxRuntime.jsxs(
|
|
929
|
-
};
|
|
930
|
-
const Container$3 = tailwindStyledComponents.tw.div `
|
|
931
|
-
tu-popover-title-container
|
|
932
|
-
${p => p.$divider && `tu-popover-title-container--divider`}
|
|
933
|
-
`;
|
|
934
|
-
const StyledText$1 = tailwindStyledComponents.twx(Text$1) `
|
|
935
|
-
tu-popover-title-text
|
|
936
|
-
`;
|
|
1101
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: cvaPopoverTitleContainer({ divider, className }), "data-testid": dataTestId }, { children: [jsxRuntime.jsx(Text, Object.assign({ className: cvaPopoverTitleText(), type: "div", subtle: true, size: "small", weight: "bold", uppercase: true }, { children: children })), action] })));
|
|
1102
|
+
};
|
|
937
1103
|
|
|
938
1104
|
const PopoverTrigger = React.forwardRef(function PopoverTrigger(_a, propRef) {
|
|
939
1105
|
var { children, renderButton } = _a, props = __rest(_a, ["children", "renderButton"]);
|
|
@@ -980,6 +1146,29 @@ const DayRangePicker = ({ onRangeSelect, selectedDays, disabledDays, dataTestId,
|
|
|
980
1146
|
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 }) }));
|
|
981
1147
|
};
|
|
982
1148
|
|
|
1149
|
+
const cvaDrawerOverlay = cssClassVarianceUtilities.cvaMerge([
|
|
1150
|
+
"bg-black/30",
|
|
1151
|
+
"block",
|
|
1152
|
+
"z-toast",
|
|
1153
|
+
"inset-0",
|
|
1154
|
+
"absolute",
|
|
1155
|
+
"cursor-pointer",
|
|
1156
|
+
"animate-fade-in-fast",
|
|
1157
|
+
]);
|
|
1158
|
+
const cvaDrawerCard = cssClassVarianceUtilities.cvaMerge(["fixed", "z-toast"], {
|
|
1159
|
+
variants: {
|
|
1160
|
+
position: {
|
|
1161
|
+
left: "top-0 left-0 animate-slide-in-left h-full rounded-l-none",
|
|
1162
|
+
right: "top-0 right-0 animate-slide-in-right h-full rounded-r-none",
|
|
1163
|
+
bottom: "right-0 left-0 bottom-0 animate-slide-in-bottom w-full rounded-b-none",
|
|
1164
|
+
top: "top-0 left-0 animate-slide-in-top w-full rounded-t-none",
|
|
1165
|
+
},
|
|
1166
|
+
},
|
|
1167
|
+
defaultVariants: {
|
|
1168
|
+
position: "left",
|
|
1169
|
+
},
|
|
1170
|
+
});
|
|
1171
|
+
|
|
983
1172
|
/**
|
|
984
1173
|
* The drawer provides a slideover which can be used to provide access to different locations in the application.
|
|
985
1174
|
*
|
|
@@ -1002,35 +1191,10 @@ const Drawer = ({ open, onClose = () => { }, children, disableOverlay = false, p
|
|
|
1002
1191
|
window.removeEventListener("keyup", onKeyPress);
|
|
1003
1192
|
};
|
|
1004
1193
|
}, [open, onClose]);
|
|
1005
|
-
return (jsxRuntime.jsx(react.FloatingFocusManager, Object.assign({ context: context }, { children: open ? (jsxRuntime.jsxs(
|
|
1194
|
+
return (jsxRuntime.jsx(react.FloatingFocusManager, Object.assign({ context: context }, { children: open ? (jsxRuntime.jsxs("div", Object.assign({ id: "drawer" }, { children: [!disableOverlay && (jsxRuntime.jsx("div", { className: cvaDrawerOverlay(), "aria-hidden": open, onClick: onClose, id: "drawer__overlay" })), jsxRuntime.jsx(Card, Object.assign({ "aria-hidden": open, "data-testId": dataTestId, id: "drawer__card", className: cvaDrawerCard({ position, className }) }, { children: children }))] }))) : (
|
|
1006
1195
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
1007
1196
|
jsxRuntime.jsx(jsxRuntime.Fragment, {})) })));
|
|
1008
|
-
};
|
|
1009
|
-
const getPositionStyles = ($position) => {
|
|
1010
|
-
switch ($position) {
|
|
1011
|
-
case "top":
|
|
1012
|
-
return tailwindStyledComponents.tws `tu-drawer__card--top`;
|
|
1013
|
-
case "right":
|
|
1014
|
-
return tailwindStyledComponents.tws `tu-drawer__card--right`;
|
|
1015
|
-
case "bottom":
|
|
1016
|
-
return tailwindStyledComponents.tws `tu-drawer__card--bottom`;
|
|
1017
|
-
case "left":
|
|
1018
|
-
default:
|
|
1019
|
-
return tailwindStyledComponents.tws `tu-drawer__card--left`;
|
|
1020
|
-
}
|
|
1021
|
-
};
|
|
1022
|
-
const StyledCard$1 = tailwindStyledComponents.twx(Card) `
|
|
1023
|
-
tu-drawer__card
|
|
1024
|
-
${({ $open }) => $open && tailwindStyledComponents.tws `tu-drawer__card--open`}
|
|
1025
|
-
${({ $position }) => getPositionStyles($position)}
|
|
1026
|
-
`;
|
|
1027
|
-
const Root$4 = tailwindStyledComponents.tw.div `
|
|
1028
|
-
tu-drawer
|
|
1029
|
-
`;
|
|
1030
|
-
const Overlay = tailwindStyledComponents.tw.div `
|
|
1031
|
-
tu-drawer__overlay
|
|
1032
|
-
${({ $open }) => $open && tailwindStyledComponents.tws `tu-drawer__overlay--open`}
|
|
1033
|
-
`;
|
|
1197
|
+
};
|
|
1034
1198
|
|
|
1035
1199
|
/**
|
|
1036
1200
|
* The external link component is used to link to an external page outside the Trackunit Manager.
|
|
@@ -1042,6 +1206,90 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
|
|
|
1042
1206
|
return (jsxRuntime.jsx("a", Object.assign({ "data-testid": dataTestId, className: className, title: title, href: href, rel: rel, target: target }, { children: children })));
|
|
1043
1207
|
};
|
|
1044
1208
|
|
|
1209
|
+
const cvaIndicator = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
1210
|
+
const cvaIndicatorIcon = cssClassVarianceUtilities.cvaMerge(["mr-2"]);
|
|
1211
|
+
const cvaIndicatorLabel = cssClassVarianceUtilities.cvaMerge(["pl-2", "pr-2", "font-medium", "capitalize", "text-sm", "xl:text-base"]);
|
|
1212
|
+
const cvaIndicatorPing = cssClassVarianceUtilities.cvaMerge(["animate-ping-sm", "absolute", "inline-flex", "h-full", "w-full", "rounded-full", "opacity-75", "bg-neutral-600"], {
|
|
1213
|
+
variants: {
|
|
1214
|
+
color: {
|
|
1215
|
+
primary: "bg-primary-600",
|
|
1216
|
+
secondary: "bg-secondary-600",
|
|
1217
|
+
accent: "bg-accent-600",
|
|
1218
|
+
neutral: "bg-neutral-600",
|
|
1219
|
+
info: "bg-info-600",
|
|
1220
|
+
success: "bg-success-600",
|
|
1221
|
+
warning: "bg-warning-600",
|
|
1222
|
+
danger: "bg-danger-600",
|
|
1223
|
+
good: "bg-good-600",
|
|
1224
|
+
low: "bg-low-600",
|
|
1225
|
+
critical: "bg-critical-600",
|
|
1226
|
+
working: "bg-working-600",
|
|
1227
|
+
idle: "bg-idle-600",
|
|
1228
|
+
stopped: "bg-stopped-600",
|
|
1229
|
+
moving: "bg-moving",
|
|
1230
|
+
active: "bg-active",
|
|
1231
|
+
unknown: "bg-unknown-600",
|
|
1232
|
+
unused: "bg-unused-400",
|
|
1233
|
+
utilized: "bg-utilized-600",
|
|
1234
|
+
heavily_utilized: "bg-heavily_utilized-500",
|
|
1235
|
+
available: "bg-available-600",
|
|
1236
|
+
on_rent: "bg-on_rent-600",
|
|
1237
|
+
pickup_ready: "bg-pickup_ready-600",
|
|
1238
|
+
transfer: "bg-transfer-600",
|
|
1239
|
+
in_repair: "bg-in_repair-600",
|
|
1240
|
+
returned: "bg-returned-600",
|
|
1241
|
+
other_rental_status: "bg-other_rental_status-600",
|
|
1242
|
+
site: "bg-neutral-600",
|
|
1243
|
+
white: "bg-white",
|
|
1244
|
+
black: "bg-black",
|
|
1245
|
+
},
|
|
1246
|
+
},
|
|
1247
|
+
});
|
|
1248
|
+
const cvaIndicatorIconBackground = cssClassVarianceUtilities.cvaMerge(["rounded-full", "items-center", "justify-center", "flex", "relative"], {
|
|
1249
|
+
variants: {
|
|
1250
|
+
color: {
|
|
1251
|
+
primary: "bg-primary-100 text-primary-600",
|
|
1252
|
+
secondary: "bg-secondary-100 text-secondary-600",
|
|
1253
|
+
accent: "bg-accent-100 text-accent-600",
|
|
1254
|
+
neutral: "bg-neutral-100 text-neutral-600",
|
|
1255
|
+
info: "bg-info-100 text-info-600",
|
|
1256
|
+
success: "bg-success-100 text-success-600",
|
|
1257
|
+
warning: "bg-warning-100 text-warning-600",
|
|
1258
|
+
danger: "bg-danger-100 text-danger-600",
|
|
1259
|
+
good: "bg-good-100 text-good-600",
|
|
1260
|
+
low: "bg-low-100 text-low-600",
|
|
1261
|
+
critical: "bg-critical-100 text-critical-600",
|
|
1262
|
+
working: "bg-working-100 text-working-600",
|
|
1263
|
+
idle: "bg-idle-100 text-idle-600",
|
|
1264
|
+
stopped: "bg-stopped-100 text-stopped-600",
|
|
1265
|
+
moving: "bg-neutral-100 text-moving",
|
|
1266
|
+
active: "bg-neutral-100 text-active",
|
|
1267
|
+
unknown: "bg-unknown-100 text-unknown-600",
|
|
1268
|
+
unused: "bg-unused-300 text-unused-400",
|
|
1269
|
+
utilized: "bg-utilized-400 text-utilized-600",
|
|
1270
|
+
heavily_utilized: "bg-heavily_utilized-300 text-heavily_utilized-500",
|
|
1271
|
+
available: "bg-available-100 text-available-600",
|
|
1272
|
+
on_rent: "bg-on_rent-100 text-on_rent-600",
|
|
1273
|
+
pickup_ready: "bg-pickup_ready-100 text-pickup_ready-600",
|
|
1274
|
+
transfer: "bg-transfer-100 text-transfer-600",
|
|
1275
|
+
in_repair: "bg-in_repair-100 text-in_repair-600",
|
|
1276
|
+
returned: "bg-returned-100 text-returned-600",
|
|
1277
|
+
other_rental_status: "bg-other_rental_status-100 text-other_rental_status-600",
|
|
1278
|
+
site: "bg-neutral-100 text-neutral-600",
|
|
1279
|
+
white: "bg-white text-black",
|
|
1280
|
+
black: "bg-black text-white",
|
|
1281
|
+
},
|
|
1282
|
+
background: {
|
|
1283
|
+
visible: ["p-[6px]"],
|
|
1284
|
+
hidden: ["bg-white", "p-0"],
|
|
1285
|
+
},
|
|
1286
|
+
},
|
|
1287
|
+
defaultVariants: {
|
|
1288
|
+
background: "visible",
|
|
1289
|
+
color: "neutral",
|
|
1290
|
+
},
|
|
1291
|
+
});
|
|
1292
|
+
|
|
1045
1293
|
/**
|
|
1046
1294
|
* Indicators are non-interactive elements that communicate essential aspects of the state of an asset.
|
|
1047
1295
|
*
|
|
@@ -1055,83 +1303,9 @@ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className,
|
|
|
1055
1303
|
* @returns {JSX.Element} Indicator component
|
|
1056
1304
|
*/
|
|
1057
1305
|
const Indicator = (_a) => {
|
|
1058
|
-
var { dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false } = _a, rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping"]);
|
|
1059
|
-
return (jsxRuntime.jsxs(
|
|
1060
|
-
};
|
|
1061
|
-
const Container$2 = tailwindStyledComponents.tw.div `
|
|
1062
|
-
tu-indicator
|
|
1063
|
-
${({ $color }) => {
|
|
1064
|
-
switch ($color) {
|
|
1065
|
-
case "primary":
|
|
1066
|
-
return tailwindStyledComponents.tws `tu-indicator--primary`;
|
|
1067
|
-
case "secondary":
|
|
1068
|
-
return tailwindStyledComponents.tws `tu-indicator--secondary`;
|
|
1069
|
-
case "accent":
|
|
1070
|
-
return tailwindStyledComponents.tws `tu-indicator--accent`;
|
|
1071
|
-
case "neutral":
|
|
1072
|
-
return tailwindStyledComponents.tws `tu-indicator--neutral`;
|
|
1073
|
-
case "info":
|
|
1074
|
-
return tailwindStyledComponents.tws `tu-indicator--info`;
|
|
1075
|
-
case "success":
|
|
1076
|
-
return tailwindStyledComponents.tws `tu-indicator--success`;
|
|
1077
|
-
case "warning":
|
|
1078
|
-
return tailwindStyledComponents.tws `tu-indicator--warning`;
|
|
1079
|
-
case "danger":
|
|
1080
|
-
return tailwindStyledComponents.tws `tu-indicator--danger`;
|
|
1081
|
-
case "good":
|
|
1082
|
-
return tailwindStyledComponents.tws `tu-indicator--good`;
|
|
1083
|
-
case "low":
|
|
1084
|
-
return tailwindStyledComponents.tws `tu-indicator--low`;
|
|
1085
|
-
case "critical":
|
|
1086
|
-
return tailwindStyledComponents.tws `tu-indicator--critical`;
|
|
1087
|
-
case "working":
|
|
1088
|
-
return tailwindStyledComponents.tws `tu-indicator--working`;
|
|
1089
|
-
case "idle":
|
|
1090
|
-
return tailwindStyledComponents.tws `tu-indicator--idle`;
|
|
1091
|
-
case "stopped":
|
|
1092
|
-
return tailwindStyledComponents.tws `tu-indicator--stopped`;
|
|
1093
|
-
case "moving":
|
|
1094
|
-
return tailwindStyledComponents.tws `tu-indicator--moving`;
|
|
1095
|
-
case "unknown":
|
|
1096
|
-
return tailwindStyledComponents.tws `tu-indicator--unknown`;
|
|
1097
|
-
case "unused":
|
|
1098
|
-
return tailwindStyledComponents.tws `tu-indicator--unused`;
|
|
1099
|
-
case "utilized":
|
|
1100
|
-
return tailwindStyledComponents.tws `tu-indicator--utilized`;
|
|
1101
|
-
case "heavily_utilized":
|
|
1102
|
-
return tailwindStyledComponents.tws `tu-indicator--heavily-utilized`;
|
|
1103
|
-
case "on_rent":
|
|
1104
|
-
return tailwindStyledComponents.tws `tu-indicator--on-rent`;
|
|
1105
|
-
case "available":
|
|
1106
|
-
return tailwindStyledComponents.tws `tu-indicator--available`;
|
|
1107
|
-
case "pickup_ready":
|
|
1108
|
-
return tailwindStyledComponents.tws `tu-indicator--pickup-ready`;
|
|
1109
|
-
case "transfer":
|
|
1110
|
-
return tailwindStyledComponents.tws `tu-indicator--transfer`;
|
|
1111
|
-
case "in_repair":
|
|
1112
|
-
return tailwindStyledComponents.tws `tu-indicator--in-repair`;
|
|
1113
|
-
case "returned":
|
|
1114
|
-
return tailwindStyledComponents.tws `tu-indicator--returned`;
|
|
1115
|
-
case "other_rental_status":
|
|
1116
|
-
return tailwindStyledComponents.tws `tu-indicator--other-rental-status`;
|
|
1117
|
-
default:
|
|
1118
|
-
return "";
|
|
1119
|
-
}
|
|
1120
|
-
}}
|
|
1121
|
-
`;
|
|
1122
|
-
const IconBackground = tailwindStyledComponents.tw.div `
|
|
1123
|
-
tu-indicator__icon-background
|
|
1124
|
-
|
|
1125
|
-
${({ $withBackground }) => {
|
|
1126
|
-
return $withBackground ? "" : "tu-indicator__icon-background--none";
|
|
1127
|
-
}}
|
|
1128
|
-
`;
|
|
1129
|
-
const Label$1 = tailwindStyledComponents.tw.div `
|
|
1130
|
-
tu-indicator__label
|
|
1131
|
-
`;
|
|
1132
|
-
const Ping = tailwindStyledComponents.tw.span `
|
|
1133
|
-
tu-indicator__ping
|
|
1134
|
-
`;
|
|
1306
|
+
var { dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, className } = _a, rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground", "withLabel", "ping", "className"]);
|
|
1307
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: cvaIndicator({ className }), "data-testid": dataTestId }, rest, { title: !withLabel ? label : undefined }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background" }, { children: [ping && (jsxRuntime.jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" })), icon] })), label !== undefined && withLabel && (jsxRuntime.jsx("div", Object.assign({ className: cvaIndicatorLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label" }, { children: label })))] })));
|
|
1308
|
+
};
|
|
1135
1309
|
|
|
1136
1310
|
/**
|
|
1137
1311
|
* The MenuItem component is used to display a menu, primarily meant to be used in a list form.
|
|
@@ -1515,11 +1689,11 @@ const MoreMenu = ({ className, dataTestId, menuPlacement, iconProps = {
|
|
|
1515
1689
|
useClickOutside(actionMenuRef, () => {
|
|
1516
1690
|
setActionMenuIsOpen(false);
|
|
1517
1691
|
});
|
|
1518
|
-
return (jsxRuntime.jsx(Root
|
|
1692
|
+
return (jsxRuntime.jsx(Root, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxRuntime.jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : (jsxRuntime.jsx(IconButton, Object.assign({}, iconButtonProps, { icon: iconProps.name ? jsxRuntime.jsx(Icon, Object.assign({}, iconProps, { name: iconProps.name })) : null, onClick: () => {
|
|
1519
1693
|
setActionMenuIsOpen(!actionMenuIsOpen);
|
|
1520
1694
|
} }))) }), jsxRuntime.jsx(PopoverContent, { children: close => (typeof children === "function" ? children(close) : children) })] })) })));
|
|
1521
1695
|
};
|
|
1522
|
-
const Root
|
|
1696
|
+
const Root = tailwindStyledComponents.tw.div `
|
|
1523
1697
|
tu-more-menu
|
|
1524
1698
|
${({ variant }) => (variant === "primary" ? tailwindStyledComponents.tws `tu-more-menu--primary` : "")}
|
|
1525
1699
|
`;
|
|
@@ -1598,6 +1772,63 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
1598
1772
|
};
|
|
1599
1773
|
};
|
|
1600
1774
|
|
|
1775
|
+
const cvaTag = cssClassVarianceUtilities.cvaMerge([
|
|
1776
|
+
"inline-flex",
|
|
1777
|
+
"justify-center",
|
|
1778
|
+
"items-center",
|
|
1779
|
+
"rounded-full",
|
|
1780
|
+
"py-1",
|
|
1781
|
+
"px-2",
|
|
1782
|
+
"text-center",
|
|
1783
|
+
"whitespace-nowrap",
|
|
1784
|
+
"h-min",
|
|
1785
|
+
"min-w-[1.5rem]",
|
|
1786
|
+
"font-medium",
|
|
1787
|
+
"truncate",
|
|
1788
|
+
"max-w-full",
|
|
1789
|
+
"w-min",
|
|
1790
|
+
"text-xs",
|
|
1791
|
+
], {
|
|
1792
|
+
variants: {
|
|
1793
|
+
size: {
|
|
1794
|
+
small: "px-2 py-px",
|
|
1795
|
+
medium: "",
|
|
1796
|
+
},
|
|
1797
|
+
layout: {
|
|
1798
|
+
withIcon: "pr-1 gap-2",
|
|
1799
|
+
default: "",
|
|
1800
|
+
},
|
|
1801
|
+
color: {
|
|
1802
|
+
primary: "bg-primary-100 text-primary-700",
|
|
1803
|
+
secondary: "bg-secondary-100 text-secondary-700",
|
|
1804
|
+
accent: "bg-accent-100 text-accent-700",
|
|
1805
|
+
neutral: "bg-neutral-100 text-neutral-700",
|
|
1806
|
+
black: "bg-neutral-100 text-neutral-700",
|
|
1807
|
+
white: "bg-white-100 text-white-700",
|
|
1808
|
+
info: "bg-info-100 text-info-700",
|
|
1809
|
+
success: "bg-success-100 text-success-700",
|
|
1810
|
+
warning: "bg-warning-100 text-warning-700",
|
|
1811
|
+
danger: "bg-danger-100 text-danger-700",
|
|
1812
|
+
good: "bg-good-100 text-good-700",
|
|
1813
|
+
low: "bg-low-100 text-low-700",
|
|
1814
|
+
critical: "bg-critical-100 text-critical-700",
|
|
1815
|
+
working: "bg-working-100 text-working-700",
|
|
1816
|
+
stopped: "bg-stopped-100 text-stopped-700",
|
|
1817
|
+
idle: "bg-idle-100 text-idle-700",
|
|
1818
|
+
unknown: "bg-unknown-100 text-unknown-700",
|
|
1819
|
+
moving: "bg-neutral-100 text-neutral-700",
|
|
1820
|
+
active: "bg-neutral-100 text-neutral-700",
|
|
1821
|
+
},
|
|
1822
|
+
},
|
|
1823
|
+
defaultVariants: {
|
|
1824
|
+
size: "medium",
|
|
1825
|
+
layout: "default",
|
|
1826
|
+
color: "primary",
|
|
1827
|
+
},
|
|
1828
|
+
});
|
|
1829
|
+
const cvaTagIconContainer = cssClassVarianceUtilities.cvaMerge(["inline-flex", "self-center"]);
|
|
1830
|
+
const cvaTagIcon = cssClassVarianceUtilities.cvaMerge(["cursor-pointer", "transition-opacity", "hover:opacity-70"]);
|
|
1831
|
+
|
|
1601
1832
|
/**
|
|
1602
1833
|
* The tag component is used to categorize elements in the ui.
|
|
1603
1834
|
*
|
|
@@ -1612,71 +1843,23 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
1612
1843
|
*/
|
|
1613
1844
|
const Tag = React__namespace.forwardRef((_a, ref) => {
|
|
1614
1845
|
var { className, dataTestId, children, size = "medium", onClose, color = "primary" } = _a; __rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color"]);
|
|
1615
|
-
return (jsxRuntime.jsxs(
|
|
1846
|
+
return (jsxRuntime.jsxs("span", Object.assign({ className: cvaTag({ className, size, color, layout: Boolean(onClose) ? "withIcon" : "default" }), "data-testid": dataTestId && `${dataTestId}-tag`, ref: ref }, { children: [children, Boolean(onClose) && (
|
|
1616
1847
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
1617
|
-
jsxRuntime.jsx(
|
|
1618
|
-
});
|
|
1619
|
-
const getSizeModifierClass = () => ({ $size, $withXIcon }) => {
|
|
1620
|
-
const tagSizeModifierClass = {
|
|
1621
|
-
medium: $withXIcon ? tailwindStyledComponents.tws `tu-tag--with-icon ` : tailwindStyledComponents.tws ` `,
|
|
1622
|
-
small: $withXIcon ? tailwindStyledComponents.tws `tu-tag--small tu-tag--with-icon` : tailwindStyledComponents.tws `tu-tag--small`,
|
|
1623
|
-
};
|
|
1624
|
-
return tagSizeModifierClass[$size];
|
|
1625
|
-
};
|
|
1626
|
-
const getColorModifierClass = () => ({ $color }) => {
|
|
1627
|
-
const colorClasses = {
|
|
1628
|
-
primary: tailwindStyledComponents.tws `tu-tag--primary`,
|
|
1629
|
-
secondary: tailwindStyledComponents.tws `tu-tag--secondary`,
|
|
1630
|
-
accent: tailwindStyledComponents.tws `tu-tag--accent`,
|
|
1631
|
-
success: tailwindStyledComponents.tws `tu-tag--success`,
|
|
1632
|
-
danger: tailwindStyledComponents.tws `tu-tag--danger`,
|
|
1633
|
-
warning: tailwindStyledComponents.tws `tu-tag--warning`,
|
|
1634
|
-
info: tailwindStyledComponents.tws `tu-tag--info`,
|
|
1635
|
-
neutral: tailwindStyledComponents.tws `tu-tag--neutral`,
|
|
1636
|
-
good: tailwindStyledComponents.tws `tu-tag--good`,
|
|
1637
|
-
low: tailwindStyledComponents.tws `tu-tag--low`,
|
|
1638
|
-
critical: tailwindStyledComponents.tws `tu-tag--critical`,
|
|
1639
|
-
working: tailwindStyledComponents.tws `tu-tag--working`,
|
|
1640
|
-
idle: tailwindStyledComponents.tws `tu-tag--idle`,
|
|
1641
|
-
stopped: tailwindStyledComponents.tws `tu-tag--stopped`,
|
|
1642
|
-
unknown: tailwindStyledComponents.tws `tu-tag--unknown`,
|
|
1643
|
-
};
|
|
1644
|
-
return colorClasses[$color];
|
|
1645
|
-
};
|
|
1646
|
-
const StyledText = tailwindStyledComponents.tw.span `
|
|
1647
|
-
tu-tag
|
|
1648
|
-
${getSizeModifierClass()}
|
|
1649
|
-
${getColorModifierClass()}
|
|
1650
|
-
`;
|
|
1651
|
-
const IconContainer = tailwindStyledComponents.tw.div `
|
|
1652
|
-
tu-tag__icon-container
|
|
1653
|
-
`;
|
|
1848
|
+
jsxRuntime.jsx("div", Object.assign({ className: cvaTagIconContainer(), onMouseDown: onClose }, { children: jsxRuntime.jsx(Icon, { name: "XCircleIcon", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) })))] })));
|
|
1849
|
+
});
|
|
1654
1850
|
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
return (jsxRuntime.jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
|
|
1668
|
-
};
|
|
1669
|
-
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxRuntime.jsxs(StyledPopover, Object.assign({ className: "tu-tooltip__container", placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "" }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: children }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx(Content, Object.assign({ "$mode": mode }, { children: jsxRuntime.jsx(Text$1, Object.assign({ inverted: mode === "dark", type: contentTextType }, { children: label })) })) })] })));
|
|
1670
|
-
const Flex = tailwindStyledComponents.tw.div `
|
|
1671
|
-
inline-flex
|
|
1672
|
-
`;
|
|
1673
|
-
const StyledPopover = tailwindStyledComponents.twx(Popover) `
|
|
1674
|
-
tu-tooltip__container
|
|
1675
|
-
`;
|
|
1676
|
-
const Content = tailwindStyledComponents.tw.div `
|
|
1677
|
-
tu-tooltip__content
|
|
1678
|
-
${p => (p.$mode === "light" ? tailwindStyledComponents.tws `tu-tooltip--light` : null)}
|
|
1679
|
-
`;
|
|
1851
|
+
const cvaTip = cssClassVarianceUtilities.cvaMerge("flex transition text-slate-300 hover:text-slate-500");
|
|
1852
|
+
const cvaTipContent = cssClassVarianceUtilities.cvaMerge("p-2 rounded max-w-sm flex gap-2 items-center text-sm", {
|
|
1853
|
+
variants: {
|
|
1854
|
+
color: {
|
|
1855
|
+
light: "shadow-md bg-white",
|
|
1856
|
+
dark: "text-white bg-neutral-800",
|
|
1857
|
+
},
|
|
1858
|
+
},
|
|
1859
|
+
defaultVariants: {
|
|
1860
|
+
color: "light",
|
|
1861
|
+
},
|
|
1862
|
+
});
|
|
1680
1863
|
|
|
1681
1864
|
/**
|
|
1682
1865
|
* The Tip component is used to show helpful tips or contextual information to the users.
|
|
@@ -1685,13 +1868,35 @@ const Content = tailwindStyledComponents.tw.div `
|
|
|
1685
1868
|
* @param {TipProps} props - The props for the Tip component
|
|
1686
1869
|
* @returns {JSX.Element} Tip component
|
|
1687
1870
|
*/
|
|
1688
|
-
const Tip = ({ children, iconProps, dataTestId,
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
const
|
|
1693
|
-
|
|
1694
|
-
|
|
1871
|
+
const Tip = ({ children, iconProps, dataTestId, className, placement = "bottom", mode = "dark", link, }) => {
|
|
1872
|
+
return (jsxRuntime.jsx("span", Object.assign({ "data-testid": dataTestId, className: cvaTip({ className }) }, { children: jsxRuntime.jsxs(Popover, Object.assign({ placement: placement, activation: { click: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "" }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx("div", Object.assign({ "data-testid": dataTestId && `${dataTestId}-trigger` }, { children: jsxRuntime.jsx(Icon, Object.assign({ name: "QuestionMarkCircleIcon", size: "medium", dataTestId: dataTestId && `${dataTestId}-icon` }, iconProps)) })) }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaTipContent({ color: mode }) }, { children: [jsxRuntime.jsx("div", { children: typeof children === "string" ? jsxRuntime.jsx("p", { children: children }) : children }), link ? (jsxRuntime.jsx("a", Object.assign({ href: link }, { children: jsxRuntime.jsx(Icon, { name: "ArrowRightCircleIcon" }) }))) : null] })) })] })) })));
|
|
1873
|
+
};
|
|
1874
|
+
|
|
1875
|
+
const cvaPageHeader = cssClassVarianceUtilities.cvaMerge([
|
|
1876
|
+
"min-h-[72px]",
|
|
1877
|
+
"box-border",
|
|
1878
|
+
"bg-white",
|
|
1879
|
+
"px-6",
|
|
1880
|
+
"py-5",
|
|
1881
|
+
"flex",
|
|
1882
|
+
"flex-wrap",
|
|
1883
|
+
"items-center",
|
|
1884
|
+
"gap-x-4",
|
|
1885
|
+
"gap-y-1",
|
|
1886
|
+
"justify-between",
|
|
1887
|
+
"border-b",
|
|
1888
|
+
"border-b-secondary-200",
|
|
1889
|
+
]);
|
|
1890
|
+
const cvaPageHeaderHeading = cssClassVarianceUtilities.cvaMerge(["flex", "text-slate-900", "text-2xl", "font-bold", "min-w-0"]);
|
|
1891
|
+
const cvaPageHeaderHeadingContainer = cssClassVarianceUtilities.cvaMerge(["flex", "gap-x-4", "items-center"]);
|
|
1892
|
+
const cvaPageHeaderHeadingAccessoriesContainer = cssClassVarianceUtilities.cvaMerge([
|
|
1893
|
+
"flex",
|
|
1894
|
+
"flex-wrap",
|
|
1895
|
+
"items-center",
|
|
1896
|
+
"gap-x-4",
|
|
1897
|
+
"gap-y-2",
|
|
1898
|
+
]);
|
|
1899
|
+
const cvaPageHeaderChildContainer = cssClassVarianceUtilities.cvaMerge(["flex", "flex-wrap", "gap-x-6", "items-center"]);
|
|
1695
1900
|
|
|
1696
1901
|
/**
|
|
1697
1902
|
* Pageheader component is used to display a page header.
|
|
@@ -1702,39 +1907,21 @@ const TipContainer = tailwindStyledComponents.tw.text `
|
|
|
1702
1907
|
* @returns {JSX.Element} PageHeader component
|
|
1703
1908
|
*/
|
|
1704
1909
|
const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, children, }) => {
|
|
1705
|
-
return (jsxRuntime.jsxs(
|
|
1706
|
-
};
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
const StyledPageHeader = tailwindStyledComponents.tw.div `
|
|
1721
|
-
tu-page-header
|
|
1722
|
-
`;
|
|
1723
|
-
const HeadingAndAccessoriesContainer = tailwindStyledComponents.tw.div `
|
|
1724
|
-
tu-page-header__heading-accessories-container
|
|
1725
|
-
`;
|
|
1726
|
-
const HeadingContainer = tailwindStyledComponents.tw.div `
|
|
1727
|
-
tu-page-header__heading-container
|
|
1728
|
-
`;
|
|
1729
|
-
const Heading = tailwindStyledComponents.tw.h1 `
|
|
1730
|
-
tu-page-header__heading
|
|
1731
|
-
`;
|
|
1732
|
-
const ChildContainer$1 = tailwindStyledComponents.tw.div `
|
|
1733
|
-
tu-page-header__child-container
|
|
1734
|
-
`;
|
|
1735
|
-
const StyledTip = tailwindStyledComponents.twx(Tip) `
|
|
1736
|
-
${p => (p.link ? tailwindStyledComponents.tws `tu-page-header__tip` : null)}
|
|
1737
|
-
`;
|
|
1910
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container` }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: cvaPageHeaderHeadingContainer() }, { children: [backTo && (jsxRuntime.jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsxRuntime.jsx(Icon, { name: "ArrowLeftIcon" }) })), jsxRuntime.jsx("h1", Object.assign({ className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading` }, { children: title })), description && !showLoading && (jsxRuntime.jsx(Tip, Object.assign({ dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircleIcon" }, link: link }, { children: description })))] })), tag && !showLoading && jsxRuntime.jsx(Tag, Object.assign({ dataTestId: dataTestId }, { children: tag })), showLoading && jsxRuntime.jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] })), jsxRuntime.jsx("div", Object.assign({ className: cvaPageHeaderChildContainer() }, { children: children }))] })));
|
|
1911
|
+
};
|
|
1912
|
+
|
|
1913
|
+
const cvaSkeletonLine = cssClassVarianceUtilities.cvaMerge([
|
|
1914
|
+
"rounded-md",
|
|
1915
|
+
"h-3",
|
|
1916
|
+
"opacity-20",
|
|
1917
|
+
"animate-pulse",
|
|
1918
|
+
"bg-black/50",
|
|
1919
|
+
"bg-auto",
|
|
1920
|
+
"bg-gradient-to-r",
|
|
1921
|
+
"from-black/0",
|
|
1922
|
+
"via-black/50",
|
|
1923
|
+
"to-black/20",
|
|
1924
|
+
]);
|
|
1738
1925
|
|
|
1739
1926
|
/**
|
|
1740
1927
|
* Display placeholder lines before the data gets loaded to reduce load-time frustration.
|
|
@@ -1754,14 +1941,14 @@ const SkeletonLines = React.memo(({ margin = "10px 0", lines = 1, height, width
|
|
|
1754
1941
|
return height;
|
|
1755
1942
|
};
|
|
1756
1943
|
for (let i = 0; i < lines; i++) {
|
|
1757
|
-
skeletonLines.push(jsxRuntime.jsx(
|
|
1944
|
+
skeletonLines.push(jsxRuntime.jsx("div", Object.assign({ "data-testid": dataTestId !== null && dataTestId !== void 0 ? dataTestId : "skeleton-lines", "data-type": "loading-skeleton-line", className: cvaSkeletonLine({ className }), style: { height: getHeight(i), width: getWidth(i), margin: lines > 1 ? margin : "" } }, { children: lines > 1 && jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u00A0" }) }), i));
|
|
1758
1945
|
}
|
|
1759
1946
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
1760
1947
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: skeletonLines });
|
|
1761
|
-
});
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1948
|
+
});
|
|
1949
|
+
|
|
1950
|
+
const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
|
|
1951
|
+
const cvaPaginationText = cssClassVarianceUtilities.cvaMerge("whitespace-nowrap");
|
|
1765
1952
|
|
|
1766
1953
|
/**
|
|
1767
1954
|
* Pagination Description. It could be used when you need navigation for your paging feature.
|
|
@@ -1804,18 +1991,12 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
1804
1991
|
onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange({ from, to, description });
|
|
1805
1992
|
}, [page, onPageChange, previousPage, nextPage]);
|
|
1806
1993
|
if (loading) {
|
|
1807
|
-
return (jsxRuntime.jsx(
|
|
1994
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: cvaPagination({ className }) }, { children: jsxRuntime.jsx(SkeletonLines, { height: 16, width: 150 }) })));
|
|
1808
1995
|
}
|
|
1809
|
-
return (jsxRuntime.jsxs(
|
|
1996
|
+
return (jsxRuntime.jsxs("div", Object.assign({ "data-testid": dataTestId, className: cvaPagination({ 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("div", Object.assign({ className: cvaPaginationText(), "data-testid": "current-page" }, { children: currentPage })), jsxRuntime.jsx("div", Object.assign({ className: cvaPaginationText(), "data-testid": "page-count" }, { children: pageCount !== null && pageCount !== undefined && getTranslatedCount && getTranslatedCount(pageCount) }))] })), jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("next"), disabled: cursorBase
|
|
1810
1997
|
? !canNextPage || false
|
|
1811
1998
|
: 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" })] })));
|
|
1812
|
-
};
|
|
1813
|
-
const Root$2 = tailwindStyledComponents.tw.div `
|
|
1814
|
-
tu-pagination
|
|
1815
|
-
`;
|
|
1816
|
-
const TextStyled = tailwindStyledComponents.twx(Text$1) `
|
|
1817
|
-
tu-pagination__text
|
|
1818
|
-
`;
|
|
1999
|
+
};
|
|
1819
2000
|
|
|
1820
2001
|
function useConfirmExit(confirmExit, when = true) {
|
|
1821
2002
|
const { navigator } = React.useContext(reactRouterDom.UNSAFE_NavigationContext);
|
|
@@ -1870,29 +2051,33 @@ const Prompt = ({ when, message }) => {
|
|
|
1870
2051
|
return null;
|
|
1871
2052
|
};
|
|
1872
2053
|
|
|
2054
|
+
const cvaSpacer = cssClassVarianceUtilities.cvaMerge([], {
|
|
2055
|
+
variants: {
|
|
2056
|
+
border: {
|
|
2057
|
+
true: ["border-t", "border-solid", "border-neutral-100", "min-h-[1px]"],
|
|
2058
|
+
false: "",
|
|
2059
|
+
},
|
|
2060
|
+
size: {
|
|
2061
|
+
small: "min-h-[8px]",
|
|
2062
|
+
medium: "min-h-[20px]",
|
|
2063
|
+
large: "min-h-[32px]",
|
|
2064
|
+
},
|
|
2065
|
+
},
|
|
2066
|
+
defaultVariants: {
|
|
2067
|
+
border: false,
|
|
2068
|
+
size: "medium",
|
|
2069
|
+
},
|
|
2070
|
+
});
|
|
2071
|
+
|
|
1873
2072
|
/**
|
|
1874
2073
|
* The Spacer component is used for adding a bit of space in the ui.
|
|
1875
2074
|
*
|
|
1876
2075
|
* @param {SpacerProps} props - The props for the Spacer component
|
|
1877
2076
|
* @returns {JSX.Element} Spacer component
|
|
1878
2077
|
*/
|
|
1879
|
-
const Spacer = ({
|
|
1880
|
-
return jsxRuntime.jsx(
|
|
1881
|
-
};
|
|
1882
|
-
const GetSpacerHeight = () => ({ $minHeight }) => {
|
|
1883
|
-
switch ($minHeight) {
|
|
1884
|
-
case "normal":
|
|
1885
|
-
return tailwindStyledComponents.tws `tu-spacer--normal`;
|
|
1886
|
-
case "large":
|
|
1887
|
-
return tailwindStyledComponents.tws `tu-spacer--large`;
|
|
1888
|
-
default:
|
|
1889
|
-
return "";
|
|
1890
|
-
}
|
|
1891
|
-
};
|
|
1892
|
-
const Space = tailwindStyledComponents.tw.div `
|
|
1893
|
-
${p => `${p.$border ? `tu-spacer--border` : null}`}
|
|
1894
|
-
${GetSpacerHeight()}
|
|
1895
|
-
`;
|
|
2078
|
+
const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
|
|
2079
|
+
return jsxRuntime.jsx("div", { "data-testid": dataTestId, className: cvaSpacer({ className, border, size }) });
|
|
2080
|
+
};
|
|
1896
2081
|
|
|
1897
2082
|
/**
|
|
1898
2083
|
* The SectionHeader component is used on sections to set the section title.
|
|
@@ -1901,10 +2086,9 @@ const Space = tailwindStyledComponents.tw.div `
|
|
|
1901
2086
|
* @returns {JSX.Element} SectionHeader component
|
|
1902
2087
|
*/
|
|
1903
2088
|
const SectionHeader = ({ title, subtitle, dataTestId, addons }) => {
|
|
1904
|
-
return (jsxRuntime.jsxs(SectionHeaderContainer, { children: [jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(reactHelmetAsync.Helmet, { title: title }) }), jsxRuntime.jsxs(StyledFlex, Object.assign({ className: "flex-row mb-2" }, { children: [jsxRuntime.jsxs(StyledFlex, Object.assign({ className: "flex-col grow" }, { children: [jsxRuntime.jsx(Heading
|
|
2089
|
+
return (jsxRuntime.jsxs(SectionHeaderContainer, { children: [jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(reactHelmetAsync.Helmet, { title: title }) }), jsxRuntime.jsxs(StyledFlex, Object.assign({ className: "flex-row mb-2" }, { children: [jsxRuntime.jsxs(StyledFlex, Object.assign({ className: "flex-col grow" }, { children: [jsxRuntime.jsx(Heading, Object.assign({ variant: "secondary", dataTestId: dataTestId }, { children: title })), subtitle && (jsxRuntime.jsx(Heading, Object.assign({ variant: "subtitle", subtle: true }, { children: subtitle })))] })), addons && jsxRuntime.jsx(StyledFlex, { children: addons })] })), jsxRuntime.jsx(Spacer, { size: "small" })] }));
|
|
1905
2090
|
};
|
|
1906
2091
|
const SectionHeaderContainer = tailwindStyledComponents.tw.div `
|
|
1907
|
-
tu-section-header
|
|
1908
2092
|
flex
|
|
1909
2093
|
flex-col
|
|
1910
2094
|
`;
|
|
@@ -1913,6 +2097,21 @@ const StyledFlex = tailwindStyledComponents.tw.div `
|
|
|
1913
2097
|
gap-2
|
|
1914
2098
|
`;
|
|
1915
2099
|
|
|
2100
|
+
const cvaSidebar = cssClassVarianceUtilities.cvaMerge(["apply grid", "grid-cols-fr-min", "items-center"]);
|
|
2101
|
+
const cvaSidebarChildContainer = cssClassVarianceUtilities.cvaMerge(["apply flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
|
|
2102
|
+
variants: {
|
|
2103
|
+
breakpoint: {
|
|
2104
|
+
xs: ["xs:overflow-visible", "xs:p-0", "xs:grid", "xs:grid-cols-1", "xs:w-full"],
|
|
2105
|
+
sm: ["sm:overflow-visible", "sm:p-0", "sm:grid", "sm:grid-cols-1", "sm:w-full"],
|
|
2106
|
+
md: ["md:overflow-visible", "md:p-0", "md:grid", "md:grid-cols-1", "md:w-full"],
|
|
2107
|
+
lg: ["lg:overflow-visible", "lg:p-0", "lg:grid", "lg:grid-cols-1", "lg:w-full"],
|
|
2108
|
+
xl: ["xl:overflow-visible", "xl:p-0", "xl:grid", "xl:grid-cols-1", "xl:w-full"],
|
|
2109
|
+
"2xl": ["2xl:overflow-visible", "2xl:p-0", "2xl:grid", "2xl:grid-cols-1", "2xl:w-full"],
|
|
2110
|
+
"3xl": ["3xl:overflow-visible", "3xl:p-0", "3xl:grid", "3xl:grid-cols-1", "3xl:w-full"],
|
|
2111
|
+
},
|
|
2112
|
+
},
|
|
2113
|
+
});
|
|
2114
|
+
|
|
1916
2115
|
/**
|
|
1917
2116
|
* A hook used to detect what children are overflowing a container.
|
|
1918
2117
|
*
|
|
@@ -1989,7 +2188,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
1989
2188
|
}
|
|
1990
2189
|
return tailwindStyledComponents.tws `visible`;
|
|
1991
2190
|
};
|
|
1992
|
-
return (jsxRuntime.jsxs(
|
|
2191
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: cvaSidebar({ className }), "data-testid": dataTestId }, { children: [jsxRuntime.jsx("div", Object.assign({ ref: overflowContainerRef, className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": dataTestId && `${dataTestId}-child-container` }, { children: React__default["default"].Children.map(children, child => {
|
|
1993
2192
|
return React__default["default"].cloneElement(child, {
|
|
1994
2193
|
className: `${child.props.className} ${itemVisibilityClassName(child.props.id)}`,
|
|
1995
2194
|
});
|
|
@@ -2008,23 +2207,20 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2008
2207
|
})
|
|
2009
2208
|
: null;
|
|
2010
2209
|
}) }))) }))) : null] })));
|
|
2011
|
-
};
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
"
|
|
2022
|
-
"
|
|
2023
|
-
|
|
2024
|
-
const
|
|
2025
|
-
tu-sidebar__child-container
|
|
2026
|
-
${({ $breakpoint }) => breakpointClasses[$breakpoint]}
|
|
2027
|
-
`;
|
|
2210
|
+
};
|
|
2211
|
+
|
|
2212
|
+
const cvaTimeline = cssClassVarianceUtilities.cvaMerge("ml-4");
|
|
2213
|
+
const cvaTimelineElement = cssClassVarianceUtilities.cvaMerge([
|
|
2214
|
+
"grid",
|
|
2215
|
+
"grid-cols-[min-content_auto]",
|
|
2216
|
+
"grid-rows-[auto_auto]",
|
|
2217
|
+
"items-start",
|
|
2218
|
+
"border-l-[8px]",
|
|
2219
|
+
"border-gray-100",
|
|
2220
|
+
"pb-4",
|
|
2221
|
+
"last:border-transparent",
|
|
2222
|
+
]);
|
|
2223
|
+
const cvaTimelineDot = cssClassVarianceUtilities.cvaMerge(["flex", "space-x-4", "items-start", "ml-[calc(-50%-8px)]"]);
|
|
2028
2224
|
|
|
2029
2225
|
/**
|
|
2030
2226
|
* Timeline - used to contain TimelineElements for building a sequence of timed entries - each rendered on a line
|
|
@@ -2036,7 +2232,7 @@ const ChildContainer = tailwindStyledComponents.tw.div `
|
|
|
2036
2232
|
* @returns {JSX.Element} Timeline component
|
|
2037
2233
|
*/
|
|
2038
2234
|
const Timeline = ({ className, dataTestId, children }) => {
|
|
2039
|
-
return (jsxRuntime.jsx("ol", Object.assign({ className:
|
|
2235
|
+
return (jsxRuntime.jsx("ol", Object.assign({ className: cvaTimeline({ className }), "data-testid": dataTestId }, { children: children })));
|
|
2040
2236
|
};
|
|
2041
2237
|
/**
|
|
2042
2238
|
* TimelineElement - entry on a timeline - rendered with an icon on the timeline
|
|
@@ -2046,8 +2242,7 @@ const Timeline = ({ className, dataTestId, children }) => {
|
|
|
2046
2242
|
* @returns {JSX.Element} component
|
|
2047
2243
|
*/
|
|
2048
2244
|
const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", headerClassName, dot = jsxRuntime.jsx(Indicator, { className: tailwindStyledComponents.tws `mt-[-1px]`, color: "neutral", icon: jsxRuntime.jsx(Icon, { name: "CalendarIcon", size: "large" }) }), header = defaultHeader(date, showTime), onClick, }) => {
|
|
2049
|
-
|
|
2050
|
-
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", Object.assign({ className: headerClassName }, { children: header })), jsxRuntime.jsx("div", {}), jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { children: children }) })] })));
|
|
2245
|
+
return (jsxRuntime.jsxs("li", Object.assign({ className: cvaTimelineElement({ className }), "data-date": `${date}`, "data-testid": dataTestId && `${dataTestId}`, onClick: () => onClick && onClick() }, { children: [jsxRuntime.jsx("div", Object.assign({ className: cvaTimelineDot() }, { children: dot })), jsxRuntime.jsx("div", { children: header }), jsxRuntime.jsx("div", {}), jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { children: children }) })] })));
|
|
2051
2246
|
};
|
|
2052
2247
|
function defaultHeader(date, showTime) {
|
|
2053
2248
|
return `${dateFns.format(date, showTime ? "MMM d, yyyy H:mm" : "MMM d, yyyy")} (${dateFns.formatDistance(date, new Date(), {
|
|
@@ -2055,6 +2250,71 @@ function defaultHeader(date, showTime) {
|
|
|
2055
2250
|
})})`;
|
|
2056
2251
|
}
|
|
2057
2252
|
|
|
2253
|
+
const cvaTooltipFlexContainer = cssClassVarianceUtilities.cvaMerge("inline-flex");
|
|
2254
|
+
const cvaTooltipPopover = cssClassVarianceUtilities.cvaMerge("pointer-events-none origin-center");
|
|
2255
|
+
cssClassVarianceUtilities.cvaMerge("pointer-events-none origin-center");
|
|
2256
|
+
const cvaTooltipContent = cssClassVarianceUtilities.cvaMerge("p-2 rounded max-w-sm", {
|
|
2257
|
+
variants: {
|
|
2258
|
+
color: {
|
|
2259
|
+
light: "shadow-md bg-white",
|
|
2260
|
+
dark: "text-white bg-neutral-800",
|
|
2261
|
+
},
|
|
2262
|
+
},
|
|
2263
|
+
defaultVariants: {
|
|
2264
|
+
color: "light",
|
|
2265
|
+
},
|
|
2266
|
+
});
|
|
2267
|
+
|
|
2268
|
+
/**
|
|
2269
|
+
* The Tooltip component is used to show helpful tips or contextual information to the users.
|
|
2270
|
+
*
|
|
2271
|
+
* @param {TooltipProps} props - The props for the Tooltip component
|
|
2272
|
+
* @returns {JSX.Element} Tooltip component
|
|
2273
|
+
*/
|
|
2274
|
+
const Tooltip = (_a) => {
|
|
2275
|
+
var { children, dataTestId, disabled, className } = _a, rest = __rest(_a, ["children", "dataTestId", "disabled", "className"]);
|
|
2276
|
+
const wrappedChildren = (jsxRuntime.jsx("div", Object.assign({ className: cvaTooltipFlexContainer({ className }), "data-testid": dataTestId && `${dataTestId}-parent` }, { children: children })));
|
|
2277
|
+
if (disabled) {
|
|
2278
|
+
return wrappedChildren;
|
|
2279
|
+
}
|
|
2280
|
+
return (jsxRuntime.jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
|
|
2281
|
+
};
|
|
2282
|
+
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxRuntime.jsxs(Popover, Object.assign({ className: cvaTooltipPopover(), placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "" }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: children }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx("div", Object.assign({ className: cvaTooltipContent({ color: mode }) }, { children: jsxRuntime.jsx(Text, Object.assign({ inverted: mode === "dark", type: contentTextType }, { children: label })) })) })] })));
|
|
2283
|
+
|
|
2284
|
+
const cvaValueBar = cssClassVarianceUtilities.cvaMerge(["w-full"], {
|
|
2285
|
+
variants: {
|
|
2286
|
+
size: {
|
|
2287
|
+
small: "h-3",
|
|
2288
|
+
large: "h-9",
|
|
2289
|
+
},
|
|
2290
|
+
},
|
|
2291
|
+
defaultVariants: {
|
|
2292
|
+
size: "small",
|
|
2293
|
+
},
|
|
2294
|
+
});
|
|
2295
|
+
const cvaValueBarProgress = cssClassVarianceUtilities.cvaMerge(["h-full", "rounded"], {
|
|
2296
|
+
variants: {
|
|
2297
|
+
fill: {
|
|
2298
|
+
default: "",
|
|
2299
|
+
background: "fill-slate-100",
|
|
2300
|
+
},
|
|
2301
|
+
},
|
|
2302
|
+
defaultVariants: {
|
|
2303
|
+
fill: "default",
|
|
2304
|
+
},
|
|
2305
|
+
});
|
|
2306
|
+
const cvaValueBarText = cssClassVarianceUtilities.cvaMerge([], {
|
|
2307
|
+
variants: {
|
|
2308
|
+
size: {
|
|
2309
|
+
small: "font-bold text-sm",
|
|
2310
|
+
large: "drop-shadow-lg",
|
|
2311
|
+
},
|
|
2312
|
+
},
|
|
2313
|
+
defaultVariants: {
|
|
2314
|
+
size: "small",
|
|
2315
|
+
},
|
|
2316
|
+
});
|
|
2317
|
+
|
|
2058
2318
|
/**
|
|
2059
2319
|
* Helper function to get normalized score in range 0-1 used by the ValueBar
|
|
2060
2320
|
*
|
|
@@ -2128,22 +2388,8 @@ const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors
|
|
|
2128
2388
|
const score = getScore(value, min, max);
|
|
2129
2389
|
const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
|
|
2130
2390
|
const barWidth = showValue && size === "small" ? 90 : 100;
|
|
2131
|
-
return (jsxRuntime.jsx(
|
|
2132
|
-
};
|
|
2133
|
-
const Root = tailwindStyledComponents.tw.svg `
|
|
2134
|
-
tu-value-bar
|
|
2135
|
-
${({ $size }) => ($size === "small" ? tailwindStyledComponents.tws `tu-value-bar--small` : tailwindStyledComponents.tws `tu-value-bar--large`)}
|
|
2136
|
-
`;
|
|
2137
|
-
const Text = tailwindStyledComponents.tw.text `
|
|
2138
|
-
tu-value-bar__text
|
|
2139
|
-
${({ $size }) => ($size === "small" ? tailwindStyledComponents.tws `tu-value-bar__text--small` : tailwindStyledComponents.tws `tu-value-bar__text--large`)}
|
|
2140
|
-
`;
|
|
2141
|
-
const Background = tailwindStyledComponents.tw.rect `
|
|
2142
|
-
tu-value-bar__background
|
|
2143
|
-
`;
|
|
2144
|
-
const Bar = tailwindStyledComponents.tw.rect `
|
|
2145
|
-
tu-value-bar__bar
|
|
2146
|
-
`;
|
|
2391
|
+
return (jsxRuntime.jsx("svg", Object.assign({ className: cvaValueBar({ size, className }), "data-testid": dataTestId }, { children: jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("rect", { className: cvaValueBarProgress({ fill: "background" }), width: `${barWidth}%`, rx: "5" }), jsxRuntime.jsx("rect", { className: cvaValueBarProgress(), width: `${score * barWidth}%`, fill: barFillColor, rx: "5" }), showValue && size === "large" && (jsxRuntime.jsxs("text", Object.assign({ className: cvaValueBarText({ 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({ className: cvaValueBarText({ size }), x: `${barWidth + 2}%`, y: "11", fill: valueColor !== null && valueColor !== void 0 ? valueColor : uiDesignTokens.color("NEUTRAL", 400, "CSS") }, { children: [Number(value.toFixed(1)), unit || ""] })))] }) })));
|
|
2392
|
+
};
|
|
2147
2393
|
|
|
2148
2394
|
const cvaClickable = cssClassVarianceUtilities.cvaMerge([
|
|
2149
2395
|
"shadow-lg",
|
|
@@ -2375,7 +2621,7 @@ exports.ExternalLink = ExternalLink;
|
|
|
2375
2621
|
exports.FilterListMapLayout = FilterListMapLayout;
|
|
2376
2622
|
exports.FullWidthRepeatingLayout = FullWidthRepeatingLayout;
|
|
2377
2623
|
exports.GridArea = GridArea;
|
|
2378
|
-
exports.Heading = Heading
|
|
2624
|
+
exports.Heading = Heading;
|
|
2379
2625
|
exports.Icon = Icon;
|
|
2380
2626
|
exports.IconButton = IconButton;
|
|
2381
2627
|
exports.Indicator = Indicator;
|
|
@@ -2402,7 +2648,7 @@ exports.Spacer = Spacer;
|
|
|
2402
2648
|
exports.Spinner = Spinner;
|
|
2403
2649
|
exports.StarButton = StarButton;
|
|
2404
2650
|
exports.Tag = Tag;
|
|
2405
|
-
exports.Text = Text
|
|
2651
|
+
exports.Text = Text;
|
|
2406
2652
|
exports.Timeline = Timeline;
|
|
2407
2653
|
exports.TimelineElement = TimelineElement;
|
|
2408
2654
|
exports.Tip = Tip;
|
|
@@ -2411,7 +2657,15 @@ exports.TitleNavContentLayout = TitleNavContentLayout;
|
|
|
2411
2657
|
exports.Tooltip = Tooltip;
|
|
2412
2658
|
exports.TwoColumnLayout = TwoColumnLayout;
|
|
2413
2659
|
exports.ValueBar = ValueBar;
|
|
2660
|
+
exports.cvaButton = cvaButton;
|
|
2661
|
+
exports.cvaButtonSpinner = cvaButtonSpinner;
|
|
2414
2662
|
exports.cvaClickable = cvaClickable;
|
|
2663
|
+
exports.cvaIconButtonContainer = cvaIconButtonContainer;
|
|
2664
|
+
exports.cvaIndicator = cvaIndicator;
|
|
2665
|
+
exports.cvaIndicatorIcon = cvaIndicatorIcon;
|
|
2666
|
+
exports.cvaIndicatorIconBackground = cvaIndicatorIconBackground;
|
|
2667
|
+
exports.cvaIndicatorLabel = cvaIndicatorLabel;
|
|
2668
|
+
exports.cvaIndicatorPing = cvaIndicatorPing;
|
|
2415
2669
|
exports.docs = docs;
|
|
2416
2670
|
exports.getDevicePixelRatio = getDevicePixelRatio;
|
|
2417
2671
|
exports.getValueBarColorByValue = getValueBarColorByValue;
|