@trackunit/react-form-components 0.0.105 → 0.0.106
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.js +711 -248
- package/index.esm.js +693 -247
- package/package.json +1 -1
- package/src/components/ActionButton/ActionButton.d.ts +1 -1
- package/src/components/ActionButton/ActionButton.variants.d.ts +4 -0
- package/src/components/BaseInput/BaseInput.d.ts +8 -0
- package/src/components/BaseInput/BaseInput.variants.d.ts +21 -0
- package/src/components/BaseInput/index.d.ts +1 -0
- package/src/components/Checkbox/Checkbox.variants.d.ts +8 -0
- package/src/components/DropZone/DropZone.variants.d.ts +8 -0
- package/src/components/FormGroup/FormGroup.variants.d.ts +8 -0
- package/src/components/Label/Label.d.ts +0 -1
- package/src/components/Label/Label.variants.d.ts +4 -0
- package/src/components/OptionCard/OptionCard.variants.d.ts +5 -0
- package/src/components/RadioGroup/RadioGroup.d.ts +0 -1
- package/src/components/RadioGroup/RadioGroup.variants.d.ts +13 -0
- package/src/components/Search/Search.d.ts +1 -2
- package/src/components/Search/Search.variants.d.ts +4 -0
- package/src/components/Select/Select.variants.d.ts +15 -0
- package/src/components/Select/index.d.ts +1 -0
- package/src/components/Select/shared.d.ts +0 -1
- package/src/components/TextArea/TextArea.variants.d.ts +5 -0
- package/src/components/Toggle/Toggle.d.ts +2 -3
- package/src/components/Toggle/Toggle.variants.d.ts +16 -0
- package/src/components/UploadInput/UploadInput.variants.d.ts +2 -0
- package/index.cjs.css +0 -259
- package/index.esm.css +0 -259
package/index.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as jsx$1, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
2
|
import { registerTranslations } from '@trackunit/i18n-library-translation';
|
|
3
|
-
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
4
3
|
import { IconButton, Icon, Tip, Heading, Text, MenuItem, Tag, Spinner } from '@trackunit/react-components';
|
|
5
|
-
import {
|
|
4
|
+
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import React__default, { useMemo, forwardRef, useState, cloneElement, useEffect, useCallback, useLayoutEffect, useContext, createElement, Fragment, createContext, useRef, Component } from 'react';
|
|
7
|
+
import { tws, tw } from '@trackunit/tailwind-styled-components';
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
9
9
|
|
|
10
10
|
var defaultTranslations = {
|
|
@@ -49,13 +49,26 @@ const setupLibraryTranslations = () => {
|
|
|
49
49
|
registerTranslations(translations);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
const cvaActionButton = cvaMerge(["drop-shadow-none", "rounded-md"], {
|
|
53
|
+
variants: {
|
|
54
|
+
size: {
|
|
55
|
+
small: ["w-6", "h-6"],
|
|
56
|
+
medium: ["w-8", "h-8"],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
size: "medium",
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const cvaActionContainer = cvaMerge(["flex", "items-center", "m-1"]);
|
|
64
|
+
|
|
52
65
|
/**
|
|
53
66
|
* The ActionButton component is a wrapper over IconButton to perform an action when the onClick event is triggered.
|
|
54
67
|
*
|
|
55
68
|
* @param {ActionButtonProps} props - The props for the ActionButton component
|
|
56
69
|
* @returns {JSX.Element} ActionButton component
|
|
57
70
|
*/
|
|
58
|
-
const ActionButton = ({ type, value, dataTestId, iconSize, disabled }) => {
|
|
71
|
+
const ActionButton = ({ type, value, dataTestId, iconSize, disabled, className, }) => {
|
|
59
72
|
const getIconName = () => {
|
|
60
73
|
switch (type) {
|
|
61
74
|
case "PHONE_NUMBER":
|
|
@@ -81,9 +94,8 @@ const ActionButton = ({ type, value, dataTestId, iconSize, disabled }) => {
|
|
|
81
94
|
return window.open(`tel:${value}`);
|
|
82
95
|
}
|
|
83
96
|
};
|
|
84
|
-
return (jsx$1("div", { className:
|
|
97
|
+
return (jsx$1("div", { className: cvaActionContainer({ className }), children: jsx$1(IconButton, { disabled: disabled, dataTestId: dataTestId || "testIconButtonId", size: "small", color: "tertiary", icon: jsx$1(Icon, { size: "small", name: getIconName() }), onClick: ButtonAction, className: cvaActionButton({ size: iconSize }) }) }));
|
|
85
98
|
};
|
|
86
|
-
const cvaActionButton = cvaMerge(["drop-shadow-none", "rounded-md"]);
|
|
87
99
|
|
|
88
100
|
/******************************************************************************
|
|
89
101
|
Copyright (c) Microsoft Corporation.
|
|
@@ -122,6 +134,96 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
122
134
|
});
|
|
123
135
|
}
|
|
124
136
|
|
|
137
|
+
const cvaInputBase = cvaMerge([
|
|
138
|
+
"component-baseInput-shadow",
|
|
139
|
+
"component-baseInput-border",
|
|
140
|
+
"component-baseInput-background",
|
|
141
|
+
"border-slate-300",
|
|
142
|
+
"focus-within:ring-2",
|
|
143
|
+
"focus-within:ring-offset-2",
|
|
144
|
+
"focus-within:ring-offset-white",
|
|
145
|
+
"focus-within:ring-primary-500",
|
|
146
|
+
"focus-within:border-slate-400",
|
|
147
|
+
"hover:border-slate-400",
|
|
148
|
+
"hover:bg-slate-50",
|
|
149
|
+
"transition",
|
|
150
|
+
]);
|
|
151
|
+
const cvaInputBaseDisabled = cvaMerge(["bg-slate-100", "hover:bg-slate-100", "hover:border-slate-300"]);
|
|
152
|
+
const cvaInputBaseInvalid = cvaMerge(["border-danger-600", "focus-within:ring-danger-600"]);
|
|
153
|
+
const cvaInput = cvaMerge(["relative", "flex", "h-10", cvaInputBase()], {
|
|
154
|
+
variants: {
|
|
155
|
+
size: {
|
|
156
|
+
small: ["h-8"],
|
|
157
|
+
medium: ["h-10"],
|
|
158
|
+
},
|
|
159
|
+
disabled: {
|
|
160
|
+
true: cvaInputBaseDisabled(),
|
|
161
|
+
false: "",
|
|
162
|
+
},
|
|
163
|
+
invalid: {
|
|
164
|
+
true: cvaInputBaseInvalid(),
|
|
165
|
+
false: "",
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
const cvaInputField = cvaMerge([
|
|
170
|
+
"w-full",
|
|
171
|
+
"px-3",
|
|
172
|
+
"border-0",
|
|
173
|
+
"bg-transparent",
|
|
174
|
+
"text-base",
|
|
175
|
+
"text-slate-900",
|
|
176
|
+
"placeholder-slate-400",
|
|
177
|
+
"focus-visible:outline-none",
|
|
178
|
+
], {
|
|
179
|
+
variants: {
|
|
180
|
+
size: {
|
|
181
|
+
small: ["py-1"],
|
|
182
|
+
medium: ["py-2"],
|
|
183
|
+
},
|
|
184
|
+
disabled: {
|
|
185
|
+
true: ["text-slate-700"],
|
|
186
|
+
false: "",
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
const cvaInputAddon = cvaMerge([
|
|
191
|
+
"flex",
|
|
192
|
+
"justify-center",
|
|
193
|
+
"items-center",
|
|
194
|
+
"px-3",
|
|
195
|
+
"border-slate-300",
|
|
196
|
+
"text-slate-500",
|
|
197
|
+
"bg-slate-50",
|
|
198
|
+
]);
|
|
199
|
+
const cvaInputAddonBefore = cvaMerge([cvaInputAddon(), "border-r", "rounded-l-lg"]);
|
|
200
|
+
const cvaInputAddonAfter = cvaMerge([cvaInputAddon(), "border-l", "rounded-r-lg"]);
|
|
201
|
+
const cvaInputPrefix = cvaMerge([
|
|
202
|
+
"flex",
|
|
203
|
+
"justify-center",
|
|
204
|
+
"items-center",
|
|
205
|
+
"text-slate-400",
|
|
206
|
+
"hover:component-search-prefix",
|
|
207
|
+
"component-baseInput-prefix",
|
|
208
|
+
"component-search-borderless",
|
|
209
|
+
"px-3",
|
|
210
|
+
], {
|
|
211
|
+
variants: {
|
|
212
|
+
disabled: {
|
|
213
|
+
true: ["text-slate-500"],
|
|
214
|
+
false: "",
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
const cvaInputSuffix = cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "px-3"], {
|
|
219
|
+
variants: {
|
|
220
|
+
disabled: {
|
|
221
|
+
true: ["text-slate-500"],
|
|
222
|
+
false: "",
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
|
|
125
227
|
/**
|
|
126
228
|
* A base input component that can be used for text inputs, password inputs, etc.
|
|
127
229
|
* A reference to the input element is provided as the `ref` prop.
|
|
@@ -131,28 +233,47 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
131
233
|
* This is a base used by our other input components such as TextInput, NumberInput, PasswordInput, etc.
|
|
132
234
|
*/
|
|
133
235
|
const BaseInput = React.forwardRef((_a, ref) => {
|
|
134
|
-
var { className, isInvalid, dataTestId, prefix, suffix, addonBefore, addonAfter, actions, fieldSize = "medium", nonInteractive = false, type } = _a, rest = __rest(_a, ["className", "isInvalid", "dataTestId", "prefix", "suffix", "addonBefore", "addonAfter", "actions", "fieldSize", "nonInteractive", "type"]);
|
|
236
|
+
var { className, isInvalid, dataTestId, prefix, suffix, addonBefore, addonAfter, actions, fieldSize = "medium", nonInteractive = false, type, inputClassName, addonBeforeClassName } = _a, rest = __rest(_a, ["className", "isInvalid", "dataTestId", "prefix", "suffix", "addonBefore", "addonAfter", "actions", "fieldSize", "nonInteractive", "type", "inputClassName", "addonBeforeClassName"]);
|
|
135
237
|
const isReadOnlyWithPlaceholder = useMemo(() => !!rest.readOnly && !!rest.placeholder && !rest.value, [rest.readOnly, rest.placeholder, rest.value]);
|
|
136
|
-
|
|
238
|
+
const renderAsDisabled = rest.disabled || rest.readOnly;
|
|
239
|
+
return (jsxs("div", { className: cvaInput({
|
|
240
|
+
disabled: renderAsDisabled,
|
|
241
|
+
invalid: isInvalid,
|
|
242
|
+
size: fieldSize,
|
|
243
|
+
className,
|
|
244
|
+
}), "data-testid": dataTestId && `${dataTestId}-container`, children: [addonBefore && addonBefore !== undefined ? (jsx$1("div", { className: cvaInputAddonBefore({ className: addonBeforeClassName }), "data-testid": dataTestId && `${dataTestId}-addonBefore`, children: addonBefore })) : null, prefix && addonBefore !== prefix ? (jsx$1("div", { className: cvaInputPrefix({
|
|
245
|
+
disabled: renderAsDisabled,
|
|
246
|
+
}), "data-testid": dataTestId && `${dataTestId}-prefix`, children: prefix })) : null, jsx$1("input", Object.assign({ ref: ref, "data-testid": dataTestId, className: cvaInputField({ size: fieldSize, disabled: renderAsDisabled, className: inputClassName }), type: isReadOnlyWithPlaceholder ? "text" : type }, rest, { readOnly: rest.readOnly || nonInteractive })), suffix && addonBefore !== suffix ? (jsx$1("div", { className: cvaInputSuffix({
|
|
247
|
+
disabled: renderAsDisabled,
|
|
248
|
+
}), "data-testid": dataTestId && `${dataTestId}-suffix`, children: suffix })) : null, actions && addonBefore !== actions ? actions : null, addonAfter && addonAfter !== undefined && addonBefore !== addonAfter ? (jsx$1("div", { className: cvaInputAddonAfter(), "data-testid": dataTestId && `${dataTestId}-addonAfter`, children: addonAfter })) : null] }));
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
const cvaLabel = cvaMerge([
|
|
252
|
+
"text-base",
|
|
253
|
+
"text-slate-700",
|
|
254
|
+
"overflow-hidden",
|
|
255
|
+
"whitespace-nowrap",
|
|
256
|
+
"text-ellipsis",
|
|
257
|
+
"hover:text-slate-800",
|
|
258
|
+
"group-hover:text-slate-800",
|
|
259
|
+
"active:text-slate-800",
|
|
260
|
+
"group-active:text-slate-800",
|
|
261
|
+
], {
|
|
262
|
+
variants: {
|
|
263
|
+
invalid: {
|
|
264
|
+
true: "text-red-600 hover:text-red-700 group-hover:text-red-700 active:text-red-700 group-active:text-red-700",
|
|
265
|
+
false: "",
|
|
266
|
+
},
|
|
267
|
+
disabled: {
|
|
268
|
+
true: "text-slate-400 hover:text-slate-400 group-hover:text-slate-400",
|
|
269
|
+
false: "",
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
defaultVariants: {
|
|
273
|
+
invalid: false,
|
|
274
|
+
disabled: false,
|
|
275
|
+
},
|
|
137
276
|
});
|
|
138
|
-
const InputPrefix = tw.div `
|
|
139
|
-
tu-input__prefix
|
|
140
|
-
`;
|
|
141
|
-
const InputSuffix = tw.div `
|
|
142
|
-
tu-input__suffix
|
|
143
|
-
`;
|
|
144
|
-
const AddonBefore = tw.div `
|
|
145
|
-
tu-input__addon-before
|
|
146
|
-
`;
|
|
147
|
-
const AddonAfter = tw.div `
|
|
148
|
-
tu-input__addon-after
|
|
149
|
-
`;
|
|
150
|
-
const InputContainer$1 = tw.label `
|
|
151
|
-
tu-input
|
|
152
|
-
${({ $invalid }) => ($invalid ? tws `tu-input--invalid` : null)}
|
|
153
|
-
${({ $disabled }) => ($disabled ? tws `tu-input--disabled` : null)}
|
|
154
|
-
${({ $fieldSize }) => ($fieldSize === "small" ? tws `tu-input--small` : null)}
|
|
155
|
-
`;
|
|
156
277
|
|
|
157
278
|
/**
|
|
158
279
|
* The CheckIcon component is used by the checkbox to display the checked state.
|
|
@@ -164,6 +285,130 @@ const CheckIcon = ({ className, dataTestId }) => {
|
|
|
164
285
|
return (jsx$1("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, "data-testid": dataTestId, fill: "none", viewBox: "0 0 10 10", stroke: "currentColor", strokeWidth: "2", children: jsx$1("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m2 5.5 2 2L8.5 3" }) }));
|
|
165
286
|
};
|
|
166
287
|
|
|
288
|
+
const cvaCheckbox = cvaMerge([
|
|
289
|
+
"w-4",
|
|
290
|
+
"h-4",
|
|
291
|
+
"border-solid",
|
|
292
|
+
"border",
|
|
293
|
+
"shrink-0",
|
|
294
|
+
"border-slate-300",
|
|
295
|
+
"flex",
|
|
296
|
+
"rounded",
|
|
297
|
+
"hover:bg-slate-100",
|
|
298
|
+
"bg-white",
|
|
299
|
+
"items-center",
|
|
300
|
+
"shadow-sm",
|
|
301
|
+
"justify-center",
|
|
302
|
+
"box-border",
|
|
303
|
+
"transition",
|
|
304
|
+
"focus:bg-slate-200",
|
|
305
|
+
"outline-0",
|
|
306
|
+
"active:bg-slate-200",
|
|
307
|
+
"active:ring-2",
|
|
308
|
+
"active:ring-offset-2",
|
|
309
|
+
"active:ring-blue-700",
|
|
310
|
+
"focus:ring-2",
|
|
311
|
+
"focus:ring-offset-2",
|
|
312
|
+
"focus:ring-blue-700",
|
|
313
|
+
"cursor-pointer",
|
|
314
|
+
"group-active:ring-2",
|
|
315
|
+
"group-active:ring-offset-2",
|
|
316
|
+
"group-active:ring-blue-700",
|
|
317
|
+
], {
|
|
318
|
+
variants: {
|
|
319
|
+
disabled: {
|
|
320
|
+
true: [
|
|
321
|
+
"bg-slate-300",
|
|
322
|
+
"border-slate-300",
|
|
323
|
+
"cursor-not-allowed",
|
|
324
|
+
"group-hover:bg-slate-300",
|
|
325
|
+
"group-focus:bg-slate-300",
|
|
326
|
+
"hover:bg-slate-300",
|
|
327
|
+
"focus:bg-slate-300",
|
|
328
|
+
"active:bg-slate-300",
|
|
329
|
+
"focus:ring-0",
|
|
330
|
+
"focus:ring-offset-0",
|
|
331
|
+
"group-active:ring-0",
|
|
332
|
+
"group-active:ring-offset-0",
|
|
333
|
+
],
|
|
334
|
+
false: "",
|
|
335
|
+
},
|
|
336
|
+
invalid: {
|
|
337
|
+
true: [
|
|
338
|
+
"border-red-600",
|
|
339
|
+
"active:ring-red-700",
|
|
340
|
+
"focus:ring-red-700",
|
|
341
|
+
"group-focus:ring-2",
|
|
342
|
+
"group-focus:ring-offset-2",
|
|
343
|
+
],
|
|
344
|
+
false: "",
|
|
345
|
+
},
|
|
346
|
+
state: {
|
|
347
|
+
selected: [
|
|
348
|
+
"bg-blue-600",
|
|
349
|
+
"border-blue-600",
|
|
350
|
+
"hover:bg-blue-700",
|
|
351
|
+
"hover:border-blue-700",
|
|
352
|
+
"active:bg-blue-700",
|
|
353
|
+
"focus:bg-blue-700",
|
|
354
|
+
"group-hover:bg-blue-700",
|
|
355
|
+
"group-hover:border-blue-700",
|
|
356
|
+
"group-focus:bg-blue-700",
|
|
357
|
+
"group-focus:border-blue-700",
|
|
358
|
+
],
|
|
359
|
+
deselected: ["group-hover:bg-slate-100"],
|
|
360
|
+
indeterminate: [
|
|
361
|
+
"bg-blue-600",
|
|
362
|
+
"border-blue-600",
|
|
363
|
+
"hover:bg-blue-700",
|
|
364
|
+
"hover:border-blue-700",
|
|
365
|
+
"focus:bg-blue-800",
|
|
366
|
+
"focus:border-blue-800",
|
|
367
|
+
"active:bg-blue-800",
|
|
368
|
+
"active:border-blue-800",
|
|
369
|
+
"group-hover:bg-blue-700",
|
|
370
|
+
"group-hover:border-blue-700",
|
|
371
|
+
"group-focus:bg-blue-800",
|
|
372
|
+
"group-focus:border-blue-800",
|
|
373
|
+
],
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
compoundVariants: [
|
|
377
|
+
{
|
|
378
|
+
state: "selected",
|
|
379
|
+
invalid: true,
|
|
380
|
+
className: [
|
|
381
|
+
"bg-red-600",
|
|
382
|
+
"border-red-600",
|
|
383
|
+
"hover:bg-red-700",
|
|
384
|
+
"hover:border-red-700",
|
|
385
|
+
"group-hover:bg-red-700",
|
|
386
|
+
"group-hover:border-red-700",
|
|
387
|
+
"active:bg-red-700",
|
|
388
|
+
"active:ring-red-700",
|
|
389
|
+
"group-active:bg-red-700",
|
|
390
|
+
"group-active:border-red-700",
|
|
391
|
+
"group-active:ring-red-700",
|
|
392
|
+
"group-active:ring-2",
|
|
393
|
+
"group-active:ring-offset-2",
|
|
394
|
+
],
|
|
395
|
+
},
|
|
396
|
+
],
|
|
397
|
+
defaultVariants: {
|
|
398
|
+
state: "deselected",
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
const cvaCheckboxContainer = cvaMerge([
|
|
402
|
+
"grid",
|
|
403
|
+
"outline-none",
|
|
404
|
+
"grid-cols-min-fr",
|
|
405
|
+
"items-center",
|
|
406
|
+
"gap-2",
|
|
407
|
+
"group",
|
|
408
|
+
]);
|
|
409
|
+
const cvaCheckboxInput = cvaMerge(["absolute", "opacity-0", "m-0", "pointer-events-none", "hidden"]);
|
|
410
|
+
const cvaCheckboxIcon = cvaMerge(["w-2.5", "h-2.5", "text-white"]);
|
|
411
|
+
|
|
167
412
|
/**
|
|
168
413
|
* The IndeterminateIcon component is used by the checkbox to display the Indeterminate state.
|
|
169
414
|
*
|
|
@@ -187,8 +432,8 @@ const IndeterminateIcon = ({ className }) => (jsx$1("svg", { xmlns: "http://www.
|
|
|
187
432
|
* @returns {JSX.Element} Checkbox component
|
|
188
433
|
*/
|
|
189
434
|
const Checkbox = React.forwardRef((_a, ref) => {
|
|
190
|
-
var { className, dataTestId, onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, suffix, label, tabIndex = 0 } = _a, rest = __rest(_a, ["className", "dataTestId", "onChange", "checked", "disabled", "isInvalid", "readOnly", "indeterminate", "suffix", "label", "tabIndex"]);
|
|
191
|
-
const icon = indeterminate ? jsx$1(
|
|
435
|
+
var { className, dataTestId = "checkbox", onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, suffix, label, tabIndex = 0 } = _a, rest = __rest(_a, ["className", "dataTestId", "onChange", "checked", "disabled", "isInvalid", "readOnly", "indeterminate", "suffix", "label", "tabIndex"]);
|
|
436
|
+
const icon = indeterminate ? (jsx$1(IndeterminateIcon, { className: cvaCheckboxIcon() })) : (checked && jsx$1(CheckIcon, { className: cvaCheckboxIcon() }));
|
|
192
437
|
const internalRef = React.useRef(null);
|
|
193
438
|
const isReadonly = disabled || readOnly;
|
|
194
439
|
const onKeyPress = e => {
|
|
@@ -202,32 +447,16 @@ const Checkbox = React.forwardRef((_a, ref) => {
|
|
|
202
447
|
}
|
|
203
448
|
};
|
|
204
449
|
const uuid = rest.id || dataTestId;
|
|
205
|
-
return (jsxs(
|
|
450
|
+
return (jsxs("label", { "data-testid": dataTestId && `${dataTestId}-container`, htmlFor: uuid, className: cvaCheckboxContainer({ className }), ref: internalRef, onKeyPress: onKeyPress, children: [jsx$1("input", Object.assign({ type: "checkbox", className: cvaCheckboxInput(), checked: !indeterminate && checked, onChange: onChange, disabled: disabled, "data-testid": dataTestId, readOnly: readOnly, "aria-checked": !indeterminate && checked, id: uuid }, rest, { ref: ref })), jsx$1("span", { id: uuid, tabIndex: isReadonly ? -1 : tabIndex, className: cvaCheckbox({
|
|
451
|
+
disabled: isReadonly,
|
|
452
|
+
invalid: isReadonly ? false : isInvalid,
|
|
453
|
+
state: indeterminate ? "indeterminate" : checked ? "selected" : "deselected",
|
|
454
|
+
}), children: icon }), label && (jsx$1("span", { className: cvaLabel({
|
|
455
|
+
invalid: isReadonly ? false : isInvalid,
|
|
456
|
+
disabled: isReadonly,
|
|
457
|
+
className: "cursor-pointer",
|
|
458
|
+
}), children: label })), suffix] }));
|
|
206
459
|
});
|
|
207
|
-
const StyledCheckIcon = twx(CheckIcon) `tu-checkbox--icon`;
|
|
208
|
-
const StyledIndeterminateIcon = twx(IndeterminateIcon) `tu-checkbox--icon`;
|
|
209
|
-
const CheckboxContainer = tw.label `tu-checkbox--container group`;
|
|
210
|
-
const HiddenInput$1 = tw.input `tu-checkbox--input`;
|
|
211
|
-
const CheckboxWrapper = tw.span `
|
|
212
|
-
tu-checkbox
|
|
213
|
-
${({ $checked, $disabled, $indeterminate }) => {
|
|
214
|
-
if ($disabled) {
|
|
215
|
-
return tws `tu-checkbox--disabled`;
|
|
216
|
-
}
|
|
217
|
-
return $indeterminate
|
|
218
|
-
? tws `tu-checkbox--indeterminate`
|
|
219
|
-
: $checked
|
|
220
|
-
? tws `tu-checkbox--selected`
|
|
221
|
-
: tws `tu-checkbox--deselected`;
|
|
222
|
-
}}
|
|
223
|
-
|
|
224
|
-
${({ $isInvalid }) => $isInvalid && tws `tu-checkbox--invalid`}
|
|
225
|
-
`;
|
|
226
|
-
const Label$2 = tw.span `
|
|
227
|
-
tu-label
|
|
228
|
-
${({ $disabled }) => $disabled && tws `tu-label--disabled`}
|
|
229
|
-
${({ $isInvalid }) => $isInvalid && tws `tu-label--invalid`}
|
|
230
|
-
`;
|
|
231
460
|
|
|
232
461
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
233
462
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
@@ -2678,14 +2907,28 @@ const DateInput = forwardRef((_a, ref) => {
|
|
|
2678
2907
|
* @param {LabelProps} props - The props for the Label component
|
|
2679
2908
|
* @returns {JSX.Element} Label component
|
|
2680
2909
|
*/
|
|
2681
|
-
const Label
|
|
2682
|
-
return (jsx$1(
|
|
2910
|
+
const Label = ({ id, htmlFor, children, className, dataTestId, disabled, isInvalid, }) => {
|
|
2911
|
+
return (jsx$1("label", { id: id || "", htmlFor: htmlFor || "", className: cvaLabel({ invalid: isInvalid, disabled, className }), "data-testid": dataTestId, children: children }));
|
|
2683
2912
|
};
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2913
|
+
|
|
2914
|
+
const cvaFormGroup = cvaMerge(["component-formGroup-gap"], {
|
|
2915
|
+
variants: {
|
|
2916
|
+
disabled: {
|
|
2917
|
+
true: "pointer-events-none",
|
|
2918
|
+
false: "",
|
|
2919
|
+
},
|
|
2920
|
+
},
|
|
2921
|
+
});
|
|
2922
|
+
const cvaFormGroupContainerBefore = cvaMerge(["flex", "gap-1", "mb-1"]);
|
|
2923
|
+
const cvaFormGroupContainerAfter = cvaMerge(["flex", "justify-between", "mt-1", "text-xs", "text-slate-500"], {
|
|
2924
|
+
variants: {
|
|
2925
|
+
invalid: {
|
|
2926
|
+
true: "text-danger-500",
|
|
2927
|
+
false: "",
|
|
2928
|
+
},
|
|
2929
|
+
},
|
|
2930
|
+
});
|
|
2931
|
+
const cvaHelpAddon = cvaMerge(["ml-auto"]);
|
|
2689
2932
|
|
|
2690
2933
|
/**
|
|
2691
2934
|
* The FormGroup component should be used to wrap any Input element that needs a label.
|
|
@@ -2695,27 +2938,8 @@ ${({ $isInvalid }) => $isInvalid && tws `tu-label--invalid`}
|
|
|
2695
2938
|
* @returns {JSX.Element} FormGroup component
|
|
2696
2939
|
*/
|
|
2697
2940
|
const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, htmlFor, children, disabled = false, }) => {
|
|
2698
|
-
return (jsxs(
|
|
2941
|
+
return (jsxs("div", { className: cvaFormGroup({ disabled, className }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaFormGroupContainerBefore({ className }), children: [jsx$1(Label, { className: "component-formGroup-font", dataTestId: dataTestId && `${dataTestId}-label`, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), tip && jsx$1(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, children: tip })] }), children, jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid }), children: [helpText && jsx$1("span", { "data-testid": dataTestId && `${dataTestId}-helpText`, children: helpText }), helpAddon && (jsx$1("span", { className: cvaHelpAddon(), "data-testid": dataTestId && `${dataTestId}-helpAddon`, children: helpAddon }))] })] }));
|
|
2699
2942
|
};
|
|
2700
|
-
const FormGroupRoot = tw.div `
|
|
2701
|
-
tu-form-group
|
|
2702
|
-
${({ $disabled }) => {
|
|
2703
|
-
return $disabled ? "pointer-events-none" : null;
|
|
2704
|
-
}}
|
|
2705
|
-
`;
|
|
2706
|
-
const ContainerBefore = tw.div `
|
|
2707
|
-
tu-form-group__container-before
|
|
2708
|
-
`;
|
|
2709
|
-
const FormGroupLabel = twx(Label$1) `
|
|
2710
|
-
component-formGroup-font
|
|
2711
|
-
`;
|
|
2712
|
-
const ContainerAfter = tw.div `
|
|
2713
|
-
tu-form-group__container-after
|
|
2714
|
-
${({ $isInvalid }) => ($isInvalid ? tws `tu-form-group__container-after--invalid` : null)}
|
|
2715
|
-
`;
|
|
2716
|
-
const HelpAddon = tw.span `
|
|
2717
|
-
tu-form-group__help-addon
|
|
2718
|
-
`;
|
|
2719
2943
|
|
|
2720
2944
|
/**
|
|
2721
2945
|
* The date field component is used for entering date values.
|
|
@@ -2731,6 +2955,45 @@ const DateField = forwardRef((_a, ref) => {
|
|
|
2731
2955
|
return (jsx$1(FormGroup, { htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, disabled: rest.disabled, dataTestId: dataTestId && `${dataTestId}-FormGroup`, children: jsx$1(DateInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", ref: ref, defaultValue: defaultValue, isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) }));
|
|
2732
2956
|
});
|
|
2733
2957
|
|
|
2958
|
+
const cvaDropZone = cvaMerge([
|
|
2959
|
+
"flex",
|
|
2960
|
+
"component-baseInput-background",
|
|
2961
|
+
"justify-center",
|
|
2962
|
+
"text-slate-500",
|
|
2963
|
+
"rounded-sm",
|
|
2964
|
+
"border-2",
|
|
2965
|
+
"border-gray-200",
|
|
2966
|
+
"border-dashed",
|
|
2967
|
+
"hover:bg-slate-100",
|
|
2968
|
+
"hover:border-solid",
|
|
2969
|
+
"hover:border-primary-500",
|
|
2970
|
+
], {
|
|
2971
|
+
variants: {
|
|
2972
|
+
size: {
|
|
2973
|
+
small: ["p-2"],
|
|
2974
|
+
medium: ["p-4"],
|
|
2975
|
+
large: ["p-8"],
|
|
2976
|
+
},
|
|
2977
|
+
disabled: { true: ["bg-slate-100", "hover:bg-slate-100"], false: "" },
|
|
2978
|
+
dragActive: { true: ["border-gray-200", "bg-slate-100"], false: "" },
|
|
2979
|
+
dropComplete: {
|
|
2980
|
+
true: ["border-solid", "border-primary-500", "bg-slate-100", "hover:border-solid", "hover:border-gray-200"],
|
|
2981
|
+
false: "",
|
|
2982
|
+
},
|
|
2983
|
+
invalid: { true: ["border-danger-600", "text-danger-500"], false: "" },
|
|
2984
|
+
},
|
|
2985
|
+
});
|
|
2986
|
+
const cvaDropZoneLabel = cvaMerge([
|
|
2987
|
+
"h-full",
|
|
2988
|
+
"pt-1",
|
|
2989
|
+
"pb-1",
|
|
2990
|
+
"gap-2",
|
|
2991
|
+
"items-center",
|
|
2992
|
+
"flex-col",
|
|
2993
|
+
"flex",
|
|
2994
|
+
"justify-center",
|
|
2995
|
+
]);
|
|
2996
|
+
|
|
2734
2997
|
/**
|
|
2735
2998
|
* The Drop Zone can be used to drag and drop files
|
|
2736
2999
|
*
|
|
@@ -2770,26 +3033,13 @@ const DropZone = (_a) => {
|
|
|
2770
3033
|
setFileDropped(true);
|
|
2771
3034
|
}
|
|
2772
3035
|
};
|
|
2773
|
-
return (jsxs(
|
|
3036
|
+
return (jsxs("div", Object.assign({ className: cvaDropZone({ size, dropComplete: fileDropped, dragActive, disabled, invalid: isInvalid, className }), "data-testid": dataTestId, onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, onClick: e => {
|
|
2774
3037
|
if (disabled) {
|
|
2775
3038
|
e.preventDefault();
|
|
2776
3039
|
e.stopPropagation();
|
|
2777
3040
|
}
|
|
2778
|
-
} }, rest, { children: [jsx$1("input", { title: "Hidden File Input", type: "file", id: "input-file-upload", onChange: handleChange, className: "hidden" }), jsxs(
|
|
2779
|
-
};
|
|
2780
|
-
const Root$1 = tw.div `
|
|
2781
|
-
tu-drop-zone
|
|
2782
|
-
${({ $size }) => ($size === "small" ? tws `tu-drop-zone--small` : null)}
|
|
2783
|
-
${({ $size }) => ($size === "medium" ? tws `tu-drop-zone--medium` : null)}
|
|
2784
|
-
${({ $size }) => ($size === "large" ? tws `tu-drop-zone--large` : null)}
|
|
2785
|
-
${({ $dragActive }) => ($dragActive ? tws `tu-drop-zone--drag-active` : null)}
|
|
2786
|
-
${({ $fileDropped }) => ($fileDropped ? tws `tu-drop-zone--drop-complete` : null)}
|
|
2787
|
-
${({ $isInvalid }) => ($isInvalid ? tws `tu-drop-zone--invalid` : null)}
|
|
2788
|
-
${({ $disabled }) => ($disabled ? tws `tu-drop-zone--disabled` : null)}
|
|
2789
|
-
`;
|
|
2790
|
-
const DropZoneLabel = tw.label `
|
|
2791
|
-
tu-drop-zone__label
|
|
2792
|
-
`;
|
|
3041
|
+
} }, rest, { children: [jsx$1("input", { title: "Hidden File Input", type: "file", id: "input-file-upload", onChange: handleChange, className: "hidden" }), jsxs("label", { className: cvaDropZoneLabel(), htmlFor: "input-file-upload", "data-testid": dataTestId && `${dataTestId}-label`, children: [jsx$1(Icon, { type: "solid", name: "ArrowUpCircleIcon", color: isInvalid ? "danger" : "neutral", style: !isInvalid ? { color: "rgb(156 163 175)" } : {} }), jsx$1("span", { children: label })] })] })));
|
|
3042
|
+
};
|
|
2793
3043
|
|
|
2794
3044
|
/**
|
|
2795
3045
|
* A Email Input component is used for input of the type Email.
|
|
@@ -2851,39 +3101,40 @@ const NumberField = forwardRef((_a, ref) => {
|
|
|
2851
3101
|
return (jsx$1(FormGroup, { htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, dataTestId: dataTestId && `${dataTestId}-FormGroup`, children: jsx$1(NumberInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) }));
|
|
2852
3102
|
});
|
|
2853
3103
|
|
|
3104
|
+
const cvaOptionCardLabel = cvaMerge([
|
|
3105
|
+
cvaInputBase(),
|
|
3106
|
+
"text-center",
|
|
3107
|
+
"component-baseInput-background",
|
|
3108
|
+
"aspect-square",
|
|
3109
|
+
"flex",
|
|
3110
|
+
"flex-col",
|
|
3111
|
+
"gap-2",
|
|
3112
|
+
"justify-center",
|
|
3113
|
+
"items-center",
|
|
3114
|
+
"p-6",
|
|
3115
|
+
"w-full",
|
|
3116
|
+
"peer-checked:bg-primary-50",
|
|
3117
|
+
"peer-checked:border-primary-600",
|
|
3118
|
+
"peer-checked:border-2",
|
|
3119
|
+
], {
|
|
3120
|
+
variants: {
|
|
3121
|
+
disabled: {
|
|
3122
|
+
true: [cvaInputBaseDisabled(), "cursor-not-allowed"],
|
|
3123
|
+
false: ["cursor-pointer"],
|
|
3124
|
+
},
|
|
3125
|
+
},
|
|
3126
|
+
});
|
|
3127
|
+
const cvaOptionCardContent = cvaMerge(["flex", "flex-col", "items-center"]);
|
|
3128
|
+
const cvaOptionCardContainer = cvaMerge(["contents"]);
|
|
3129
|
+
|
|
2854
3130
|
/**
|
|
2855
3131
|
* A card version of a radio button that includes an icon, headings and a description.
|
|
2856
3132
|
*/
|
|
2857
3133
|
const OptionCard = forwardRef((_a, ref) => {
|
|
2858
3134
|
var { icon, heading, subheading, description, disabled, id, value, className, dataTestId } = _a, rest = __rest(_a, ["icon", "heading", "subheading", "description", "disabled", "id", "value", "className", "dataTestId"]);
|
|
2859
3135
|
const htmlForId = id !== null && id !== void 0 ? id : "option-card-" + v4();
|
|
2860
|
-
return (jsxs(
|
|
3136
|
+
return (jsxs("div", { "data-testid": dataTestId, className: cvaOptionCardContainer(), children: [jsx$1("input", Object.assign({ ref: ref, id: htmlForId, type: "radio", value: value, className: "hidden peer" }, rest)), jsxs("label", { htmlFor: htmlForId, className: cvaOptionCardLabel({ className, disabled }), children: [disabled && icon && cloneElement(icon, { className: `${icon.props.className} text-secondary-400` }), !disabled && icon, heading && (jsx$1(Heading, { variant: "secondary", subtle: disabled, children: heading })), (subheading || description) && (jsxs("div", { className: cvaOptionCardContent(), children: [subheading && (jsx$1(Text, { weight: "thick", align: "center", subtle: disabled, children: subheading })), description && (jsx$1(Text, { subtle: true, align: "center", children: description }))] }))] })] }));
|
|
2861
3137
|
});
|
|
2862
|
-
const Container$3 = tw.div `
|
|
2863
|
-
contents
|
|
2864
|
-
`;
|
|
2865
|
-
const Label = tw.label `
|
|
2866
|
-
tu-input-base
|
|
2867
|
-
text-center
|
|
2868
|
-
${p => (p.$disabled ? "tu-input--disabled" : "")}
|
|
2869
|
-
${p => (p.$disabled ? "cursor-not-allowed" : "cursor-pointer")}
|
|
2870
|
-
aspect-square
|
|
2871
|
-
flex
|
|
2872
|
-
flex-col
|
|
2873
|
-
gap-2
|
|
2874
|
-
justify-center
|
|
2875
|
-
items-center
|
|
2876
|
-
p-6
|
|
2877
|
-
w-full
|
|
2878
|
-
peer-checked:bg-primary-50
|
|
2879
|
-
peer-checked:border-primary-600
|
|
2880
|
-
peer-checked:border-2
|
|
2881
|
-
`;
|
|
2882
|
-
const Content = tw.div `
|
|
2883
|
-
flex
|
|
2884
|
-
flex-col
|
|
2885
|
-
items-center
|
|
2886
|
-
`;
|
|
2887
3138
|
|
|
2888
3139
|
// This file is a workaround for a bug in web browsers' "native"
|
|
2889
3140
|
// ES6 importing system which is uncapable of importing "*.json" files.
|
|
@@ -10215,7 +10466,7 @@ var containerCSS = function containerCSS(_ref) {
|
|
|
10215
10466
|
position: 'relative'
|
|
10216
10467
|
};
|
|
10217
10468
|
};
|
|
10218
|
-
var SelectContainer$
|
|
10469
|
+
var SelectContainer$1 = function SelectContainer(props) {
|
|
10219
10470
|
var children = props.children,
|
|
10220
10471
|
innerProps = props.innerProps,
|
|
10221
10472
|
isDisabled = props.isDisabled,
|
|
@@ -10604,7 +10855,7 @@ var inputStyle = function inputStyle(isHidden) {
|
|
|
10604
10855
|
width: '100%'
|
|
10605
10856
|
}, spacingStyle);
|
|
10606
10857
|
};
|
|
10607
|
-
var Input
|
|
10858
|
+
var Input = function Input(props) {
|
|
10608
10859
|
var cx = props.cx,
|
|
10609
10860
|
value = props.value;
|
|
10610
10861
|
var _cleanCommonProps = cleanCommonProps(props),
|
|
@@ -10626,7 +10877,7 @@ var Input$1 = function Input(props) {
|
|
|
10626
10877
|
disabled: isDisabled
|
|
10627
10878
|
}, innerProps)));
|
|
10628
10879
|
};
|
|
10629
|
-
var Input$1
|
|
10880
|
+
var Input$1 = Input;
|
|
10630
10881
|
|
|
10631
10882
|
var multiValueCSS = function multiValueCSS(_ref, unstyled) {
|
|
10632
10883
|
var _ref$theme = _ref.theme,
|
|
@@ -10837,7 +11088,7 @@ var components = {
|
|
|
10837
11088
|
GroupHeading: GroupHeading,
|
|
10838
11089
|
IndicatorsContainer: IndicatorsContainer,
|
|
10839
11090
|
IndicatorSeparator: IndicatorSeparator,
|
|
10840
|
-
Input: Input$1
|
|
11091
|
+
Input: Input$1,
|
|
10841
11092
|
LoadingIndicator: LoadingIndicator,
|
|
10842
11093
|
Menu: Menu$1,
|
|
10843
11094
|
MenuList: MenuList,
|
|
@@ -10850,7 +11101,7 @@ var components = {
|
|
|
10850
11101
|
MultiValueRemove: MultiValueRemove,
|
|
10851
11102
|
Option: Option$1,
|
|
10852
11103
|
Placeholder: Placeholder$1,
|
|
10853
|
-
SelectContainer: SelectContainer$
|
|
11104
|
+
SelectContainer: SelectContainer$1,
|
|
10854
11105
|
SingleValue: SingleValue$1,
|
|
10855
11106
|
ValueContainer: ValueContainer
|
|
10856
11107
|
};
|
|
@@ -13693,25 +13944,69 @@ var CreatableSelect$1 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
13693
13944
|
});
|
|
13694
13945
|
var CreatableSelect$1$1 = CreatableSelect$1;
|
|
13695
13946
|
|
|
13947
|
+
const cvaSelect = cvaMerge([
|
|
13948
|
+
"relative",
|
|
13949
|
+
"flex",
|
|
13950
|
+
"shadow-sm",
|
|
13951
|
+
"rounded-lg",
|
|
13952
|
+
"border",
|
|
13953
|
+
"border-slate-300",
|
|
13954
|
+
"focus-within:ring-2",
|
|
13955
|
+
"focus-within:ring-offset-2",
|
|
13956
|
+
"focus-within:ring-offset-white",
|
|
13957
|
+
"focus-within:ring-primary-600",
|
|
13958
|
+
"focus-within:border-slate-400",
|
|
13959
|
+
"hover:border-slate-400",
|
|
13960
|
+
"hover:bg-slate-50",
|
|
13961
|
+
"bg-white",
|
|
13962
|
+
"transition",
|
|
13963
|
+
], {
|
|
13964
|
+
variants: {
|
|
13965
|
+
invalid: {
|
|
13966
|
+
true: "border-red-600 text-red-600 hover:border-red-600 focus-within:ring-red-600",
|
|
13967
|
+
false: "",
|
|
13968
|
+
},
|
|
13969
|
+
disabled: {
|
|
13970
|
+
true: "!bg-slate-100",
|
|
13971
|
+
false: "",
|
|
13972
|
+
},
|
|
13973
|
+
},
|
|
13974
|
+
defaultVariants: {
|
|
13975
|
+
invalid: false,
|
|
13976
|
+
disabled: false,
|
|
13977
|
+
},
|
|
13978
|
+
});
|
|
13979
|
+
const cvaSelectIcon = cvaMerge("flex justify-center items-center text-slate-400 hover:text-slate-500 mr-2 cursor-pointer");
|
|
13980
|
+
const cvaSelectPrefix = cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "pl-2"]);
|
|
13981
|
+
const cvaSelectXIcon = cvaMerge([
|
|
13982
|
+
"flex justify-center items-center text-slate-400 hover:text-slate-500 mr-2 cursor-pointer",
|
|
13983
|
+
"ml-1",
|
|
13984
|
+
]);
|
|
13985
|
+
const cvaSelectMenuList = cvaMerge(["min-w-min", "shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
|
|
13986
|
+
variants: {
|
|
13987
|
+
menuIsOpen: {
|
|
13988
|
+
true: "animate-fade-in-fast",
|
|
13989
|
+
false: "animate-fade-out-fast",
|
|
13990
|
+
},
|
|
13991
|
+
},
|
|
13992
|
+
});
|
|
13993
|
+
const cvaSelectDynamicTagContainer = cvaMerge(["h-full", "flex", "gap-1", "items-center"], {
|
|
13994
|
+
variants: {
|
|
13995
|
+
visible: { true: "visible", false: "invisible" },
|
|
13996
|
+
},
|
|
13997
|
+
});
|
|
13998
|
+
const cvaSelectCounter = cvaMerge(["overflow-hidden", "whitespace-nowrap"]);
|
|
13999
|
+
const cvaSelectMenu = cvaMerge(["relative", "p-1", "grid", "gap-1"]);
|
|
14000
|
+
|
|
13696
14001
|
/**
|
|
13697
14002
|
* The SelectContainer component.
|
|
13698
14003
|
*
|
|
13699
14004
|
* @param {SelectContainerProps} props - The props for the SelectContainer component
|
|
13700
14005
|
* @returns {JSX.Element} SelectContainer component
|
|
13701
14006
|
*/
|
|
13702
|
-
const SelectContainer
|
|
13703
|
-
return (jsxs(
|
|
14007
|
+
const SelectContainer = ({ children, label, hideLabel, id, hasError, error, description, info, dataTestId, isDisabled, }) => {
|
|
14008
|
+
return (jsxs("label", { className: cvaSelect({ invalid: hasError, disabled: isDisabled }), "data-testid": dataTestId, children: [label && !hideLabel && jsx$1(Label, { htmlFor: id, children: label }), children, (hasError || info) && jsx$1(Text, { size: "small", children: hasError ? error : info })] }));
|
|
13704
14009
|
};
|
|
13705
|
-
const Container$2 = tw.label `
|
|
13706
|
-
tu-select__container
|
|
13707
|
-
tu-select
|
|
13708
|
-
${({ $hasError }) => ($hasError ? tws `tu-select--invalid` : null)}
|
|
13709
|
-
${({ $isDisabled }) => ($isDisabled ? tws `tu-select--disabled` : null)}
|
|
13710
|
-
`;
|
|
13711
|
-
const InformativeText = twx(Text) `
|
|
13712
|
-
tu-informative-text
|
|
13713
|
-
${p => (p.$hasError ? `tu-informative-text--error` : null)}
|
|
13714
|
-
`;
|
|
13715
14010
|
|
|
13716
14011
|
/**
|
|
13717
14012
|
* @param {MultiValue<Option> | SingleValue<Option>} arg option to check type
|
|
@@ -13760,9 +14055,6 @@ const getOrderedOptions = (options, value) => {
|
|
|
13760
14055
|
}
|
|
13761
14056
|
return options || [];
|
|
13762
14057
|
};
|
|
13763
|
-
const SelectPrefix = tw.div `
|
|
13764
|
-
tu-select__prefix
|
|
13765
|
-
`;
|
|
13766
14058
|
|
|
13767
14059
|
/**
|
|
13768
14060
|
* A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
|
|
@@ -13842,7 +14134,7 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
|
|
|
13842
14134
|
const isLast = index === items.length;
|
|
13843
14135
|
const counterRequired = requiredSpace > availableSpace && counter !== 0;
|
|
13844
14136
|
if (isLast && counterRequired) {
|
|
13845
|
-
return (jsx$1(TagWithWidth, { onWidthKnown: ({ width: reportedWidth }) => setCounterWidth(reportedWidth), color: "neutral", disabled: disabled, children: jsxs(
|
|
14137
|
+
return (jsx$1(TagWithWidth, { onWidthKnown: ({ width: reportedWidth }) => setCounterWidth(reportedWidth), color: "neutral", disabled: disabled, children: jsxs("div", { "data-testid": "select-counter", className: cvaSelectCounter(), children: ["+", counter] }) }, item.text + index));
|
|
13846
14138
|
}
|
|
13847
14139
|
if (isLast) {
|
|
13848
14140
|
return null;
|
|
@@ -13861,19 +14153,10 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
|
|
|
13861
14153
|
return null;
|
|
13862
14154
|
})
|
|
13863
14155
|
.filter(element => element !== null);
|
|
13864
|
-
return (jsxs(
|
|
14156
|
+
return (jsxs("div", { style: {
|
|
13865
14157
|
width: `${width}`,
|
|
13866
|
-
},
|
|
14158
|
+
}, className: cvaSelectDynamicTagContainer({ visible: isReady }), ref: containerRef, children: [renderedElements, postFix] }));
|
|
13867
14159
|
};
|
|
13868
|
-
const Container$1 = tw.div `
|
|
13869
|
-
tu-select__dynamic-tag--container
|
|
13870
|
-
${({ $ready }) => {
|
|
13871
|
-
return $ready ? tws `visible` : tws `invisible`;
|
|
13872
|
-
}}
|
|
13873
|
-
`;
|
|
13874
|
-
const Counter = tw.div `
|
|
13875
|
-
tu-select__counter
|
|
13876
|
-
`;
|
|
13877
14160
|
|
|
13878
14161
|
/**
|
|
13879
14162
|
* A hook to retrieve components override object.
|
|
@@ -13917,7 +14200,7 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
|
|
|
13917
14200
|
: [], postFix: searchInput, disabled: disabled })) : (jsxs(Fragment$1, { children: [tags &&
|
|
13918
14201
|
tags.slice(0, maxSelectedDisplayCount).map(({ props: tagProps }) => {
|
|
13919
14202
|
var _a, _b;
|
|
13920
|
-
return (jsx$1(Tag, { className:
|
|
14203
|
+
return (jsx$1(Tag, { className: "shrink-0 inline-flex", onClose: e => {
|
|
13921
14204
|
var _a, _b;
|
|
13922
14205
|
e.stopPropagation();
|
|
13923
14206
|
refMenuIsEnabled.current = false;
|
|
@@ -13927,23 +14210,21 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
|
|
|
13927
14210
|
}
|
|
13928
14211
|
return (jsx$1(components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled, children: props.children })));
|
|
13929
14212
|
}, LoadingIndicator: props => {
|
|
13930
|
-
return jsx$1(Spinner, { size: "small", className:
|
|
14213
|
+
return jsx$1(Spinner, { size: "small", className: "mt-1.5 mr-1" });
|
|
13931
14214
|
}, DropdownIndicator: props => {
|
|
13932
14215
|
const icon = props.selectProps.menuIsOpen ? (jsx$1(Icon, { name: "ChevronUpIcon", size: "medium" })) : (jsx$1(Icon, { name: "ChevronDownIcon", size: "medium" }));
|
|
13933
|
-
return props.selectProps.isLoading ? null : (jsx$1(components.DropdownIndicator, Object.assign({}, props, { children: jsx$1(
|
|
14216
|
+
return props.selectProps.isLoading ? null : (jsx$1(components.DropdownIndicator, Object.assign({}, props, { children: jsx$1("div", { className: cvaSelectIcon(), children: dropdownIcon ? dropdownIcon : icon }) })));
|
|
13934
14217
|
}, IndicatorSeparator: () => null, ClearIndicator: props => {
|
|
13935
14218
|
if (disabled) {
|
|
13936
14219
|
return null;
|
|
13937
14220
|
}
|
|
13938
|
-
return (jsx$1(components.ClearIndicator, Object.assign({}, props, { children: jsx$1(
|
|
14221
|
+
return (jsx$1(components.ClearIndicator, Object.assign({}, props, { children: jsx$1("div", { className: cvaSelectXIcon(), onClick: props.clearValue, "data-testid": dataTestId && `${dataTestId}-XMarkIcon`, children: jsx$1(Icon, { name: "XCircleIcon", size: "medium" }) }) })));
|
|
13939
14222
|
}, Control: props => {
|
|
13940
|
-
return
|
|
14223
|
+
return jsx$1(components.Control, Object.assign({}, props, { className: props.isDisabled ? "bg-slate-100" : "" }));
|
|
13941
14224
|
}, SingleValue: props => {
|
|
13942
|
-
return (jsx$1(components.SingleValue, Object.assign({}, props, { className: props.isDisabled ?
|
|
14225
|
+
return (jsx$1(components.SingleValue, Object.assign({}, props, { className: props.isDisabled ? "text-slate-700" : "", children: jsx$1("div", { "data-testid": dataTestId + "-singleValue", children: props.children }) })));
|
|
13943
14226
|
}, Menu: props => {
|
|
13944
|
-
return (jsx$1(components.Menu, Object.assign({}, props, { className: props.selectProps.menuIsOpen
|
|
13945
|
-
? tws `tu-select__menu-list animate-fade-in-fast`
|
|
13946
|
-
: tws `tu-select__menu-list animate-fade-out-fast` })));
|
|
14227
|
+
return (jsx$1(components.Menu, Object.assign({}, props, { className: cvaSelectMenuList({ menuIsOpen: props.selectProps.menuIsOpen }) })));
|
|
13947
14228
|
}, MenuList: props => {
|
|
13948
14229
|
return (jsx$1(components.MenuList, Object.assign({}, props, { innerProps: Object.assign(Object.assign({}, props.innerProps), { onScroll: e => {
|
|
13949
14230
|
const listEl = e.currentTarget;
|
|
@@ -13964,13 +14245,6 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
|
|
|
13964
14245
|
}, [componentsProps, disabled, maxSelectedDisplayCount]); // do not add dropdownIcon (it will cause issue with opening/closing list for selects with custom icon)
|
|
13965
14246
|
return customComponents;
|
|
13966
14247
|
};
|
|
13967
|
-
const StyledIcon = tw.div `
|
|
13968
|
-
tu-select--icon
|
|
13969
|
-
`;
|
|
13970
|
-
const XMarkIcon = tw.div `
|
|
13971
|
-
tu-select--icon
|
|
13972
|
-
tu-select__x-icon
|
|
13973
|
-
`;
|
|
13974
14248
|
|
|
13975
14249
|
/**
|
|
13976
14250
|
* @template IsMulti
|
|
@@ -14059,7 +14333,7 @@ const useSelect = (_a) => {
|
|
|
14059
14333
|
* @returns {JSX.Element} CreatableSelect component
|
|
14060
14334
|
*/
|
|
14061
14335
|
const CreatableSelect = (props) => {
|
|
14062
|
-
const { id, dataTestId = "select", async, maxMenuHeight = 200, label, error, disabled, isMulti, value, hideLabel, description, info, options, onChange, isLoading, classNamePrefix = "", filterOption, prefix, onInputChange, placeholder, isClearable } = props;
|
|
14336
|
+
const { id, dataTestId = "select", async, maxMenuHeight = 200, label, error, disabled, isMulti, value, hideLabel, description, info, options, onChange, isLoading, classNamePrefix = "", filterOption, prefix, onInputChange, placeholder, isClearable, } = props;
|
|
14063
14337
|
const hasError = !!error;
|
|
14064
14338
|
const { refPrefix, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler, orderedOptions, } = useSelect(props);
|
|
14065
14339
|
const selectProps = {
|
|
@@ -14089,7 +14363,7 @@ const CreatableSelect = (props) => {
|
|
|
14089
14363
|
isClearable,
|
|
14090
14364
|
id,
|
|
14091
14365
|
};
|
|
14092
|
-
return (jsx$1(SelectContainer
|
|
14366
|
+
return (jsx$1(SelectContainer, { label: label, hideLabel: hideLabel, id: id, hasError: hasError, error: error, description: description, info: info, dataTestId: dataTestId, isDisabled: disabled, children: jsxs(Fragment$1, { children: [prefix !== undefined && (jsx$1("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsx$1(AsyncCreatableSelect$1, Object.assign({ "aria-label": label, maxMenuHeight: maxMenuHeight, "data-testid": dataTestId, components: customComponents }, props, { onMenuOpen: () => {
|
|
14093
14367
|
!disabled && openMenuHandler();
|
|
14094
14368
|
}, onMenuClose: () => {
|
|
14095
14369
|
closeMenuHandler();
|
|
@@ -14146,14 +14420,8 @@ const Select = (props) => {
|
|
|
14146
14420
|
onMenuScrollToBottom,
|
|
14147
14421
|
onInputChange,
|
|
14148
14422
|
};
|
|
14149
|
-
return (jsxs(
|
|
14423
|
+
return (jsxs("div", { ref: refContainer, className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, children: [prefix !== undefined && (jsx$1("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsx$1(AsyncSelect$1, Object.assign({}, propsNoClassName, selectProps, async, { onMenuOpen: openMenuHandler, onMenuClose: closeMenuHandler }))) : (jsx$1(StateManagedSelect$1, Object.assign({}, propsNoClassName, selectProps, { options: filterOption ? orderedOptions : options, isMulti: isMulti, hideSelectedOptions: false, onMenuOpen: openMenuHandler, onMenuClose: closeMenuHandler })))] }));
|
|
14150
14424
|
};
|
|
14151
|
-
const SelectContainer = tw.div `
|
|
14152
|
-
tu-select
|
|
14153
|
-
${({ $hasError }) => ($hasError ? tws `tu-select--invalid` : null)}
|
|
14154
|
-
${({ $isDisabled }) => ($isDisabled ? tws `tu-select--disabled` : null)}
|
|
14155
|
-
${({ $isReadOnly }) => ($isReadOnly ? tws `tu-select--readonly` : null)}
|
|
14156
|
-
`;
|
|
14157
14425
|
Select.displayName = "Select";
|
|
14158
14426
|
|
|
14159
14427
|
const COUNTRY_CODES_NOT_SUPPORTED_BY_BACKEND = ["53", "98", "211", "247", "249", "383", "850", "963"];
|
|
@@ -14268,6 +14536,103 @@ const PhoneField = forwardRef((_a, ref) => {
|
|
|
14268
14536
|
return (jsx$1(FormGroup, { htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, disabled: rest.disabled, className: className, dataTestId: dataTestId && `${dataTestId}-FormGroup`, children: jsx$1(PhoneInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", value: combinedValue, defaultValue: defaultValue, ref: ref, dataTestId: dataTestId }, rest)) }));
|
|
14269
14537
|
});
|
|
14270
14538
|
|
|
14539
|
+
const cvaRadioGroup = cvaMerge(["flex", "gap-2", "flex-col", "items-start"], {
|
|
14540
|
+
variants: {
|
|
14541
|
+
layout: {
|
|
14542
|
+
inline: ["flex", "gap-3", "flex-row", "items-center"],
|
|
14543
|
+
},
|
|
14544
|
+
},
|
|
14545
|
+
});
|
|
14546
|
+
const cvaRadioItem = cvaMerge([
|
|
14547
|
+
"w-4",
|
|
14548
|
+
"h-4",
|
|
14549
|
+
"appearance-none",
|
|
14550
|
+
"rounded-3xl",
|
|
14551
|
+
"bg-white",
|
|
14552
|
+
"border-solid",
|
|
14553
|
+
"border",
|
|
14554
|
+
"border-slate-300",
|
|
14555
|
+
"shadow-sm",
|
|
14556
|
+
"shrink-0",
|
|
14557
|
+
"transition",
|
|
14558
|
+
"box-border",
|
|
14559
|
+
"hover:cursor-pointer",
|
|
14560
|
+
"hover:bg-slate-100",
|
|
14561
|
+
"focus:ring-2",
|
|
14562
|
+
"focus:ring-offset-2",
|
|
14563
|
+
"focus:ring-blue-700",
|
|
14564
|
+
], {
|
|
14565
|
+
variants: {
|
|
14566
|
+
checked: {
|
|
14567
|
+
true: [
|
|
14568
|
+
"border-solid",
|
|
14569
|
+
"border-4",
|
|
14570
|
+
"border-blue-600",
|
|
14571
|
+
"bg-white",
|
|
14572
|
+
"hover:bg-slate-100",
|
|
14573
|
+
"hover:cursor-pointer",
|
|
14574
|
+
"outline-0",
|
|
14575
|
+
"active:bg-slate-200",
|
|
14576
|
+
"active:ring-2",
|
|
14577
|
+
"active:ring-offset-2",
|
|
14578
|
+
"active:ring-blue-700",
|
|
14579
|
+
"focus:bg-slate-200",
|
|
14580
|
+
"focus:ring-2",
|
|
14581
|
+
"focus:ring-offset-2",
|
|
14582
|
+
"focus:ring-blue-700",
|
|
14583
|
+
"group-active:ring-2",
|
|
14584
|
+
"group-active:ring-offset-2",
|
|
14585
|
+
"group-active:ring-blue-700",
|
|
14586
|
+
],
|
|
14587
|
+
false: "",
|
|
14588
|
+
},
|
|
14589
|
+
invalid: {
|
|
14590
|
+
true: [
|
|
14591
|
+
"border-red-600",
|
|
14592
|
+
"active:ring-red-700",
|
|
14593
|
+
"focus:ring-red-700",
|
|
14594
|
+
"group-focus:ring-2",
|
|
14595
|
+
"group-focus:ring-offset-2",
|
|
14596
|
+
],
|
|
14597
|
+
false: "",
|
|
14598
|
+
},
|
|
14599
|
+
disabled: {
|
|
14600
|
+
true: [
|
|
14601
|
+
"bg-slate-400",
|
|
14602
|
+
"border-slate-300",
|
|
14603
|
+
"cursor-not-allowed",
|
|
14604
|
+
"group-hover:bg-slate-400",
|
|
14605
|
+
"group-focus:bg-slate-400",
|
|
14606
|
+
"hover:bg-slate-400",
|
|
14607
|
+
"focus:bg-slate-400",
|
|
14608
|
+
"active:bg-slate-400",
|
|
14609
|
+
"focus:ring-0",
|
|
14610
|
+
"focus:ring-offset-0",
|
|
14611
|
+
"group-active:ring-0",
|
|
14612
|
+
"group-active:ring-offset-0",
|
|
14613
|
+
],
|
|
14614
|
+
false: "",
|
|
14615
|
+
},
|
|
14616
|
+
},
|
|
14617
|
+
compoundVariants: [
|
|
14618
|
+
{
|
|
14619
|
+
checked: true,
|
|
14620
|
+
disabled: true,
|
|
14621
|
+
className: ["bg-white"],
|
|
14622
|
+
},
|
|
14623
|
+
],
|
|
14624
|
+
});
|
|
14625
|
+
const cvaRadioItemWrapper = cvaMerge(["flex", "gap-2", "items-center"]);
|
|
14626
|
+
const cvaRadioItemLabelContainer = cvaMerge(["gap-y-1", "grid"]);
|
|
14627
|
+
const cvaRadioItemDescription = cvaMerge(["text-sm", "font-normal", "text-slate-500", "text-left", "whitespace-nowrap", "text-ellipsis", "overflow-hidden"], {
|
|
14628
|
+
variants: {
|
|
14629
|
+
disabled: {
|
|
14630
|
+
true: ["text-slate-400", "hover:text-slate-400", "group-hover:text-slate-400"],
|
|
14631
|
+
false: "",
|
|
14632
|
+
},
|
|
14633
|
+
},
|
|
14634
|
+
});
|
|
14635
|
+
|
|
14271
14636
|
const RadioGroupContext = React.createContext(null);
|
|
14272
14637
|
|
|
14273
14638
|
/**
|
|
@@ -14283,7 +14648,7 @@ const RadioGroupContext = React.createContext(null);
|
|
|
14283
14648
|
* @returns {JSX.Element} RadioGroup component
|
|
14284
14649
|
*/
|
|
14285
14650
|
const RadioGroup = ({ children, id, name, value, disabled, onChange, label, inline, className, dataTestId, isInvalid, }) => {
|
|
14286
|
-
return (jsx$1(FormGroup, { label: label, dataTestId: dataTestId && `${dataTestId}-FormGroup`, children: jsx$1(
|
|
14651
|
+
return (jsx$1(FormGroup, { label: label, dataTestId: dataTestId && `${dataTestId}-FormGroup`, children: jsx$1("div", { className: cvaRadioGroup({ layout: inline ? "inline" : null, className }), "data-testid": dataTestId, children: jsx$1(RadioGroupContext.Provider, { value: {
|
|
14287
14652
|
id,
|
|
14288
14653
|
value,
|
|
14289
14654
|
name: name || id,
|
|
@@ -14293,9 +14658,6 @@ const RadioGroup = ({ children, id, name, value, disabled, onChange, label, inli
|
|
|
14293
14658
|
}, children: children }) }) }));
|
|
14294
14659
|
};
|
|
14295
14660
|
RadioGroup.displayName = "RadioGroup";
|
|
14296
|
-
const Flex = tw.div `
|
|
14297
|
-
${({ $inline }) => ($inline ? tws `tu-radiogroup--inline` : tws `tu-radiogroup`)}
|
|
14298
|
-
`;
|
|
14299
14661
|
|
|
14300
14662
|
/**
|
|
14301
14663
|
* The RadioItem component.
|
|
@@ -14306,20 +14668,12 @@ ${({ $inline }) => ($inline ? tws `tu-radiogroup--inline` : tws `tu-radiogroup`)
|
|
|
14306
14668
|
const RadioItem = ({ label, value, dataTestId, className, description, }) => {
|
|
14307
14669
|
const groupCtx = React.useContext(RadioGroupContext);
|
|
14308
14670
|
const isChecked = (groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.value) === value;
|
|
14309
|
-
return (jsxs(
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
|
|
14315
|
-
${({ $disabled }) => $disabled && tws `tu-radioitem--disabled`}
|
|
14316
|
-
${({ $isInvalid }) => $isInvalid && tws `tu-radioitem--invalid`}
|
|
14317
|
-
`;
|
|
14318
|
-
const LabelContainer$1 = tw.div `tu-radioitem__label-container`;
|
|
14319
|
-
const Description$1 = tw.label `
|
|
14320
|
-
tu-radioitem__description
|
|
14321
|
-
${({ $disabled }) => $disabled && tws `tu-radioitem__description--disabled`}
|
|
14322
|
-
`;
|
|
14671
|
+
return (jsxs("label", { className: cvaRadioItemWrapper({ className }), htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, "data-testid": dataTestId && `${dataTestId}-Wrapper`, children: [jsx$1("input", { id: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, type: "radio", value: value, checked: isChecked, className: cvaRadioItem({
|
|
14672
|
+
checked: isChecked,
|
|
14673
|
+
disabled: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
|
|
14674
|
+
invalid: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid,
|
|
14675
|
+
}), onChange: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.onChange, "data-testid": dataTestId }), jsxs("div", { className: cvaRadioItemLabelContainer(), children: [jsx$1(Label, { htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, dataTestId: dataTestId && `${dataTestId}-Label`, disabled: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled, isInvalid: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid, children: label }), description && (jsx$1("label", { className: cvaRadioItemDescription({ disabled: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled }), htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, "data-testid": dataTestId && `${dataTestId}-Description`, children: description }))] })] }));
|
|
14676
|
+
};
|
|
14323
14677
|
|
|
14324
14678
|
const cvaTimeRange = cvaMerge([
|
|
14325
14679
|
"flex",
|
|
@@ -14387,6 +14741,32 @@ const Schedule = ({ className, dataTestId, schedule, onChange, invalidKeys = []
|
|
|
14387
14741
|
*/
|
|
14388
14742
|
const TextInput = forwardRef((props, ref) => (jsx$1(BaseInput, Object.assign({ ref: ref, type: "text" }, props))));
|
|
14389
14743
|
|
|
14744
|
+
const cvaSearch = cvaMerge([
|
|
14745
|
+
"shadow-none",
|
|
14746
|
+
"component-search-borderless",
|
|
14747
|
+
"component-search-background",
|
|
14748
|
+
"hover:component-search-background",
|
|
14749
|
+
"hover:component-search-focus-hover",
|
|
14750
|
+
"focus:component-search-focus-hover",
|
|
14751
|
+
"focus-within:component-search-focus-within",
|
|
14752
|
+
"transition-all",
|
|
14753
|
+
"duration-300",
|
|
14754
|
+
], {
|
|
14755
|
+
variants: {
|
|
14756
|
+
border: { true: ["!component-search-border"], false: "" },
|
|
14757
|
+
widenOnFocus: {
|
|
14758
|
+
true: [
|
|
14759
|
+
"component-search-width",
|
|
14760
|
+
"component-search-widen",
|
|
14761
|
+
"hover:component-search-widen",
|
|
14762
|
+
"focus-within:component-search-widen-focus",
|
|
14763
|
+
"focus-within:w-full",
|
|
14764
|
+
],
|
|
14765
|
+
false: "w-full",
|
|
14766
|
+
},
|
|
14767
|
+
},
|
|
14768
|
+
});
|
|
14769
|
+
|
|
14390
14770
|
/**
|
|
14391
14771
|
* The Search component is used to render a search input field.
|
|
14392
14772
|
*
|
|
@@ -14394,44 +14774,54 @@ const TextInput = forwardRef((props, ref) => (jsx$1(BaseInput, Object.assign({ r
|
|
|
14394
14774
|
* @returns {JSX.Element} Search component
|
|
14395
14775
|
*/
|
|
14396
14776
|
const Search = (_a) => {
|
|
14397
|
-
var { className, placeholder = "Search", value, widenInputOnFocus, showBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on"
|
|
14398
|
-
return (jsx$1(
|
|
14777
|
+
var { className, placeholder = "Search", value, widenInputOnFocus, showBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on" } = _a, rest = __rest(_a, ["className", "placeholder", "value", "widenInputOnFocus", "showBorderWhenNotInFocus", "disabled", "onKeyUp", "onChange", "onFocus", "onBlur", "name", "onClear", "dataTestId", "autoComplete"]);
|
|
14778
|
+
return (jsx$1(TextInput, Object.assign({}, rest, { dataTestId: dataTestId, name: name, className: cvaSearch({ className, border: showBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), placeholder: placeholder, prefix: jsx$1(Icon, { name: "MagnifyingGlassIcon", size: "medium" }), suffix: onClear ? (jsx$1("button", { "data-testid": dataTestId && `${dataTestId}_suffix_component`, onClick: () => {
|
|
14399
14779
|
onClear();
|
|
14400
14780
|
}, children: jsx$1(Icon, { name: "XMarkIcon", size: "small" }) })) : undefined, value: value, disabled: disabled, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, autoComplete: autoComplete })));
|
|
14401
14781
|
};
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14406
|
-
|
|
14782
|
+
|
|
14783
|
+
const cvaTextArea = cvaMerge([
|
|
14784
|
+
cvaInputBase(),
|
|
14785
|
+
"block",
|
|
14786
|
+
"overflow-auto",
|
|
14787
|
+
"appearance-none",
|
|
14788
|
+
"px-3",
|
|
14789
|
+
"py-2",
|
|
14790
|
+
"bg-transparent",
|
|
14791
|
+
"text-base",
|
|
14792
|
+
"text-slate-900",
|
|
14793
|
+
"placeholder-slate-400",
|
|
14794
|
+
"focus-visible:outline-none",
|
|
14795
|
+
"w-full",
|
|
14796
|
+
"h-20",
|
|
14797
|
+
"transition",
|
|
14798
|
+
], {
|
|
14799
|
+
variants: {
|
|
14800
|
+
disabled: {
|
|
14801
|
+
true: cvaInputBaseDisabled(),
|
|
14802
|
+
false: "",
|
|
14803
|
+
},
|
|
14804
|
+
invalid: {
|
|
14805
|
+
true: cvaInputBaseInvalid(),
|
|
14806
|
+
false: "",
|
|
14807
|
+
},
|
|
14808
|
+
resize: {
|
|
14809
|
+
both: "resize",
|
|
14810
|
+
vertical: "resize-y",
|
|
14811
|
+
horizontal: "resize-x",
|
|
14812
|
+
none: "resize-none",
|
|
14813
|
+
},
|
|
14814
|
+
},
|
|
14815
|
+
});
|
|
14407
14816
|
|
|
14408
14817
|
/**
|
|
14409
14818
|
* The TextArea is a base component, and should not be used very often.
|
|
14410
14819
|
* For most cases the TextAreaField is the correct component.
|
|
14411
14820
|
*/
|
|
14412
14821
|
const TextArea = React.forwardRef((_a, ref) => {
|
|
14413
|
-
var { id, name, value, rows, disabled, placeholder, readOnly, tabIndex, onChange, onFocus, onBlur, maxLength, resize = "vertical", defaultValue, required, dataTestId, isInvalid } = _a, rest = __rest(_a, ["id", "name", "value", "rows", "disabled", "placeholder", "readOnly", "tabIndex", "onChange", "onFocus", "onBlur", "maxLength", "resize", "defaultValue", "required", "dataTestId", "isInvalid"]);
|
|
14414
|
-
return (jsx$1(
|
|
14822
|
+
var { id, name, value, rows, disabled, placeholder, readOnly, tabIndex, onChange, onFocus, onBlur, maxLength, resize = "vertical", defaultValue, required, dataTestId, isInvalid, className } = _a, rest = __rest(_a, ["id", "name", "value", "rows", "disabled", "placeholder", "readOnly", "tabIndex", "onChange", "onFocus", "onBlur", "maxLength", "resize", "defaultValue", "required", "dataTestId", "isInvalid", "className"]);
|
|
14823
|
+
return (jsx$1("textarea", Object.assign({ id: id, name: name, value: value, rows: rows, disabled: disabled, placeholder: placeholder, readOnly: readOnly, tabIndex: tabIndex, onFocus: onFocus, onBlur: onBlur, maxLength: maxLength, ref: ref, defaultValue: defaultValue, required: required, className: cvaTextArea({ className, resize, invalid: isInvalid, disabled }) }, rest, { onChange: onChange, "data-testid": dataTestId })));
|
|
14415
14824
|
});
|
|
14416
|
-
const StyledTextArea = tw.textarea `
|
|
14417
|
-
tu-textarea
|
|
14418
|
-
${({ $invalid }) => ($invalid ? tws `tu-textarea--invalid` : null)}
|
|
14419
|
-
${({ disabled }) => (disabled ? tws `tu-textarea--disabled` : null)}
|
|
14420
|
-
${({ $resize }) => {
|
|
14421
|
-
switch ($resize) {
|
|
14422
|
-
case "both":
|
|
14423
|
-
return tws `resize`;
|
|
14424
|
-
case "horizontal":
|
|
14425
|
-
return tws `resize-x`;
|
|
14426
|
-
case "vertical":
|
|
14427
|
-
return tws `resize-y`;
|
|
14428
|
-
case "none":
|
|
14429
|
-
return tws `resize-none`;
|
|
14430
|
-
default:
|
|
14431
|
-
return null;
|
|
14432
|
-
}
|
|
14433
|
-
}};
|
|
14434
|
-
`;
|
|
14435
14825
|
|
|
14436
14826
|
/**
|
|
14437
14827
|
* The TextLengthIndicator component shows a `{length}/{maxLength}` label.
|
|
@@ -14497,6 +14887,64 @@ const TimeRangeField = (_a) => {
|
|
|
14497
14887
|
return (jsx$1(FormGroup, { htmlFor: htmlFor, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, dataTestId: dataTestId && `${dataTestId}-FormGroup`, disabled: disabled, children: jsx$1(TimeRange, Object.assign({ className: className, onChange: onChange, disabled: disabled, dataTestId: dataTestId, isInvalid: renderAsInvalid, children: children }, rest)) }));
|
|
14498
14888
|
};
|
|
14499
14889
|
|
|
14890
|
+
const cvaToggleWrapper = cvaMerge(["flex", "gap-2"]);
|
|
14891
|
+
cvaMerge(["relative"]);
|
|
14892
|
+
const cvaToggleTrack = cvaMerge([
|
|
14893
|
+
"shrink-0",
|
|
14894
|
+
"p-1",
|
|
14895
|
+
"cursor-pointer",
|
|
14896
|
+
"rounded-full",
|
|
14897
|
+
"bg-slate-300",
|
|
14898
|
+
"focus:bg-slate-400",
|
|
14899
|
+
"hover:bg-slate-400",
|
|
14900
|
+
"active:bg-slate-500",
|
|
14901
|
+
], {
|
|
14902
|
+
variants: {
|
|
14903
|
+
size: {
|
|
14904
|
+
small: ["w-8", "h-4"],
|
|
14905
|
+
medium: ["w-9", "h-5"],
|
|
14906
|
+
},
|
|
14907
|
+
disabled: {
|
|
14908
|
+
true: ["cursor-not-allowed", "pointer-events-none", "bg-slate-200"],
|
|
14909
|
+
false: "",
|
|
14910
|
+
},
|
|
14911
|
+
toggled: {
|
|
14912
|
+
true: ["bg-blue-600", "focus:bg-blue-700", "hover:bg-blue-700", "active:bg-blue-800"],
|
|
14913
|
+
false: "",
|
|
14914
|
+
},
|
|
14915
|
+
},
|
|
14916
|
+
compoundVariants: [
|
|
14917
|
+
{
|
|
14918
|
+
disabled: true,
|
|
14919
|
+
toggled: true,
|
|
14920
|
+
className: ["bg-slate-400"],
|
|
14921
|
+
},
|
|
14922
|
+
],
|
|
14923
|
+
defaultVariants: {
|
|
14924
|
+
size: "medium",
|
|
14925
|
+
},
|
|
14926
|
+
});
|
|
14927
|
+
const cvaToggleThumb = cvaMerge(["block", "rounded-full", "bg-white", "h-full", "aspect-square", "translate-x-0", "transition-all"], {
|
|
14928
|
+
variants: {
|
|
14929
|
+
toggled: {
|
|
14930
|
+
true: ["translate-x-4"],
|
|
14931
|
+
false: "",
|
|
14932
|
+
},
|
|
14933
|
+
},
|
|
14934
|
+
defaultVariants: {},
|
|
14935
|
+
});
|
|
14936
|
+
const cvaToggleInput = cvaMerge(["absolute", "opacity-0", "-z-10"]);
|
|
14937
|
+
const cvaToggleLabelContainer = cvaMerge(["grid", "gap-1"]);
|
|
14938
|
+
const cvaToggleLabel = cvaMerge([]);
|
|
14939
|
+
const cvaToggleDescription = cvaMerge(["text-sm", "font-normal", "text-slate-500", "text-left", "whitespace-nowrap", "text-ellipsis", "overflow-hidden"], {
|
|
14940
|
+
variants: {
|
|
14941
|
+
disabled: {
|
|
14942
|
+
true: "text-slate-400 hover:text-slate-400 group-hover:text-slate-400",
|
|
14943
|
+
false: "",
|
|
14944
|
+
},
|
|
14945
|
+
},
|
|
14946
|
+
});
|
|
14947
|
+
|
|
14500
14948
|
/**
|
|
14501
14949
|
* Use Toggle when you have to only enable/disable a feature.
|
|
14502
14950
|
*
|
|
@@ -14507,28 +14955,26 @@ const TimeRangeField = (_a) => {
|
|
|
14507
14955
|
* @param {ToggleProps} props - The props for the Toggle component
|
|
14508
14956
|
* @returns {JSX.Element} Toggle component
|
|
14509
14957
|
*/
|
|
14510
|
-
const Toggle = React.forwardRef(({ toggled = false, onChange, onClick, disabled, size = "medium", id, tabIndex, required, className, dataTestId, onBlur, name, description = "", }, ref) => {
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14958
|
+
const Toggle = React.forwardRef(({ toggled = false, onChange, onClick, disabled, size = "medium", id, tabIndex, required, className, dataTestId = "toggle", onBlur, name, description = "", }, ref) => {
|
|
14959
|
+
const showLabelContainer = Boolean(name || description);
|
|
14960
|
+
const getTestId = (suffix) => `${dataTestId}-${suffix}`;
|
|
14961
|
+
return (jsx$1("span", { className: className, onClick: onClick, "data-testid": getTestId("outer-wrapper"), children: jsxs("label", { className: cvaToggleWrapper(), htmlFor: id, "data-testid": getTestId("wrapper"), children: [jsx$1("span", { className: cvaToggleTrack({ disabled, size, toggled }), "data-testid": getTestId("track"), children: jsx$1("span", { className: cvaToggleThumb({ toggled }), "data-testid": getTestId("thumb") }) }), showLabelContainer && (jsxs("span", { className: cvaToggleLabelContainer(), "data-testid": getTestId("label-container"), children: [jsx$1(Label, { className: cvaToggleLabel(), "data-testid": getTestId("label"), disabled: disabled, children: name }), jsx$1("span", { className: cvaToggleDescription({ disabled }), "data-testid": getTestId("description"), children: description })] })), jsx$1("input", { name: name, className: cvaToggleInput(), type: "checkbox", checked: toggled, disabled: disabled, onChange: e => {
|
|
14962
|
+
e.stopPropagation();
|
|
14963
|
+
onChange(!toggled, e);
|
|
14964
|
+
}, id: id, "aria-checked": toggled, tabIndex: tabIndex, required: required, ref: ref, "data-testid": getTestId("input"), onBlur: onBlur })] }) }));
|
|
14515
14965
|
});
|
|
14516
|
-
|
|
14517
|
-
const
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
const
|
|
14528
|
-
const Description = tw.label `
|
|
14529
|
-
tu-toggle__description
|
|
14530
|
-
${({ $disabled }) => $disabled && tws `tu-toggle__description--disabled`}
|
|
14531
|
-
`;
|
|
14966
|
+
|
|
14967
|
+
const cvaUploadInputField = cvaMerge([
|
|
14968
|
+
"px-0",
|
|
14969
|
+
"py-0",
|
|
14970
|
+
"file:w-0",
|
|
14971
|
+
"file:h-0",
|
|
14972
|
+
"file:invisible",
|
|
14973
|
+
"file:px-0",
|
|
14974
|
+
"dark:text-gray-400",
|
|
14975
|
+
"self-center",
|
|
14976
|
+
]);
|
|
14977
|
+
const cvaUploadInputAddonBefore = cvaMerge(["block", "truncate", "w-28", "pt-2"]);
|
|
14532
14978
|
|
|
14533
14979
|
/**
|
|
14534
14980
|
* A thin wrapper around the `BaseInput` component for upload input fields.
|
|
@@ -14537,7 +14983,7 @@ ${({ $disabled }) => $disabled && tws `tu-toggle__description--disabled`}
|
|
|
14537
14983
|
*/
|
|
14538
14984
|
const UploadInput = forwardRef((_a, ref) => {
|
|
14539
14985
|
var { disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles } = _a, rest = __rest(_a, ["disabled", "acceptedTypes", "nonInteractive", "uploadLabel", "multipleFiles"]);
|
|
14540
|
-
return (jsx$1(UploadInputContainer, { children: jsx$1(BaseInput, Object.assign({ addonBefore: uploadLabel, ref: ref, disabled: disabled, accept: acceptedTypes, multiple: multipleFiles, type: "file", nonInteractive: nonInteractive,
|
|
14986
|
+
return (jsx$1(UploadInputContainer, { children: jsx$1(BaseInput, Object.assign({ inputClassName: cvaUploadInputField(), addonBefore: uploadLabel, addonBeforeClassName: cvaUploadInputAddonBefore(), ref: ref, disabled: disabled, accept: acceptedTypes, multiple: multipleFiles, type: "file", nonInteractive: nonInteractive,
|
|
14541
14987
|
// onClick used to work with nonInteractive option
|
|
14542
14988
|
onClick: event => {
|
|
14543
14989
|
if (nonInteractive) {
|
|
@@ -14568,4 +15014,4 @@ const UploadField = forwardRef((_a, ref) => {
|
|
|
14568
15014
|
*/
|
|
14569
15015
|
setupLibraryTranslations();
|
|
14570
15016
|
|
|
14571
|
-
export { ActionButton, BaseInput, Checkbox, CreatableSelect, DateField, DateInput, DropZone, EmailField, EmailInput, FormGroup, Label
|
|
15017
|
+
export { ActionButton, BaseInput, Checkbox, CreatableSelect, DateField, DateInput, DropZone, EmailField, EmailInput, FormGroup, Label, MultiSelectMenuItem, NumberField, NumberInput, OptionCard, PhoneField, PhoneInput, RadioGroup, RadioItem, Schedule, Search, Select, SingleSelectMenuItem, TextArea, TextAreaField, TextField, TextInput, TimeRange, TimeRangeField, Toggle, UploadField, UploadInput, StateManagedSelect$1 as ValueType, cvaInput, cvaInputAddon, cvaInputAddonAfter, cvaInputAddonBefore, cvaInputBase, cvaInputBaseDisabled, cvaInputBaseInvalid, cvaInputField, cvaInputPrefix, cvaInputSuffix, cvaSelect, cvaSelectCounter, cvaSelectDynamicTagContainer, cvaSelectIcon, cvaSelectMenu, cvaSelectMenuList, cvaSelectPrefix, cvaSelectXIcon, getOrderedOptions, isMultiValue, useCustomComponents };
|