@trackunit/react-form-components 0.0.428 → 0.0.429

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