@trackunit/react-form-components 0.0.425 → 0.0.428

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 CHANGED
@@ -213,16 +213,12 @@ const cvaInputBase = cssClassVarianceUtilities.cvaMerge([
213
213
  "component-baseInput-border",
214
214
  "component-baseInput-background",
215
215
  "border-slate-300",
216
- "focus-within:ring-2",
217
- "focus-within:ring-inset",
218
- "focus-within:ring-primary-500",
219
- "focus-within:border-slate-400",
220
216
  "hover:border-slate-400",
221
217
  "hover:bg-slate-50",
222
218
  "transition",
223
219
  ]);
224
220
  const cvaInputBaseDisabled = cssClassVarianceUtilities.cvaMerge(["bg-slate-100", "hover:bg-slate-100", "hover:border-slate-300"]);
225
- const cvaInputBaseInvalid = cssClassVarianceUtilities.cvaMerge(["border-danger-600", "focus-within:ring-danger-600"]);
221
+ const cvaInputBaseInvalid = cssClassVarianceUtilities.cvaMerge(["border-danger-600"]);
226
222
  const cvaInput = cssClassVarianceUtilities.cvaMerge(["relative", "flex", "h-10", cvaInputBase()], {
227
223
  variants: {
228
224
  size: {
@@ -231,24 +227,15 @@ const cvaInput = cssClassVarianceUtilities.cvaMerge(["relative", "flex", "h-10",
231
227
  },
232
228
  disabled: {
233
229
  true: cvaInputBaseDisabled(),
234
- false: "",
230
+ false: [""],
235
231
  },
236
232
  invalid: {
237
233
  true: cvaInputBaseInvalid(),
238
- false: "",
234
+ false: [""],
239
235
  },
240
236
  },
241
237
  });
242
- const cvaInputField = cssClassVarianceUtilities.cvaMerge([
243
- "w-full",
244
- "px-3",
245
- "border-0",
246
- "bg-transparent",
247
- "text-base",
248
- "text-slate-900",
249
- "placeholder-slate-400",
250
- "focus-visible:outline-none",
251
- ], {
238
+ const cvaInputField = cssClassVarianceUtilities.cvaMerge(["w-full", "px-3", "border-0", "bg-transparent", "text-base", "text-slate-900", "placeholder-slate-400", "component-baseInput-border"], {
252
239
  variants: {
253
240
  size: {
254
241
  small: ["py-1"],
@@ -256,9 +243,28 @@ const cvaInputField = cssClassVarianceUtilities.cvaMerge([
256
243
  },
257
244
  disabled: {
258
245
  true: ["text-slate-700"],
259
- false: "",
246
+ false: [""],
247
+ },
248
+ autoFocus: {
249
+ true: [""],
250
+ false: ["focus-visible:outline-none"],
251
+ },
252
+ addonBefore: {
253
+ true: [""],
254
+ false: [""],
255
+ },
256
+ prefix: {
257
+ true: ["ps-10"],
258
+ false: [""],
260
259
  },
261
260
  },
261
+ compoundVariants: [
262
+ {
263
+ addonBefore: true,
264
+ prefix: true,
265
+ className: ["ps-4"],
266
+ },
267
+ ],
262
268
  });
263
269
  const cvaInputAddon = cssClassVarianceUtilities.cvaMerge([
264
270
  "flex",
@@ -270,7 +276,6 @@ const cvaInputAddon = cssClassVarianceUtilities.cvaMerge([
270
276
  "bg-slate-50",
271
277
  ]);
272
278
  const cvaInputAddonBefore = cssClassVarianceUtilities.cvaMerge([cvaInputAddon(), "border-r", "rounded-l-lg"]);
273
- const cvaInputAddonAfter = cssClassVarianceUtilities.cvaMerge([cvaInputAddon(), "border-l", "rounded-r-lg"]);
274
279
  const cvaInputPrefix = cssClassVarianceUtilities.cvaMerge([
275
280
  "flex",
276
281
  "justify-center",
@@ -280,21 +285,62 @@ const cvaInputPrefix = cssClassVarianceUtilities.cvaMerge([
280
285
  "component-baseInput-prefix",
281
286
  "component-search-borderless",
282
287
  "pl-3",
288
+ "absolute",
289
+ "inset-y-0",
283
290
  ], {
284
291
  variants: {
285
292
  disabled: {
286
293
  true: ["text-slate-500"],
287
- false: "",
294
+ false: [""],
295
+ },
296
+ addonBefore: {
297
+ true: ["relative"],
298
+ false: [""],
288
299
  },
289
300
  },
290
301
  });
291
- const cvaInputSuffix = cssClassVarianceUtilities.cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "px-3"], {
302
+ const cvaInputSuffix = cssClassVarianceUtilities.cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "px-3", "absolute", "inset-y-0", "right-0"], {
292
303
  variants: {
293
304
  disabled: {
294
305
  true: ["text-slate-500"],
295
- false: "",
306
+ false: [""],
307
+ },
308
+ addonAfter: {
309
+ true: ["relative"],
310
+ false: [""],
311
+ },
312
+ actions: {
313
+ true: ["right-10"],
314
+ false: [""],
315
+ },
316
+ },
317
+ compoundVariants: [
318
+ {
319
+ addonAfter: true,
320
+ actions: true,
321
+ className: ["right-0"],
322
+ },
323
+ ],
324
+ });
325
+ const cvaInputAddonAfter = cssClassVarianceUtilities.cvaMerge([cvaInputAddon(), "border-l", "rounded-r-lg", "ml-[1px]"]);
326
+ const cvaInputAction = cssClassVarianceUtilities.cvaMerge(["absolute", "end-0.5"], {
327
+ variants: {
328
+ addonAfter: {
329
+ true: ["relative"],
330
+ false: [""],
331
+ },
332
+ suffix: {
333
+ true: ["absolute"],
334
+ false: [""],
296
335
  },
297
336
  },
337
+ compoundVariants: [
338
+ {
339
+ addonAfter: true,
340
+ suffix: true,
341
+ className: ["relative"],
342
+ },
343
+ ],
298
344
  });
299
345
 
300
346
  /**
@@ -319,12 +365,25 @@ const BaseInput = React__namespace.forwardRef((_a, ref) => {
319
365
  className,
320
366
  }), "data-testid": dataTestId && `${dataTestId}-container`, children: [addonBefore && addonBefore !== undefined ? (jsxRuntime.jsx("div", { className: cvaInputAddonBefore({ className: addonBeforeClassName }), "data-testid": dataTestId && `${dataTestId}-addonBefore`, children: addonBefore })) : null, prefix && addonBefore !== prefix ? (jsxRuntime.jsx("div", { className: cvaInputPrefix({
321
367
  disabled: renderAsDisabled,
322
- }), "data-testid": dataTestId && `${dataTestId}-prefix`, children: prefix })) : null, jsxRuntime.jsx("input", Object.assign({ "aria-required": rest.required, className: cvaInputField({ size: fieldSize, disabled: renderAsDisabled, className: inputClassName }), "data-testid": dataTestId, placeholder: renderAsDisabled ? undefined : placeholder, ref: innerRef }, rest, { readOnly: rest.readOnly || nonInteractive })), suffix && addonBefore !== suffix ? (jsxRuntime.jsx("div", { className: cvaInputSuffix({
368
+ addonBefore: addonBefore !== undefined,
369
+ }), "data-testid": dataTestId && `${dataTestId}-prefix`, children: prefix })) : null, jsxRuntime.jsx("input", Object.assign({ "aria-required": rest.required, autoFocus: rest.autoFocus, className: cvaInputField({
370
+ autoFocus: rest.autoFocus,
371
+ size: fieldSize,
372
+ disabled: renderAsDisabled,
373
+ className: inputClassName,
374
+ addonBefore: addonBefore !== undefined,
375
+ prefix: addonBefore !== prefix,
376
+ }), "data-testid": dataTestId, placeholder: renderAsDisabled ? undefined : placeholder, ref: innerRef }, rest, { readOnly: rest.readOnly || nonInteractive })), suffix && addonBefore !== suffix ? (jsxRuntime.jsx("div", { className: cvaInputSuffix({
323
377
  disabled: renderAsDisabled,
378
+ addonAfter: addonAfter !== undefined && addonBefore !== addonAfter,
379
+ actions: (actions && addonBefore !== actions) || false,
324
380
  }), "data-testid": dataTestId && `${dataTestId}-suffix`, children: suffix })) : null, rest.readOnly === true &&
325
381
  showDefaultActions &&
326
382
  ((_b = innerRef === null || innerRef === void 0 ? void 0 : innerRef.current) === null || _b === void 0 ? void 0 : _b.value.length) &&
327
- ((_c = innerRef === null || innerRef === void 0 ? void 0 : innerRef.current) === null || _c === void 0 ? void 0 : _c.value.length) > 0 ? (jsxRuntime.jsx(ActionButton, { type: "COPY", value: innerRef }, "default-copy-action")) : null, actions && addonBefore !== actions ? actions : null, addonAfter && addonAfter !== undefined && addonBefore !== addonAfter ? (jsxRuntime.jsx("div", { className: cvaInputAddonAfter(), "data-testid": dataTestId && `${dataTestId}-addonAfter`, children: addonAfter })) : null] }));
383
+ ((_c = innerRef === null || innerRef === void 0 ? void 0 : innerRef.current) === null || _c === void 0 ? void 0 : _c.value.length) > 0 ? (jsxRuntime.jsx(ActionButton, { type: "COPY", value: innerRef }, "default-copy-action")) : null, actions && addonBefore !== actions ? (jsxRuntime.jsx("div", { className: cvaInputAction({
384
+ addonAfter: addonAfter !== undefined && addonBefore !== addonAfter,
385
+ suffix: addonBefore !== suffix,
386
+ }), children: actions })) : null, addonAfter && addonAfter !== undefined && addonBefore !== addonAfter ? (jsxRuntime.jsx("div", { className: cvaInputAddonAfter(), "data-testid": dataTestId && `${dataTestId}-addonAfter`, children: addonAfter })) : null] }));
328
387
  });
329
388
 
330
389
  const cvaLabel = cssClassVarianceUtilities.cvaMerge([
@@ -378,15 +437,11 @@ const cvaCheckbox = cssClassVarianceUtilities.cvaMerge([
378
437
  "justify-center",
379
438
  "box-border",
380
439
  "transition",
381
- "focus:bg-slate-200",
382
440
  "outline-0",
383
441
  "active:bg-slate-200",
384
442
  "active:ring-2",
385
443
  "active:ring-inset",
386
444
  "active:ring-primary-700",
387
- "focus:ring-2",
388
- "focus:ring-inset",
389
- "focus:ring-primary-700",
390
445
  "cursor-pointer",
391
446
  "group-active:ring-2",
392
447
  "group-active:ring-inset",
@@ -394,13 +449,7 @@ const cvaCheckbox = cssClassVarianceUtilities.cvaMerge([
394
449
  ], {
395
450
  variants: {
396
451
  invalid: {
397
- true: [
398
- "border-red-600",
399
- "active:ring-red-700",
400
- "focus:ring-red-700",
401
- "group-focus:ring-2",
402
- "group-focus:ring-inset",
403
- ],
452
+ true: ["border-red-600", "active:ring-red-700", "group-focus:ring-2", "group-focus:ring-inset"],
404
453
  false: "",
405
454
  },
406
455
  state: {
@@ -410,11 +459,8 @@ const cvaCheckbox = cssClassVarianceUtilities.cvaMerge([
410
459
  "hover:bg-primary-700",
411
460
  "hover:border-primary-700",
412
461
  "active:bg-primary-700",
413
- "focus:bg-primary-700",
414
462
  "group-hover:bg-primary-700",
415
463
  "group-hover:border-primary-700",
416
- "group-focus:bg-primary-700",
417
- "group-focus:border-primary-700",
418
464
  ],
419
465
  deselected: ["group-hover:bg-slate-100"],
420
466
  indeterminate: [
@@ -422,14 +468,10 @@ const cvaCheckbox = cssClassVarianceUtilities.cvaMerge([
422
468
  "border-primary-600",
423
469
  "hover:bg-primary-700",
424
470
  "hover:border-primary-700",
425
- "focus:bg-primary-800",
426
- "focus:border-primary-800",
427
471
  "active:bg-primary-800",
428
472
  "active:border-primary-800",
429
473
  "group-hover:bg-primary-700",
430
474
  "group-hover:border-primary-700",
431
- "group-focus:bg-primary-800",
432
- "group-focus:border-primary-800",
433
475
  ],
434
476
  },
435
477
  disabled: {
@@ -437,13 +479,8 @@ const cvaCheckbox = cssClassVarianceUtilities.cvaMerge([
437
479
  "bg-slate-300",
438
480
  "border-slate-300",
439
481
  "cursor-not-allowed",
440
- "group-hover:bg-slate-300",
441
- "group-focus:bg-slate-300",
442
482
  "hover:bg-slate-300",
443
- "focus:bg-slate-300",
444
483
  "active:bg-slate-300",
445
- "focus:ring-0",
446
- "focus:ring-inset",
447
484
  "group-active:ring-0",
448
485
  "group-active:ring-inset",
449
486
  ],
@@ -799,7 +836,7 @@ const validateEmailAddress = (email) => {
799
836
  * For specific input types make sure to use the corresponding input component.
800
837
  */
801
838
  const EmailInput = React__namespace.forwardRef((_a, ref) => {
802
- var { fieldSize = "medium", disabled = false, dataTestId, isInvalid = false, onChange } = _a, rest = __rest(_a, ["fieldSize", "disabled", "dataTestId", "isInvalid", "onChange"]);
839
+ var { fieldSize = "medium", disabled = false, dataTestId, isInvalid = false, onChange, disableAction = false } = _a, rest = __rest(_a, ["fieldSize", "disabled", "dataTestId", "isInvalid", "onChange", "disableAction"]);
803
840
  const [email, setEmail] = React__namespace.useState("");
804
841
  const sendEmail = () => {
805
842
  return window.open(`mailto:${email}`);
@@ -811,7 +848,7 @@ const EmailInput = React__namespace.forwardRef((_a, ref) => {
811
848
  }, [onChange]);
812
849
  const renderAsInvalid = (email && !validateEmailAddress(email)) || isInvalid;
813
850
  return (jsxRuntime.jsx(BaseInput, Object.assign({ actions: email &&
814
- email.length > 0 && (jsxRuntime.jsx(ActionButton, { dataTestId: dataTestId && `${dataTestId}-emailIcon`, disabled: disabled, iconSize: fieldSize, onClick: sendEmail, type: "EMAIL", value: email })), dataTestId: dataTestId, isInvalid: renderAsInvalid, onChange: handleChange, placeholder: rest.placeholder || "mail@example.com", ref: ref, type: "email" }, rest)));
851
+ email.length > 0 && (jsxRuntime.jsx(ActionButton, { dataTestId: dataTestId && `${dataTestId}-emailIcon`, disabled: disableAction || isInvalid, iconSize: fieldSize, onClick: sendEmail, type: "EMAIL", value: email })), dataTestId: dataTestId, disabled: disabled, isInvalid: renderAsInvalid, onChange: handleChange, placeholder: rest.placeholder || "mail@example.com", ref: ref, type: "email" }, rest)));
815
852
  });
816
853
 
817
854
  /**
@@ -1034,7 +1071,7 @@ const PhoneInput = React.forwardRef((_a, ref) => {
1034
1071
  }, [onFocus]);
1035
1072
  return (jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-2", "data-testid": dataTestId && `${dataTestId}-container`, children: jsxRuntime.jsx(BaseInput, Object.assign({ actions: !disableAction &&
1036
1073
  innerValue &&
1037
- (innerValue === null || innerValue === void 0 ? void 0 : innerValue.length) > 0 && (jsxRuntime.jsx(ActionButton, { dataTestId: dataTestId && `${dataTestId}-phoneIcon`, disabled: disabled || isInvalid, iconSize: fieldSize, type: "PHONE_NUMBER", value: (value === null || value === void 0 ? void 0 : value.toString()) || "" })), dataTestId: dataTestId && `${dataTestId}-phoneNumberInput`, disabled: disabled, fieldSize: fieldSize, id: "phoneInput-number", isInvalid: isInvalid, name: name, onBlur: handleBlur, onChange: handleChange, onFocus: handleFocus, prefix: (countryCode && countryCodeToFlagEmoji(countryCode)) || undefined, readOnly: readOnly, ref: ref, type: "tel", value: innerValue }, rest)) }));
1074
+ (innerValue === null || innerValue === void 0 ? void 0 : innerValue.length) > 0 && (jsxRuntime.jsx(ActionButton, { dataTestId: dataTestId && `${dataTestId}-phoneIcon`, disabled: disableAction || isInvalid, iconSize: fieldSize, type: "PHONE_NUMBER", value: (value === null || value === void 0 ? void 0 : value.toString()) || "" })), dataTestId: dataTestId && `${dataTestId}-phoneNumberInput`, disabled: disabled, fieldSize: fieldSize, id: "phoneInput-number", isInvalid: isInvalid, name: name, onBlur: handleBlur, onChange: handleChange, onFocus: handleFocus, prefix: (countryCode && countryCodeToFlagEmoji(countryCode)) || undefined, readOnly: readOnly, ref: ref, type: "tel", value: innerValue }, rest)) }));
1038
1075
  });
1039
1076
 
1040
1077
  /**
@@ -1132,9 +1169,6 @@ const cvaRadioItem = cssClassVarianceUtilities.cvaMerge([
1132
1169
  "box-border",
1133
1170
  "hover:cursor-pointer",
1134
1171
  "hover:bg-slate-100",
1135
- "focus:ring-2",
1136
- "focus:ring-inset",
1137
- "focus:ring-primary-700",
1138
1172
  ], {
1139
1173
  variants: {
1140
1174
  checked: {
@@ -1150,10 +1184,6 @@ const cvaRadioItem = cssClassVarianceUtilities.cvaMerge([
1150
1184
  "active:ring-2",
1151
1185
  "active:ring-inset",
1152
1186
  "active:ring-primary-700",
1153
- "focus:bg-slate-200",
1154
- "focus:ring-2",
1155
- "focus:ring-inset",
1156
- "focus:ring-primary-700",
1157
1187
  "group-active:ring-2",
1158
1188
  "group-active:ring-inset",
1159
1189
  "group-active:ring-primary-700",
@@ -1161,13 +1191,7 @@ const cvaRadioItem = cssClassVarianceUtilities.cvaMerge([
1161
1191
  false: "",
1162
1192
  },
1163
1193
  invalid: {
1164
- true: [
1165
- "border-red-600",
1166
- "active:ring-red-700",
1167
- "focus:ring-red-700",
1168
- "group-focus:ring-2",
1169
- "group-focus:ring-inset",
1170
- ],
1194
+ true: ["border-red-600", "active:ring-red-700"],
1171
1195
  false: "",
1172
1196
  },
1173
1197
  disabled: {
@@ -1175,13 +1199,8 @@ const cvaRadioItem = cssClassVarianceUtilities.cvaMerge([
1175
1199
  "bg-slate-400",
1176
1200
  "border-slate-300",
1177
1201
  "cursor-not-allowed",
1178
- "group-hover:bg-slate-400",
1179
- "group-focus:bg-slate-400",
1180
1202
  "hover:bg-slate-400",
1181
- "focus:bg-slate-400",
1182
1203
  "active:bg-slate-400",
1183
- "focus:ring-0",
1184
- "focus:ring-inset",
1185
1204
  "group-active:ring-0",
1186
1205
  "group-active:ring-inset",
1187
1206
  ],
@@ -1425,21 +1444,13 @@ const cvaSearch = cssClassVarianceUtilities.cvaMerge([
1425
1444
  "component-search-background",
1426
1445
  "hover:component-search-background",
1427
1446
  "hover:component-search-focus-hover",
1428
- "focus:component-search-focus-hover",
1429
- "focus-within:component-search-focus-within",
1430
1447
  "transition-all",
1431
1448
  "duration-300",
1432
1449
  ], {
1433
1450
  variants: {
1434
1451
  border: { true: ["!component-search-borderless"], false: "" },
1435
1452
  widenOnFocus: {
1436
- true: [
1437
- "component-search-width",
1438
- "component-search-widen",
1439
- "hover:component-search-widen",
1440
- "focus-within:component-search-widen-focus",
1441
- "focus-within:w-full",
1442
- ],
1453
+ true: ["component-search-width", "component-search-widen", "hover:component-search-widen"],
1443
1454
  false: "w-full",
1444
1455
  },
1445
1456
  },
@@ -1463,25 +1474,19 @@ const cvaSelect = cssClassVarianceUtilities.cvaMerge([
1463
1474
  "flex",
1464
1475
  "shadow-sm",
1465
1476
  "rounded-lg",
1466
- "border",
1467
1477
  "border-slate-300",
1468
- "focus-within:ring-2",
1469
- "focus-within:ring-inset",
1470
- "focus-within:ring-primary-600",
1471
- "focus-within:border-slate-400",
1472
1478
  "hover:border-slate-400",
1473
1479
  "hover:bg-slate-50",
1474
1480
  "bg-white",
1475
1481
  "transition",
1476
- "overflow-hidden",
1477
1482
  ], {
1478
1483
  variants: {
1479
1484
  invalid: {
1480
- true: "border-red-600 text-red-600 focus-within:ring-red-600 hover:border-red-600",
1485
+ true: "border border-red-600 text-red-600 hover:border-red-600",
1481
1486
  false: "",
1482
1487
  },
1483
1488
  disabled: {
1484
- true: "!bg-slate-100",
1489
+ true: "!bg-slate-100 hover:border-slate-300",
1485
1490
  false: "",
1486
1491
  },
1487
1492
  },
@@ -1490,10 +1495,53 @@ const cvaSelect = cssClassVarianceUtilities.cvaMerge([
1490
1495
  disabled: false,
1491
1496
  },
1492
1497
  });
1493
- const cvaSelectIcon = cssClassVarianceUtilities.cvaMerge("mr-2 flex cursor-pointer items-center justify-center text-slate-400 hover:text-slate-500");
1494
- const cvaSelectPrefix = cssClassVarianceUtilities.cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "pl-2"]);
1498
+ const cvaSelectControl = cssClassVarianceUtilities.cvaMerge([], {
1499
+ variants: {
1500
+ isDisabled: {
1501
+ true: "!bg-slate-100",
1502
+ false: "",
1503
+ },
1504
+ prefix: {
1505
+ true: ["ps-7"],
1506
+ false: "",
1507
+ },
1508
+ invalid: {
1509
+ true: "!border-0",
1510
+ false: "",
1511
+ },
1512
+ },
1513
+ defaultVariants: {
1514
+ isDisabled: false,
1515
+ prefix: false,
1516
+ invalid: false,
1517
+ },
1518
+ });
1519
+ const cvaSelectIcon = cssClassVarianceUtilities.cvaMerge([
1520
+ "mr-2",
1521
+ "flex",
1522
+ "cursor-pointer",
1523
+ "items-center",
1524
+ "justify-center",
1525
+ "text-slate-400",
1526
+ "hover:text-slate-500",
1527
+ ]);
1528
+ const cvaSelectPrefix = cssClassVarianceUtilities.cvaMerge([
1529
+ "flex",
1530
+ "justify-center",
1531
+ "items-center",
1532
+ "text-slate-400",
1533
+ "pl-2",
1534
+ "absolute",
1535
+ "inset-y-0",
1536
+ ]);
1495
1537
  const cvaSelectXIcon = cssClassVarianceUtilities.cvaMerge([
1496
- "mr-2 flex cursor-pointer items-center justify-center text-slate-400 hover:text-slate-500",
1538
+ "mr-2",
1539
+ "flex",
1540
+ "cursor-pointer",
1541
+ "items-center",
1542
+ "justify-center",
1543
+ "text-slate-400",
1544
+ "hover:text-slate-500",
1497
1545
  "ml-1",
1498
1546
  ]);
1499
1547
  const cvaSelectMenuList = cssClassVarianceUtilities.cvaMerge(["min-w-min", "shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
@@ -1677,7 +1725,7 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
1677
1725
  * @param {JSX.Element} dropdownIcon an custom dropdown icon
1678
1726
  * @returns {Partial<SelectComponents<Option, boolean, GroupBase<Option>>> | undefined} components object to override react-select default components
1679
1727
  */
1680
- const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon) => {
1728
+ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon, prefix, hasError) => {
1681
1729
  const [t] = useTranslation();
1682
1730
  // perhaps it should not be wrap in memo (causing some issues with opening and closing on mobiles)
1683
1731
  const customComponents = React__namespace.useMemo(() => {
@@ -1716,7 +1764,7 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
1716
1764
  }
1717
1765
  return (jsxRuntime.jsx(ReactSelect.components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled, children: props.children })));
1718
1766
  }, LoadingIndicator: props => {
1719
- return jsxRuntime.jsx(reactComponents.Spinner, { className: "mt-1.5 mr-1", size: "small" });
1767
+ return jsxRuntime.jsx(reactComponents.Spinner, { className: "mr-1 mt-1.5", size: "small" });
1720
1768
  }, DropdownIndicator: props => {
1721
1769
  const icon = props.selectProps.menuIsOpen ? (jsxRuntime.jsx(reactComponents.Icon, { name: "ChevronUp", size: "medium" })) : (jsxRuntime.jsx(reactComponents.Icon, { name: "ChevronDown", size: "medium" }));
1722
1770
  return props.selectProps.isLoading ? null : (jsxRuntime.jsx(ReactSelect.components.DropdownIndicator, Object.assign({}, props, { children: jsxRuntime.jsx("div", { className: cvaSelectIcon(), children: dropdownIcon ? dropdownIcon : icon }) })));
@@ -1726,7 +1774,11 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
1726
1774
  }
1727
1775
  return (jsxRuntime.jsx(ReactSelect.components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx("div", { className: cvaSelectXIcon(), "data-testid": dataTestId && `${dataTestId}-XMarkIcon`, onClick: props.clearValue, children: jsxRuntime.jsx(reactComponents.Icon, { name: "XCircle", size: "medium", title: t("clearIndicator.icon.tooltip.clearAll") }) }) })));
1728
1776
  }, Control: props => {
1729
- return jsxRuntime.jsx(ReactSelect.components.Control, Object.assign({}, props, { className: props.isDisabled ? "bg-slate-100" : "" }));
1777
+ return (jsxRuntime.jsx(ReactSelect.components.Control, Object.assign({}, props, { className: cvaSelectControl({
1778
+ isDisabled: props.isDisabled,
1779
+ prefix: prefix ? true : false,
1780
+ invalid: hasError,
1781
+ }) })));
1730
1782
  }, SingleValue: props => {
1731
1783
  return (jsxRuntime.jsx(ReactSelect.components.SingleValue, Object.assign({}, props, { className: props.isDisabled ? "text-slate-700" : "", children: jsxRuntime.jsx("div", { "data-testid": dataTestId + "-singleValue", children: props.children }) })));
1732
1784
  }, Menu: props => {
@@ -1766,18 +1818,16 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
1766
1818
  const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, styles, disabled) => {
1767
1819
  const customStyles = React__namespace.useMemo(() => {
1768
1820
  return Object.assign({ control: base => {
1769
- return Object.assign(Object.assign({}, base), { border: "0", boxShadow: "0", "&:hover": {
1770
- border: "0",
1771
- }, backgroundColor: "" });
1821
+ return Object.assign(Object.assign({}, base), { borderRadius: "var(--border-radius-lg)", backgroundColor: "" });
1772
1822
  }, singleValue: base => (Object.assign({}, base)), multiValue: base => (Object.assign({}, base)), multiValueLabel: base => (Object.assign({}, base)), indicatorsContainer: base => (Object.assign(Object.assign({}, base), (disabled && { display: "none" }))), indicatorSeparator: () => ({
1773
1823
  width: "0px",
1774
1824
  }), menu: base => {
1775
1825
  return Object.assign(Object.assign({}, base), { width: "100%", marginTop: "4px", marginBottom: "18px", transition: "all 1s ease-in-out" });
1776
- }, input: base => (Object.assign(Object.assign({}, base), { marginLeft: "0px" })), placeholder: base => (Object.assign({}, base)), option: () => ({}), menuPortal: base => (Object.assign(Object.assign({}, base), { width: (refContainer === null || refContainer === void 0 ? void 0 : refContainer.current) ? `${refContainer.current.clientWidth}px` : base.width, transform: (refPrefix === null || refPrefix === void 0 ? void 0 : refPrefix.current) ? `translate(-${refPrefix.current.clientWidth + 2}px)` : "translate(-2px)", backgroundColor: "#ffffff", borderRadius: "var(--border-radius-lg)", zIndex: 20, borderColor: "rgb(var(--color-slate-300))", boxShadow: "var(--tw-ring-inset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)" })), menuList: base => {
1826
+ }, input: base => (Object.assign(Object.assign({}, base), { marginLeft: "0px" })), placeholder: base => (Object.assign({}, base)), option: () => ({}), menuPortal: base => (Object.assign(Object.assign({}, base), { width: (refContainer === null || refContainer === void 0 ? void 0 : refContainer.current) ? `${refContainer.current.clientWidth}px` : base.width, backgroundColor: "#ffffff", borderRadius: "var(--border-radius-lg)", zIndex: 20, borderColor: "rgb(var(--color-slate-300))", boxShadow: "var(--tw-ring-inset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)" })), menuList: base => {
1777
1827
  return Object.assign(Object.assign({}, base), { position: "relative", padding: "var(--spacing-1)", display: "grid", gap: "var(--spacing-1)", width: "100%", borderRadius: "0px", boxShadow: "none", paddingTop: "0px" });
1778
1828
  }, valueContainer: base => {
1779
1829
  return Object.assign(Object.assign({}, base), { flexWrap: maxSelectedDisplayCount !== undefined ? "wrap" : "nowrap", gap: "0.25rem" });
1780
- }, container: base => (Object.assign(Object.assign({}, base), { border: "none", width: "100%" })), dropdownIndicator: base => (Object.assign(Object.assign({}, base), { padding: "0px" })), clearIndicator: base => {
1830
+ }, container: base => (Object.assign(Object.assign({}, base), { width: "100%" })), dropdownIndicator: base => (Object.assign(Object.assign({}, base), { padding: "0px" })), clearIndicator: base => {
1781
1831
  return Object.assign(Object.assign({}, base), { padding: "0px" });
1782
1832
  } }, styles);
1783
1833
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1799,7 +1849,7 @@ const useSelect = (_a) => {
1799
1849
  const { customStyles } = useCustomStyles(refContainer, refPrefix, maxSelectedDisplayCount, styles, disabled);
1800
1850
  const [menuIsOpen, setMenuIsOpen] = React__default["default"].useState((_b = props.menuIsOpen) !== null && _b !== void 0 ? _b : false);
1801
1851
  const refMenuIsEnabled = React__default["default"].useRef(true);
1802
- const customComponents = useCustomComponents(components, disabled || false, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon);
1852
+ const customComponents = useCustomComponents(components, disabled || false, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon, prefix, hasError);
1803
1853
  const menuPlacement = "auto";
1804
1854
  const openMenuHandler = () => __awaiter(void 0, void 0, void 0, function* () {
1805
1855
  onMenuOpen && onMenuOpen();
@@ -1872,6 +1922,8 @@ const CreatableSelect = (props) => {
1872
1922
  onInputChange,
1873
1923
  allowCreateWhileLoading,
1874
1924
  onCreateOption,
1925
+ isDisabled: disabled || props.isDisabled,
1926
+ readOnly,
1875
1927
  };
1876
1928
  const renderAsDisabled = rest.disabled || rest.readOnly || rest.isDisabled; // TODO remove one of the disable props from the type
1877
1929
  return (jsxRuntime.jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsxRuntime.jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsxRuntime.jsx(ReactAsyncCreatableSelect__default["default"], Object.assign({}, rest, creatableSelectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : placeholder }))) : (jsxRuntime.jsx(ReactCreatableSelect__default["default"], Object.assign({}, rest, creatableSelectProps, { hideSelectedOptions: false, isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : placeholder })))] }));
@@ -1915,6 +1967,8 @@ const Select = (props) => {
1915
1967
  onMenuScrollToBottom,
1916
1968
  onInputChange,
1917
1969
  hideSelectedOptions,
1970
+ isDisabled: disabled || props.isDisabled,
1971
+ readOnly,
1918
1972
  };
1919
1973
  const renderAsDisabled = rest.disabled || rest.readOnly || rest.isDisabled; // TODO remove one of the disable props from the type
1920
1974
  return (jsxRuntime.jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsxRuntime.jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsxRuntime.jsx(ReactAsyncSelect__default["default"], Object.assign({}, rest, selectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : placeholder }))) : (jsxRuntime.jsx(ReactSelect__default["default"], Object.assign({}, rest, selectProps, { isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : placeholder })))] }));
@@ -2006,7 +2060,6 @@ const cvaTextArea = cssClassVarianceUtilities.cvaMerge([
2006
2060
  "text-base",
2007
2061
  "text-slate-900",
2008
2062
  "placeholder-slate-400",
2009
- "focus-visible:outline-none",
2010
2063
  "w-full",
2011
2064
  "h-20",
2012
2065
  "transition",
@@ -2083,7 +2136,7 @@ const TextField = React__namespace.forwardRef((_a, ref) => {
2083
2136
  }
2084
2137
  }, [onChange]);
2085
2138
  return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId && `${dataTestId}-FormGroup`, helpAddon: helpAddon ||
2086
- (maxLength !== null && maxLength !== undefined && (jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsxRuntime.jsx(TextInput, Object.assign({ "aria-labelledby": htmlFor + "-label", disabled: rest.readOnly, id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value }, rest, { className: className, dataTestId: dataTestId, onChange: handleChange })) }));
2139
+ (maxLength !== null && maxLength !== undefined && (jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsxRuntime.jsx(TextInput, Object.assign({ "aria-labelledby": htmlFor + "-label", id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value }, rest, { className: className, dataTestId: dataTestId, onChange: handleChange })) }));
2087
2140
  });
2088
2141
 
2089
2142
  /**
@@ -2101,16 +2154,7 @@ const TimeRangeField = (_a) => {
2101
2154
 
2102
2155
  const cvaToggleWrapper = cssClassVarianceUtilities.cvaMerge(["flex", "gap-2", "items-center"]);
2103
2156
  cssClassVarianceUtilities.cvaMerge(["relative"]);
2104
- const cvaToggleTrack = cssClassVarianceUtilities.cvaMerge([
2105
- "shrink-0",
2106
- "p-1",
2107
- "cursor-pointer",
2108
- "rounded-full",
2109
- "bg-slate-300",
2110
- "focus:bg-slate-400",
2111
- "hover:bg-slate-400",
2112
- "active:bg-slate-500",
2113
- ], {
2157
+ const cvaToggleTrack = cssClassVarianceUtilities.cvaMerge(["shrink-0", "p-1", "cursor-pointer", "rounded-full", "bg-slate-300", "hover:bg-slate-400", "active:bg-slate-500"], {
2114
2158
  variants: {
2115
2159
  size: {
2116
2160
  small: ["w-8", "h-4"],
@@ -2121,7 +2165,7 @@ const cvaToggleTrack = cssClassVarianceUtilities.cvaMerge([
2121
2165
  false: "",
2122
2166
  },
2123
2167
  toggled: {
2124
- true: ["bg-primary-600", "focus:bg-primary-700", "hover:bg-primary-700", "active:bg-primary-800"],
2168
+ true: ["bg-primary-600", "hover:bg-primary-700", "active:bg-primary-800"],
2125
2169
  false: "",
2126
2170
  },
2127
2171
  },
@@ -2239,7 +2283,7 @@ const UrlInput = React.forwardRef((_a, ref) => {
2239
2283
  var { dataTestId, isInvalid, disabled = false, fieldSize = "medium", disableAction = false, value, defaultValue } = _a, rest = __rest(_a, ["dataTestId", "isInvalid", "disabled", "fieldSize", "disableAction", "value", "defaultValue"]);
2240
2284
  const [url, setUrl] = React.useState((value === null || value === void 0 ? void 0 : value.toString()) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString()));
2241
2285
  const renderAsInvalid = (url && typeof url === "string" && !validateUrlAddress(url)) || isInvalid;
2242
- return (jsxRuntime.jsx(BaseInput, Object.assign({ dataTestId: dataTestId && `${dataTestId}-url-input`, disabled: disabled, id: "url-input", isInvalid: renderAsInvalid, onChange: e => setUrl(e.target.value), placeholder: rest.placeholder || "https://www.example.com", ref: ref, type: "url", value: url }, rest, { actions: !disableAction && (jsxRuntime.jsx(ActionButton, { dataTestId: (dataTestId && `${dataTestId}-url-input-Icon`) || "url-input-action-icon", disabled: renderAsInvalid || disabled, iconSize: fieldSize, type: "WEB_ADDRESS", value: url })) })));
2286
+ return (jsxRuntime.jsx(BaseInput, Object.assign({ dataTestId: dataTestId && `${dataTestId}-url-input`, disabled: disabled, id: "url-input", isInvalid: renderAsInvalid, onChange: e => setUrl(e.target.value), placeholder: rest.placeholder || "https://www.example.com", ref: ref, type: "url", value: url }, rest, { actions: !disableAction && (jsxRuntime.jsx(ActionButton, { dataTestId: (dataTestId && `${dataTestId}-url-input-Icon`) || "url-input-action-icon", disabled: renderAsInvalid || disableAction, iconSize: fieldSize, type: "WEB_ADDRESS", value: url })) })));
2243
2287
  });
2244
2288
 
2245
2289
  /**
@@ -2255,7 +2299,7 @@ const UrlField = React.forwardRef((_a, ref) => {
2255
2299
  return typeof inputValue === "string";
2256
2300
  }
2257
2301
  const renderAsInvalid = !!errorMessage || (value && isString(value) && !validateUrlAddress(value)) || isInvalid;
2258
- return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId && `${dataTestId}-FormGroup`, disabled: rest.disabled, helpAddon: helpAddon, helpText: renderAsInvalid ? errorMessage : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsxRuntime.jsx(UrlInput, Object.assign({ "aria-labelledby": htmlForId + "-label", disabled: rest.disabled, id: htmlForId, isInvalid: renderAsInvalid, ref: ref, value: value || defaultValue }, rest, { className: className, dataTestId: dataTestId })) }));
2302
+ return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId && `${dataTestId}-FormGroup`, disabled: rest.disabled, helpAddon: helpAddon, helpText: renderAsInvalid ? errorMessage : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsxRuntime.jsx(UrlInput, Object.assign({ "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref, value: value || defaultValue }, rest, { className: className, dataTestId: dataTestId })) }));
2259
2303
  });
2260
2304
 
2261
2305
  /**
@@ -2414,6 +2458,7 @@ exports.countryCodeToFlagEmoji = countryCodeToFlagEmoji;
2414
2458
  exports.cvaActionButton = cvaActionButton;
2415
2459
  exports.cvaActionContainer = cvaActionContainer;
2416
2460
  exports.cvaInput = cvaInput;
2461
+ exports.cvaInputAction = cvaInputAction;
2417
2462
  exports.cvaInputAddon = cvaInputAddon;
2418
2463
  exports.cvaInputAddonAfter = cvaInputAddonAfter;
2419
2464
  exports.cvaInputAddonBefore = cvaInputAddonBefore;
@@ -2424,6 +2469,7 @@ exports.cvaInputField = cvaInputField;
2424
2469
  exports.cvaInputPrefix = cvaInputPrefix;
2425
2470
  exports.cvaInputSuffix = cvaInputSuffix;
2426
2471
  exports.cvaSelect = cvaSelect;
2472
+ exports.cvaSelectControl = cvaSelectControl;
2427
2473
  exports.cvaSelectCounter = cvaSelectCounter;
2428
2474
  exports.cvaSelectDynamicTagContainer = cvaSelectDynamicTagContainer;
2429
2475
  exports.cvaSelectIcon = cvaSelectIcon;
package/index.esm.js CHANGED
@@ -183,16 +183,12 @@ const cvaInputBase = cvaMerge([
183
183
  "component-baseInput-border",
184
184
  "component-baseInput-background",
185
185
  "border-slate-300",
186
- "focus-within:ring-2",
187
- "focus-within:ring-inset",
188
- "focus-within:ring-primary-500",
189
- "focus-within:border-slate-400",
190
186
  "hover:border-slate-400",
191
187
  "hover:bg-slate-50",
192
188
  "transition",
193
189
  ]);
194
190
  const cvaInputBaseDisabled = cvaMerge(["bg-slate-100", "hover:bg-slate-100", "hover:border-slate-300"]);
195
- const cvaInputBaseInvalid = cvaMerge(["border-danger-600", "focus-within:ring-danger-600"]);
191
+ const cvaInputBaseInvalid = cvaMerge(["border-danger-600"]);
196
192
  const cvaInput = cvaMerge(["relative", "flex", "h-10", cvaInputBase()], {
197
193
  variants: {
198
194
  size: {
@@ -201,24 +197,15 @@ const cvaInput = cvaMerge(["relative", "flex", "h-10", cvaInputBase()], {
201
197
  },
202
198
  disabled: {
203
199
  true: cvaInputBaseDisabled(),
204
- false: "",
200
+ false: [""],
205
201
  },
206
202
  invalid: {
207
203
  true: cvaInputBaseInvalid(),
208
- false: "",
204
+ false: [""],
209
205
  },
210
206
  },
211
207
  });
212
- const cvaInputField = cvaMerge([
213
- "w-full",
214
- "px-3",
215
- "border-0",
216
- "bg-transparent",
217
- "text-base",
218
- "text-slate-900",
219
- "placeholder-slate-400",
220
- "focus-visible:outline-none",
221
- ], {
208
+ const cvaInputField = cvaMerge(["w-full", "px-3", "border-0", "bg-transparent", "text-base", "text-slate-900", "placeholder-slate-400", "component-baseInput-border"], {
222
209
  variants: {
223
210
  size: {
224
211
  small: ["py-1"],
@@ -226,9 +213,28 @@ const cvaInputField = cvaMerge([
226
213
  },
227
214
  disabled: {
228
215
  true: ["text-slate-700"],
229
- false: "",
216
+ false: [""],
217
+ },
218
+ autoFocus: {
219
+ true: [""],
220
+ false: ["focus-visible:outline-none"],
221
+ },
222
+ addonBefore: {
223
+ true: [""],
224
+ false: [""],
225
+ },
226
+ prefix: {
227
+ true: ["ps-10"],
228
+ false: [""],
230
229
  },
231
230
  },
231
+ compoundVariants: [
232
+ {
233
+ addonBefore: true,
234
+ prefix: true,
235
+ className: ["ps-4"],
236
+ },
237
+ ],
232
238
  });
233
239
  const cvaInputAddon = cvaMerge([
234
240
  "flex",
@@ -240,7 +246,6 @@ const cvaInputAddon = cvaMerge([
240
246
  "bg-slate-50",
241
247
  ]);
242
248
  const cvaInputAddonBefore = cvaMerge([cvaInputAddon(), "border-r", "rounded-l-lg"]);
243
- const cvaInputAddonAfter = cvaMerge([cvaInputAddon(), "border-l", "rounded-r-lg"]);
244
249
  const cvaInputPrefix = cvaMerge([
245
250
  "flex",
246
251
  "justify-center",
@@ -250,21 +255,62 @@ const cvaInputPrefix = cvaMerge([
250
255
  "component-baseInput-prefix",
251
256
  "component-search-borderless",
252
257
  "pl-3",
258
+ "absolute",
259
+ "inset-y-0",
253
260
  ], {
254
261
  variants: {
255
262
  disabled: {
256
263
  true: ["text-slate-500"],
257
- false: "",
264
+ false: [""],
265
+ },
266
+ addonBefore: {
267
+ true: ["relative"],
268
+ false: [""],
258
269
  },
259
270
  },
260
271
  });
261
- const cvaInputSuffix = cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "px-3"], {
272
+ const cvaInputSuffix = cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "px-3", "absolute", "inset-y-0", "right-0"], {
262
273
  variants: {
263
274
  disabled: {
264
275
  true: ["text-slate-500"],
265
- false: "",
276
+ false: [""],
277
+ },
278
+ addonAfter: {
279
+ true: ["relative"],
280
+ false: [""],
281
+ },
282
+ actions: {
283
+ true: ["right-10"],
284
+ false: [""],
285
+ },
286
+ },
287
+ compoundVariants: [
288
+ {
289
+ addonAfter: true,
290
+ actions: true,
291
+ className: ["right-0"],
292
+ },
293
+ ],
294
+ });
295
+ const cvaInputAddonAfter = cvaMerge([cvaInputAddon(), "border-l", "rounded-r-lg", "ml-[1px]"]);
296
+ const cvaInputAction = cvaMerge(["absolute", "end-0.5"], {
297
+ variants: {
298
+ addonAfter: {
299
+ true: ["relative"],
300
+ false: [""],
301
+ },
302
+ suffix: {
303
+ true: ["absolute"],
304
+ false: [""],
266
305
  },
267
306
  },
307
+ compoundVariants: [
308
+ {
309
+ addonAfter: true,
310
+ suffix: true,
311
+ className: ["relative"],
312
+ },
313
+ ],
268
314
  });
269
315
 
270
316
  /**
@@ -289,12 +335,25 @@ const BaseInput = React.forwardRef((_a, ref) => {
289
335
  className,
290
336
  }), "data-testid": dataTestId && `${dataTestId}-container`, children: [addonBefore && addonBefore !== undefined ? (jsx("div", { className: cvaInputAddonBefore({ className: addonBeforeClassName }), "data-testid": dataTestId && `${dataTestId}-addonBefore`, children: addonBefore })) : null, prefix && addonBefore !== prefix ? (jsx("div", { className: cvaInputPrefix({
291
337
  disabled: renderAsDisabled,
292
- }), "data-testid": dataTestId && `${dataTestId}-prefix`, children: prefix })) : null, jsx("input", Object.assign({ "aria-required": rest.required, className: cvaInputField({ size: fieldSize, disabled: renderAsDisabled, className: inputClassName }), "data-testid": dataTestId, placeholder: renderAsDisabled ? undefined : placeholder, ref: innerRef }, rest, { readOnly: rest.readOnly || nonInteractive })), suffix && addonBefore !== suffix ? (jsx("div", { className: cvaInputSuffix({
338
+ addonBefore: addonBefore !== undefined,
339
+ }), "data-testid": dataTestId && `${dataTestId}-prefix`, children: prefix })) : null, jsx("input", Object.assign({ "aria-required": rest.required, autoFocus: rest.autoFocus, className: cvaInputField({
340
+ autoFocus: rest.autoFocus,
341
+ size: fieldSize,
342
+ disabled: renderAsDisabled,
343
+ className: inputClassName,
344
+ addonBefore: addonBefore !== undefined,
345
+ prefix: addonBefore !== prefix,
346
+ }), "data-testid": dataTestId, placeholder: renderAsDisabled ? undefined : placeholder, ref: innerRef }, rest, { readOnly: rest.readOnly || nonInteractive })), suffix && addonBefore !== suffix ? (jsx("div", { className: cvaInputSuffix({
293
347
  disabled: renderAsDisabled,
348
+ addonAfter: addonAfter !== undefined && addonBefore !== addonAfter,
349
+ actions: (actions && addonBefore !== actions) || false,
294
350
  }), "data-testid": dataTestId && `${dataTestId}-suffix`, children: suffix })) : null, rest.readOnly === true &&
295
351
  showDefaultActions &&
296
352
  ((_b = innerRef === null || innerRef === void 0 ? void 0 : innerRef.current) === null || _b === void 0 ? void 0 : _b.value.length) &&
297
- ((_c = innerRef === null || innerRef === void 0 ? void 0 : innerRef.current) === null || _c === void 0 ? void 0 : _c.value.length) > 0 ? (jsx(ActionButton, { type: "COPY", value: innerRef }, "default-copy-action")) : null, actions && addonBefore !== actions ? actions : null, addonAfter && addonAfter !== undefined && addonBefore !== addonAfter ? (jsx("div", { className: cvaInputAddonAfter(), "data-testid": dataTestId && `${dataTestId}-addonAfter`, children: addonAfter })) : null] }));
353
+ ((_c = innerRef === null || innerRef === void 0 ? void 0 : innerRef.current) === null || _c === void 0 ? void 0 : _c.value.length) > 0 ? (jsx(ActionButton, { type: "COPY", value: innerRef }, "default-copy-action")) : null, actions && addonBefore !== actions ? (jsx("div", { className: cvaInputAction({
354
+ addonAfter: addonAfter !== undefined && addonBefore !== addonAfter,
355
+ suffix: addonBefore !== suffix,
356
+ }), children: actions })) : null, addonAfter && addonAfter !== undefined && addonBefore !== addonAfter ? (jsx("div", { className: cvaInputAddonAfter(), "data-testid": dataTestId && `${dataTestId}-addonAfter`, children: addonAfter })) : null] }));
298
357
  });
299
358
 
300
359
  const cvaLabel = cvaMerge([
@@ -348,15 +407,11 @@ const cvaCheckbox = cvaMerge([
348
407
  "justify-center",
349
408
  "box-border",
350
409
  "transition",
351
- "focus:bg-slate-200",
352
410
  "outline-0",
353
411
  "active:bg-slate-200",
354
412
  "active:ring-2",
355
413
  "active:ring-inset",
356
414
  "active:ring-primary-700",
357
- "focus:ring-2",
358
- "focus:ring-inset",
359
- "focus:ring-primary-700",
360
415
  "cursor-pointer",
361
416
  "group-active:ring-2",
362
417
  "group-active:ring-inset",
@@ -364,13 +419,7 @@ const cvaCheckbox = cvaMerge([
364
419
  ], {
365
420
  variants: {
366
421
  invalid: {
367
- true: [
368
- "border-red-600",
369
- "active:ring-red-700",
370
- "focus:ring-red-700",
371
- "group-focus:ring-2",
372
- "group-focus:ring-inset",
373
- ],
422
+ true: ["border-red-600", "active:ring-red-700", "group-focus:ring-2", "group-focus:ring-inset"],
374
423
  false: "",
375
424
  },
376
425
  state: {
@@ -380,11 +429,8 @@ const cvaCheckbox = cvaMerge([
380
429
  "hover:bg-primary-700",
381
430
  "hover:border-primary-700",
382
431
  "active:bg-primary-700",
383
- "focus:bg-primary-700",
384
432
  "group-hover:bg-primary-700",
385
433
  "group-hover:border-primary-700",
386
- "group-focus:bg-primary-700",
387
- "group-focus:border-primary-700",
388
434
  ],
389
435
  deselected: ["group-hover:bg-slate-100"],
390
436
  indeterminate: [
@@ -392,14 +438,10 @@ const cvaCheckbox = cvaMerge([
392
438
  "border-primary-600",
393
439
  "hover:bg-primary-700",
394
440
  "hover:border-primary-700",
395
- "focus:bg-primary-800",
396
- "focus:border-primary-800",
397
441
  "active:bg-primary-800",
398
442
  "active:border-primary-800",
399
443
  "group-hover:bg-primary-700",
400
444
  "group-hover:border-primary-700",
401
- "group-focus:bg-primary-800",
402
- "group-focus:border-primary-800",
403
445
  ],
404
446
  },
405
447
  disabled: {
@@ -407,13 +449,8 @@ const cvaCheckbox = cvaMerge([
407
449
  "bg-slate-300",
408
450
  "border-slate-300",
409
451
  "cursor-not-allowed",
410
- "group-hover:bg-slate-300",
411
- "group-focus:bg-slate-300",
412
452
  "hover:bg-slate-300",
413
- "focus:bg-slate-300",
414
453
  "active:bg-slate-300",
415
- "focus:ring-0",
416
- "focus:ring-inset",
417
454
  "group-active:ring-0",
418
455
  "group-active:ring-inset",
419
456
  ],
@@ -769,7 +806,7 @@ const validateEmailAddress = (email) => {
769
806
  * For specific input types make sure to use the corresponding input component.
770
807
  */
771
808
  const EmailInput = React.forwardRef((_a, ref) => {
772
- var { fieldSize = "medium", disabled = false, dataTestId, isInvalid = false, onChange } = _a, rest = __rest(_a, ["fieldSize", "disabled", "dataTestId", "isInvalid", "onChange"]);
809
+ var { fieldSize = "medium", disabled = false, dataTestId, isInvalid = false, onChange, disableAction = false } = _a, rest = __rest(_a, ["fieldSize", "disabled", "dataTestId", "isInvalid", "onChange", "disableAction"]);
773
810
  const [email, setEmail] = React.useState("");
774
811
  const sendEmail = () => {
775
812
  return window.open(`mailto:${email}`);
@@ -781,7 +818,7 @@ const EmailInput = React.forwardRef((_a, ref) => {
781
818
  }, [onChange]);
782
819
  const renderAsInvalid = (email && !validateEmailAddress(email)) || isInvalid;
783
820
  return (jsx(BaseInput, Object.assign({ actions: email &&
784
- email.length > 0 && (jsx(ActionButton, { dataTestId: dataTestId && `${dataTestId}-emailIcon`, disabled: disabled, iconSize: fieldSize, onClick: sendEmail, type: "EMAIL", value: email })), dataTestId: dataTestId, isInvalid: renderAsInvalid, onChange: handleChange, placeholder: rest.placeholder || "mail@example.com", ref: ref, type: "email" }, rest)));
821
+ email.length > 0 && (jsx(ActionButton, { dataTestId: dataTestId && `${dataTestId}-emailIcon`, disabled: disableAction || isInvalid, iconSize: fieldSize, onClick: sendEmail, type: "EMAIL", value: email })), dataTestId: dataTestId, disabled: disabled, isInvalid: renderAsInvalid, onChange: handleChange, placeholder: rest.placeholder || "mail@example.com", ref: ref, type: "email" }, rest)));
785
822
  });
786
823
 
787
824
  /**
@@ -1004,7 +1041,7 @@ const PhoneInput = forwardRef((_a, ref) => {
1004
1041
  }, [onFocus]);
1005
1042
  return (jsx("div", { className: "grid grid-cols-1 gap-2", "data-testid": dataTestId && `${dataTestId}-container`, children: jsx(BaseInput, Object.assign({ actions: !disableAction &&
1006
1043
  innerValue &&
1007
- (innerValue === null || innerValue === void 0 ? void 0 : innerValue.length) > 0 && (jsx(ActionButton, { dataTestId: dataTestId && `${dataTestId}-phoneIcon`, disabled: disabled || isInvalid, iconSize: fieldSize, type: "PHONE_NUMBER", value: (value === null || value === void 0 ? void 0 : value.toString()) || "" })), dataTestId: dataTestId && `${dataTestId}-phoneNumberInput`, disabled: disabled, fieldSize: fieldSize, id: "phoneInput-number", isInvalid: isInvalid, name: name, onBlur: handleBlur, onChange: handleChange, onFocus: handleFocus, prefix: (countryCode && countryCodeToFlagEmoji(countryCode)) || undefined, readOnly: readOnly, ref: ref, type: "tel", value: innerValue }, rest)) }));
1044
+ (innerValue === null || innerValue === void 0 ? void 0 : innerValue.length) > 0 && (jsx(ActionButton, { dataTestId: dataTestId && `${dataTestId}-phoneIcon`, disabled: disableAction || isInvalid, iconSize: fieldSize, type: "PHONE_NUMBER", value: (value === null || value === void 0 ? void 0 : value.toString()) || "" })), dataTestId: dataTestId && `${dataTestId}-phoneNumberInput`, disabled: disabled, fieldSize: fieldSize, id: "phoneInput-number", isInvalid: isInvalid, name: name, onBlur: handleBlur, onChange: handleChange, onFocus: handleFocus, prefix: (countryCode && countryCodeToFlagEmoji(countryCode)) || undefined, readOnly: readOnly, ref: ref, type: "tel", value: innerValue }, rest)) }));
1008
1045
  });
1009
1046
 
1010
1047
  /**
@@ -1102,9 +1139,6 @@ const cvaRadioItem = cvaMerge([
1102
1139
  "box-border",
1103
1140
  "hover:cursor-pointer",
1104
1141
  "hover:bg-slate-100",
1105
- "focus:ring-2",
1106
- "focus:ring-inset",
1107
- "focus:ring-primary-700",
1108
1142
  ], {
1109
1143
  variants: {
1110
1144
  checked: {
@@ -1120,10 +1154,6 @@ const cvaRadioItem = cvaMerge([
1120
1154
  "active:ring-2",
1121
1155
  "active:ring-inset",
1122
1156
  "active:ring-primary-700",
1123
- "focus:bg-slate-200",
1124
- "focus:ring-2",
1125
- "focus:ring-inset",
1126
- "focus:ring-primary-700",
1127
1157
  "group-active:ring-2",
1128
1158
  "group-active:ring-inset",
1129
1159
  "group-active:ring-primary-700",
@@ -1131,13 +1161,7 @@ const cvaRadioItem = cvaMerge([
1131
1161
  false: "",
1132
1162
  },
1133
1163
  invalid: {
1134
- true: [
1135
- "border-red-600",
1136
- "active:ring-red-700",
1137
- "focus:ring-red-700",
1138
- "group-focus:ring-2",
1139
- "group-focus:ring-inset",
1140
- ],
1164
+ true: ["border-red-600", "active:ring-red-700"],
1141
1165
  false: "",
1142
1166
  },
1143
1167
  disabled: {
@@ -1145,13 +1169,8 @@ const cvaRadioItem = cvaMerge([
1145
1169
  "bg-slate-400",
1146
1170
  "border-slate-300",
1147
1171
  "cursor-not-allowed",
1148
- "group-hover:bg-slate-400",
1149
- "group-focus:bg-slate-400",
1150
1172
  "hover:bg-slate-400",
1151
- "focus:bg-slate-400",
1152
1173
  "active:bg-slate-400",
1153
- "focus:ring-0",
1154
- "focus:ring-inset",
1155
1174
  "group-active:ring-0",
1156
1175
  "group-active:ring-inset",
1157
1176
  ],
@@ -1395,21 +1414,13 @@ const cvaSearch = cvaMerge([
1395
1414
  "component-search-background",
1396
1415
  "hover:component-search-background",
1397
1416
  "hover:component-search-focus-hover",
1398
- "focus:component-search-focus-hover",
1399
- "focus-within:component-search-focus-within",
1400
1417
  "transition-all",
1401
1418
  "duration-300",
1402
1419
  ], {
1403
1420
  variants: {
1404
1421
  border: { true: ["!component-search-borderless"], false: "" },
1405
1422
  widenOnFocus: {
1406
- true: [
1407
- "component-search-width",
1408
- "component-search-widen",
1409
- "hover:component-search-widen",
1410
- "focus-within:component-search-widen-focus",
1411
- "focus-within:w-full",
1412
- ],
1423
+ true: ["component-search-width", "component-search-widen", "hover:component-search-widen"],
1413
1424
  false: "w-full",
1414
1425
  },
1415
1426
  },
@@ -1433,25 +1444,19 @@ const cvaSelect = cvaMerge([
1433
1444
  "flex",
1434
1445
  "shadow-sm",
1435
1446
  "rounded-lg",
1436
- "border",
1437
1447
  "border-slate-300",
1438
- "focus-within:ring-2",
1439
- "focus-within:ring-inset",
1440
- "focus-within:ring-primary-600",
1441
- "focus-within:border-slate-400",
1442
1448
  "hover:border-slate-400",
1443
1449
  "hover:bg-slate-50",
1444
1450
  "bg-white",
1445
1451
  "transition",
1446
- "overflow-hidden",
1447
1452
  ], {
1448
1453
  variants: {
1449
1454
  invalid: {
1450
- true: "border-red-600 text-red-600 focus-within:ring-red-600 hover:border-red-600",
1455
+ true: "border border-red-600 text-red-600 hover:border-red-600",
1451
1456
  false: "",
1452
1457
  },
1453
1458
  disabled: {
1454
- true: "!bg-slate-100",
1459
+ true: "!bg-slate-100 hover:border-slate-300",
1455
1460
  false: "",
1456
1461
  },
1457
1462
  },
@@ -1460,10 +1465,53 @@ const cvaSelect = cvaMerge([
1460
1465
  disabled: false,
1461
1466
  },
1462
1467
  });
1463
- const cvaSelectIcon = cvaMerge("mr-2 flex cursor-pointer items-center justify-center text-slate-400 hover:text-slate-500");
1464
- const cvaSelectPrefix = cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "pl-2"]);
1468
+ const cvaSelectControl = cvaMerge([], {
1469
+ variants: {
1470
+ isDisabled: {
1471
+ true: "!bg-slate-100",
1472
+ false: "",
1473
+ },
1474
+ prefix: {
1475
+ true: ["ps-7"],
1476
+ false: "",
1477
+ },
1478
+ invalid: {
1479
+ true: "!border-0",
1480
+ false: "",
1481
+ },
1482
+ },
1483
+ defaultVariants: {
1484
+ isDisabled: false,
1485
+ prefix: false,
1486
+ invalid: false,
1487
+ },
1488
+ });
1489
+ const cvaSelectIcon = cvaMerge([
1490
+ "mr-2",
1491
+ "flex",
1492
+ "cursor-pointer",
1493
+ "items-center",
1494
+ "justify-center",
1495
+ "text-slate-400",
1496
+ "hover:text-slate-500",
1497
+ ]);
1498
+ const cvaSelectPrefix = cvaMerge([
1499
+ "flex",
1500
+ "justify-center",
1501
+ "items-center",
1502
+ "text-slate-400",
1503
+ "pl-2",
1504
+ "absolute",
1505
+ "inset-y-0",
1506
+ ]);
1465
1507
  const cvaSelectXIcon = cvaMerge([
1466
- "mr-2 flex cursor-pointer items-center justify-center text-slate-400 hover:text-slate-500",
1508
+ "mr-2",
1509
+ "flex",
1510
+ "cursor-pointer",
1511
+ "items-center",
1512
+ "justify-center",
1513
+ "text-slate-400",
1514
+ "hover:text-slate-500",
1467
1515
  "ml-1",
1468
1516
  ]);
1469
1517
  const cvaSelectMenuList = cvaMerge(["min-w-min", "shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
@@ -1647,7 +1695,7 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
1647
1695
  * @param {JSX.Element} dropdownIcon an custom dropdown icon
1648
1696
  * @returns {Partial<SelectComponents<Option, boolean, GroupBase<Option>>> | undefined} components object to override react-select default components
1649
1697
  */
1650
- const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon) => {
1698
+ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon, prefix, hasError) => {
1651
1699
  const [t] = useTranslation();
1652
1700
  // perhaps it should not be wrap in memo (causing some issues with opening and closing on mobiles)
1653
1701
  const customComponents = React.useMemo(() => {
@@ -1686,7 +1734,7 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
1686
1734
  }
1687
1735
  return (jsx(components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled, children: props.children })));
1688
1736
  }, LoadingIndicator: props => {
1689
- return jsx(Spinner, { className: "mt-1.5 mr-1", size: "small" });
1737
+ return jsx(Spinner, { className: "mr-1 mt-1.5", size: "small" });
1690
1738
  }, DropdownIndicator: props => {
1691
1739
  const icon = props.selectProps.menuIsOpen ? (jsx(Icon, { name: "ChevronUp", size: "medium" })) : (jsx(Icon, { name: "ChevronDown", size: "medium" }));
1692
1740
  return props.selectProps.isLoading ? null : (jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsx("div", { className: cvaSelectIcon(), children: dropdownIcon ? dropdownIcon : icon }) })));
@@ -1696,7 +1744,11 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
1696
1744
  }
1697
1745
  return (jsx(components.ClearIndicator, Object.assign({}, props, { children: jsx("div", { className: cvaSelectXIcon(), "data-testid": dataTestId && `${dataTestId}-XMarkIcon`, onClick: props.clearValue, children: jsx(Icon, { name: "XCircle", size: "medium", title: t("clearIndicator.icon.tooltip.clearAll") }) }) })));
1698
1746
  }, Control: props => {
1699
- return jsx(components.Control, Object.assign({}, props, { className: props.isDisabled ? "bg-slate-100" : "" }));
1747
+ return (jsx(components.Control, Object.assign({}, props, { className: cvaSelectControl({
1748
+ isDisabled: props.isDisabled,
1749
+ prefix: prefix ? true : false,
1750
+ invalid: hasError,
1751
+ }) })));
1700
1752
  }, SingleValue: props => {
1701
1753
  return (jsx(components.SingleValue, Object.assign({}, props, { className: props.isDisabled ? "text-slate-700" : "", children: jsx("div", { "data-testid": dataTestId + "-singleValue", children: props.children }) })));
1702
1754
  }, Menu: props => {
@@ -1736,18 +1788,16 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
1736
1788
  const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, styles, disabled) => {
1737
1789
  const customStyles = React.useMemo(() => {
1738
1790
  return Object.assign({ control: base => {
1739
- return Object.assign(Object.assign({}, base), { border: "0", boxShadow: "0", "&:hover": {
1740
- border: "0",
1741
- }, backgroundColor: "" });
1791
+ return Object.assign(Object.assign({}, base), { borderRadius: "var(--border-radius-lg)", backgroundColor: "" });
1742
1792
  }, singleValue: base => (Object.assign({}, base)), multiValue: base => (Object.assign({}, base)), multiValueLabel: base => (Object.assign({}, base)), indicatorsContainer: base => (Object.assign(Object.assign({}, base), (disabled && { display: "none" }))), indicatorSeparator: () => ({
1743
1793
  width: "0px",
1744
1794
  }), menu: base => {
1745
1795
  return Object.assign(Object.assign({}, base), { width: "100%", marginTop: "4px", marginBottom: "18px", transition: "all 1s ease-in-out" });
1746
- }, input: base => (Object.assign(Object.assign({}, base), { marginLeft: "0px" })), placeholder: base => (Object.assign({}, base)), option: () => ({}), menuPortal: base => (Object.assign(Object.assign({}, base), { width: (refContainer === null || refContainer === void 0 ? void 0 : refContainer.current) ? `${refContainer.current.clientWidth}px` : base.width, transform: (refPrefix === null || refPrefix === void 0 ? void 0 : refPrefix.current) ? `translate(-${refPrefix.current.clientWidth + 2}px)` : "translate(-2px)", backgroundColor: "#ffffff", borderRadius: "var(--border-radius-lg)", zIndex: 20, borderColor: "rgb(var(--color-slate-300))", boxShadow: "var(--tw-ring-inset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)" })), menuList: base => {
1796
+ }, input: base => (Object.assign(Object.assign({}, base), { marginLeft: "0px" })), placeholder: base => (Object.assign({}, base)), option: () => ({}), menuPortal: base => (Object.assign(Object.assign({}, base), { width: (refContainer === null || refContainer === void 0 ? void 0 : refContainer.current) ? `${refContainer.current.clientWidth}px` : base.width, backgroundColor: "#ffffff", borderRadius: "var(--border-radius-lg)", zIndex: 20, borderColor: "rgb(var(--color-slate-300))", boxShadow: "var(--tw-ring-inset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)" })), menuList: base => {
1747
1797
  return Object.assign(Object.assign({}, base), { position: "relative", padding: "var(--spacing-1)", display: "grid", gap: "var(--spacing-1)", width: "100%", borderRadius: "0px", boxShadow: "none", paddingTop: "0px" });
1748
1798
  }, valueContainer: base => {
1749
1799
  return Object.assign(Object.assign({}, base), { flexWrap: maxSelectedDisplayCount !== undefined ? "wrap" : "nowrap", gap: "0.25rem" });
1750
- }, container: base => (Object.assign(Object.assign({}, base), { border: "none", width: "100%" })), dropdownIndicator: base => (Object.assign(Object.assign({}, base), { padding: "0px" })), clearIndicator: base => {
1800
+ }, container: base => (Object.assign(Object.assign({}, base), { width: "100%" })), dropdownIndicator: base => (Object.assign(Object.assign({}, base), { padding: "0px" })), clearIndicator: base => {
1751
1801
  return Object.assign(Object.assign({}, base), { padding: "0px" });
1752
1802
  } }, styles);
1753
1803
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1769,7 +1819,7 @@ const useSelect = (_a) => {
1769
1819
  const { customStyles } = useCustomStyles(refContainer, refPrefix, maxSelectedDisplayCount, styles, disabled);
1770
1820
  const [menuIsOpen, setMenuIsOpen] = React__default.useState((_b = props.menuIsOpen) !== null && _b !== void 0 ? _b : false);
1771
1821
  const refMenuIsEnabled = React__default.useRef(true);
1772
- const customComponents = useCustomComponents(components, disabled || false, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon);
1822
+ const customComponents = useCustomComponents(components, disabled || false, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon, prefix, hasError);
1773
1823
  const menuPlacement = "auto";
1774
1824
  const openMenuHandler = () => __awaiter(void 0, void 0, void 0, function* () {
1775
1825
  onMenuOpen && onMenuOpen();
@@ -1842,6 +1892,8 @@ const CreatableSelect = (props) => {
1842
1892
  onInputChange,
1843
1893
  allowCreateWhileLoading,
1844
1894
  onCreateOption,
1895
+ isDisabled: disabled || props.isDisabled,
1896
+ readOnly,
1845
1897
  };
1846
1898
  const renderAsDisabled = rest.disabled || rest.readOnly || rest.isDisabled; // TODO remove one of the disable props from the type
1847
1899
  return (jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsx(ReactAsyncCreatableSelect, Object.assign({}, rest, creatableSelectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : placeholder }))) : (jsx(ReactCreatableSelect, Object.assign({}, rest, creatableSelectProps, { hideSelectedOptions: false, isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : placeholder })))] }));
@@ -1885,6 +1937,8 @@ const Select = (props) => {
1885
1937
  onMenuScrollToBottom,
1886
1938
  onInputChange,
1887
1939
  hideSelectedOptions,
1940
+ isDisabled: disabled || props.isDisabled,
1941
+ readOnly,
1888
1942
  };
1889
1943
  const renderAsDisabled = rest.disabled || rest.readOnly || rest.isDisabled; // TODO remove one of the disable props from the type
1890
1944
  return (jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: disabled || readOnly, className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined && (jsx("div", { className: cvaSelectPrefix(), "data-testid": dataTestId && `${dataTestId}-prefix`, ref: refPrefix, children: prefix })), async ? (jsx(ReactAsyncSelect, Object.assign({}, rest, selectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : placeholder }))) : (jsx(ReactSelect, Object.assign({}, rest, selectProps, { isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : placeholder })))] }));
@@ -1976,7 +2030,6 @@ const cvaTextArea = cvaMerge([
1976
2030
  "text-base",
1977
2031
  "text-slate-900",
1978
2032
  "placeholder-slate-400",
1979
- "focus-visible:outline-none",
1980
2033
  "w-full",
1981
2034
  "h-20",
1982
2035
  "transition",
@@ -2053,7 +2106,7 @@ const TextField = React.forwardRef((_a, ref) => {
2053
2106
  }
2054
2107
  }, [onChange]);
2055
2108
  return (jsx(FormGroup, { dataTestId: dataTestId && `${dataTestId}-FormGroup`, helpAddon: helpAddon ||
2056
- (maxLength !== null && maxLength !== undefined && (jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(TextInput, Object.assign({ "aria-labelledby": htmlFor + "-label", disabled: rest.readOnly, id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value }, rest, { className: className, dataTestId: dataTestId, onChange: handleChange })) }));
2109
+ (maxLength !== null && maxLength !== undefined && (jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(TextInput, Object.assign({ "aria-labelledby": htmlFor + "-label", id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value }, rest, { className: className, dataTestId: dataTestId, onChange: handleChange })) }));
2057
2110
  });
2058
2111
 
2059
2112
  /**
@@ -2071,16 +2124,7 @@ const TimeRangeField = (_a) => {
2071
2124
 
2072
2125
  const cvaToggleWrapper = cvaMerge(["flex", "gap-2", "items-center"]);
2073
2126
  cvaMerge(["relative"]);
2074
- const cvaToggleTrack = cvaMerge([
2075
- "shrink-0",
2076
- "p-1",
2077
- "cursor-pointer",
2078
- "rounded-full",
2079
- "bg-slate-300",
2080
- "focus:bg-slate-400",
2081
- "hover:bg-slate-400",
2082
- "active:bg-slate-500",
2083
- ], {
2127
+ const cvaToggleTrack = cvaMerge(["shrink-0", "p-1", "cursor-pointer", "rounded-full", "bg-slate-300", "hover:bg-slate-400", "active:bg-slate-500"], {
2084
2128
  variants: {
2085
2129
  size: {
2086
2130
  small: ["w-8", "h-4"],
@@ -2091,7 +2135,7 @@ const cvaToggleTrack = cvaMerge([
2091
2135
  false: "",
2092
2136
  },
2093
2137
  toggled: {
2094
- true: ["bg-primary-600", "focus:bg-primary-700", "hover:bg-primary-700", "active:bg-primary-800"],
2138
+ true: ["bg-primary-600", "hover:bg-primary-700", "active:bg-primary-800"],
2095
2139
  false: "",
2096
2140
  },
2097
2141
  },
@@ -2209,7 +2253,7 @@ const UrlInput = forwardRef((_a, ref) => {
2209
2253
  var { dataTestId, isInvalid, disabled = false, fieldSize = "medium", disableAction = false, value, defaultValue } = _a, rest = __rest(_a, ["dataTestId", "isInvalid", "disabled", "fieldSize", "disableAction", "value", "defaultValue"]);
2210
2254
  const [url, setUrl] = useState((value === null || value === void 0 ? void 0 : value.toString()) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString()));
2211
2255
  const renderAsInvalid = (url && typeof url === "string" && !validateUrlAddress(url)) || isInvalid;
2212
- return (jsx(BaseInput, Object.assign({ dataTestId: dataTestId && `${dataTestId}-url-input`, disabled: disabled, id: "url-input", isInvalid: renderAsInvalid, onChange: e => setUrl(e.target.value), placeholder: rest.placeholder || "https://www.example.com", ref: ref, type: "url", value: url }, rest, { actions: !disableAction && (jsx(ActionButton, { dataTestId: (dataTestId && `${dataTestId}-url-input-Icon`) || "url-input-action-icon", disabled: renderAsInvalid || disabled, iconSize: fieldSize, type: "WEB_ADDRESS", value: url })) })));
2256
+ return (jsx(BaseInput, Object.assign({ dataTestId: dataTestId && `${dataTestId}-url-input`, disabled: disabled, id: "url-input", isInvalid: renderAsInvalid, onChange: e => setUrl(e.target.value), placeholder: rest.placeholder || "https://www.example.com", ref: ref, type: "url", value: url }, rest, { actions: !disableAction && (jsx(ActionButton, { dataTestId: (dataTestId && `${dataTestId}-url-input-Icon`) || "url-input-action-icon", disabled: renderAsInvalid || disableAction, iconSize: fieldSize, type: "WEB_ADDRESS", value: url })) })));
2213
2257
  });
2214
2258
 
2215
2259
  /**
@@ -2225,7 +2269,7 @@ const UrlField = forwardRef((_a, ref) => {
2225
2269
  return typeof inputValue === "string";
2226
2270
  }
2227
2271
  const renderAsInvalid = !!errorMessage || (value && isString(value) && !validateUrlAddress(value)) || isInvalid;
2228
- return (jsx(FormGroup, { dataTestId: dataTestId && `${dataTestId}-FormGroup`, disabled: rest.disabled, helpAddon: helpAddon, helpText: renderAsInvalid ? errorMessage : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(UrlInput, Object.assign({ "aria-labelledby": htmlForId + "-label", disabled: rest.disabled, id: htmlForId, isInvalid: renderAsInvalid, ref: ref, value: value || defaultValue }, rest, { className: className, dataTestId: dataTestId })) }));
2272
+ return (jsx(FormGroup, { dataTestId: dataTestId && `${dataTestId}-FormGroup`, disabled: rest.disabled, helpAddon: helpAddon, helpText: renderAsInvalid ? errorMessage : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(UrlInput, Object.assign({ "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref, value: value || defaultValue }, rest, { className: className, dataTestId: dataTestId })) }));
2229
2273
  });
2230
2274
 
2231
2275
  /**
@@ -2332,4 +2376,4 @@ const useZodValidators = () => {
2332
2376
  */
2333
2377
  setupLibraryTranslations();
2334
2378
 
2335
- export { ActionButton, BaseInput, Checkbox, CheckboxField, ColorField, CreatableSelect, CreatableSelectField, DateField, DateInput, DropZone, EMAIL_REGEX, EmailField, EmailInput, FormFieldSelectAdapter, FormGroup, Label, MultiSelectMenuItem, NumberField, NumberInput, OptionCard, PasswordField, PasswordInput, PhoneField, PhoneFieldWithController, PhoneInput, RadioGroup, RadioItem, Schedule, ScheduleVariant, Search, Select, SelectField, SingleSelectMenuItem, TextArea, TextAreaField, TextField, TextInput, TimeRange, TimeRangeField, Toggle, UploadField, UploadInput, UrlField, UrlInput, checkIfPhoneNumberHasPlus, countryCodeToFlagEmoji, cvaActionButton, cvaActionContainer, cvaInput, cvaInputAddon, cvaInputAddonAfter, cvaInputAddonBefore, cvaInputBase, cvaInputBaseDisabled, cvaInputBaseInvalid, cvaInputField, cvaInputPrefix, cvaInputSuffix, cvaSelect, cvaSelectCounter, cvaSelectDynamicTagContainer, cvaSelectIcon, cvaSelectMenu, cvaSelectMenuList, cvaSelectPrefix, cvaSelectXIcon, getCountryAbbreviation, getOrderedOptions, getPhoneNumberWithPlus, isInvalidCountryCode, isInvalidPhoneNumber, isMultiValue, isValidHEXColor, parseSchedule, serializeSchedule, useCustomComponents, useGetPhoneValidationRules, usePhoneInput, useZodValidators, validateEmailAddress, validatePhoneNumber, weekDay };
2379
+ export { ActionButton, BaseInput, Checkbox, CheckboxField, ColorField, CreatableSelect, CreatableSelectField, DateField, DateInput, DropZone, EMAIL_REGEX, EmailField, EmailInput, FormFieldSelectAdapter, FormGroup, Label, MultiSelectMenuItem, NumberField, NumberInput, OptionCard, PasswordField, PasswordInput, PhoneField, PhoneFieldWithController, PhoneInput, RadioGroup, RadioItem, Schedule, ScheduleVariant, Search, Select, SelectField, SingleSelectMenuItem, TextArea, TextAreaField, TextField, TextInput, TimeRange, TimeRangeField, Toggle, UploadField, UploadInput, UrlField, UrlInput, checkIfPhoneNumberHasPlus, countryCodeToFlagEmoji, cvaActionButton, cvaActionContainer, cvaInput, cvaInputAction, cvaInputAddon, cvaInputAddonAfter, cvaInputAddonBefore, cvaInputBase, cvaInputBaseDisabled, cvaInputBaseInvalid, cvaInputField, cvaInputPrefix, cvaInputSuffix, cvaSelect, cvaSelectControl, cvaSelectCounter, cvaSelectDynamicTagContainer, cvaSelectIcon, cvaSelectMenu, cvaSelectMenuList, cvaSelectPrefix, cvaSelectXIcon, getCountryAbbreviation, getOrderedOptions, getPhoneNumberWithPlus, isInvalidCountryCode, isInvalidPhoneNumber, isMultiValue, isValidHEXColor, parseSchedule, serializeSchedule, useCustomComponents, useGetPhoneValidationRules, usePhoneInput, useZodValidators, validateEmailAddress, validatePhoneNumber, weekDay };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "0.0.425",
3
+ "version": "0.0.428",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,13 +9,23 @@ export declare const cvaInput: (props?: ({
9
9
  export declare const cvaInputField: (props?: ({
10
10
  size?: "small" | "medium" | null | undefined;
11
11
  disabled?: boolean | null | undefined;
12
+ autoFocus?: boolean | null | undefined;
13
+ addonBefore?: boolean | null | undefined;
14
+ prefix?: boolean | null | undefined;
12
15
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
13
16
  export declare const cvaInputAddon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
14
17
  export declare const cvaInputAddonBefore: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
15
- export declare const cvaInputAddonAfter: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
16
18
  export declare const cvaInputPrefix: (props?: ({
17
19
  disabled?: boolean | null | undefined;
20
+ addonBefore?: boolean | null | undefined;
18
21
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
19
22
  export declare const cvaInputSuffix: (props?: ({
20
23
  disabled?: boolean | null | undefined;
24
+ addonAfter?: boolean | null | undefined;
25
+ actions?: boolean | null | undefined;
26
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
27
+ export declare const cvaInputAddonAfter: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
28
+ export declare const cvaInputAction: (props?: ({
29
+ addonAfter?: boolean | null | undefined;
30
+ suffix?: boolean | null | undefined;
21
31
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,5 +1,17 @@
1
1
  import * as React from "react";
2
2
  import { BaseInputProps } from "../BaseInput";
3
+ type BaseInputExposedProps = Omit<BaseInputProps, "type">;
4
+ export interface EmailInputProps extends BaseInputExposedProps {
5
+ /**
6
+ * To disable the action button.
7
+ *
8
+ * @default false
9
+ * @memberof EmailInputProps
10
+ * @example
11
+ * <UrLInput disableAction />
12
+ */
13
+ disableAction?: boolean;
14
+ }
3
15
  /**
4
16
  * A Email Input component is used for input of the type Email.
5
17
  *
@@ -10,4 +22,5 @@ import { BaseInputProps } from "../BaseInput";
10
22
  * A reference to the input element is provided as the `ref` prop.
11
23
  * For specific input types make sure to use the corresponding input component.
12
24
  */
13
- export declare const EmailInput: React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<HTMLInputElement>>;
25
+ export declare const EmailInput: React.ForwardRefExoticComponent<EmailInputProps & React.RefAttributes<HTMLInputElement>>;
26
+ export {};
@@ -2,6 +2,11 @@ export declare const cvaSelect: (props?: ({
2
2
  invalid?: boolean | null | undefined;
3
3
  disabled?: boolean | null | undefined;
4
4
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
+ export declare const cvaSelectControl: (props?: ({
6
+ isDisabled?: boolean | null | undefined;
7
+ prefix?: boolean | null | undefined;
8
+ invalid?: boolean | null | undefined;
9
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
10
  export declare const cvaSelectIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
6
11
  export declare const cvaSelectPrefix: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
7
12
  export declare const cvaSelectXIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -16,4 +16,4 @@ import { SelectComponents } from "react-select/dist/declarations/src/components"
16
16
  * @param {JSX.Element} dropdownIcon an custom dropdown icon
17
17
  * @returns {Partial<SelectComponents<Option, boolean, GroupBase<Option>>> | undefined} components object to override react-select default components
18
18
  */
19
- export declare const useCustomComponents: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(componentsProps: Partial<SelectComponents<Option, IsMulti, Group>> | undefined, disabled: boolean, menuIsOpen: boolean, refMenuIsEnabled: React.MutableRefObject<boolean>, dataTestId: string, maxSelectedDisplayCount: number | undefined, dropdownIcon?: JSX.Element) => Partial<SelectComponents<Option, IsMulti, Group>>;
19
+ export declare const useCustomComponents: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(componentsProps: Partial<SelectComponents<Option, IsMulti, Group>> | undefined, disabled: boolean, menuIsOpen: boolean, refMenuIsEnabled: React.MutableRefObject<boolean>, dataTestId: string, maxSelectedDisplayCount: number | undefined, dropdownIcon?: JSX.Element, prefix?: JSX.Element, hasError?: boolean) => Partial<SelectComponents<Option, IsMulti, Group>>;