@trackunit/react-form-components 0.0.453 → 0.0.454

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
@@ -210,21 +210,56 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
210
210
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
211
211
  };
212
212
 
213
+ /**
214
+ * Used to compare two React nodes for deep equality.
215
+ */
216
+ const compareReactNodes = (node1, node2) => {
217
+ // Base case: If both objects are identical, return true.
218
+ if (node1 === node2) {
219
+ return true;
220
+ }
221
+ // Check if both objects are valid React elements.
222
+ if (React.isValidElement(node1) && React.isValidElement(node2)) {
223
+ const { type: type1, props: props1, key: key1 } = node1;
224
+ const { type: type2, props: props2, key: key2 } = node2;
225
+ if (type1 !== type2 || key1 !== key2) {
226
+ return false;
227
+ }
228
+ return compareReactNodes(props1, props2);
229
+ }
230
+ // Check if both objects are objects and not null.
231
+ if (typeof node1 !== "object" || typeof node2 !== "object" || node1 === null || node2 === null) {
232
+ return false;
233
+ }
234
+ // Get the keys of both objects.
235
+ const keys1 = Object.keys(node1);
236
+ const keys2 = Object.keys(node2);
237
+ // Check if the number of keys is the same.
238
+ if (keys1.length !== keys2.length) {
239
+ return false;
240
+ }
241
+ // Iterate through the keys and compare their values recursively.
242
+ for (const key of keys1) {
243
+ if (!keys2.includes(key) ||
244
+ !compareReactNodes(node1[key], node2[key])) {
245
+ return false;
246
+ }
247
+ }
248
+ // If all checks pass, the objects are deep equal.
249
+ return true;
250
+ };
251
+
213
252
  const cvaInputBase = cssClassVarianceUtilities.cvaMerge([
214
253
  "component-baseInput-shadow",
215
254
  "component-baseInput-border",
216
255
  "component-baseInput-background",
217
256
  "border-slate-300",
218
- "focus-within:ring-2",
219
- "focus-within:ring-inset",
220
- "focus-within:ring-primary-500",
221
- "focus-within:border-slate-400",
222
257
  "hover:border-slate-400",
223
258
  "hover:bg-slate-50",
224
259
  "transition",
225
260
  ]);
226
261
  const cvaInputBaseDisabled = cssClassVarianceUtilities.cvaMerge(["bg-slate-100", "hover:bg-slate-100", "hover:border-slate-300"]);
227
- const cvaInputBaseInvalid = cssClassVarianceUtilities.cvaMerge(["border-danger-600", "focus-within:ring-danger-600"]);
262
+ const cvaInputBaseInvalid = cssClassVarianceUtilities.cvaMerge(["border-danger-600"]);
228
263
  const cvaInput = cssClassVarianceUtilities.cvaMerge(["relative", "flex", "h-10", cvaInputBase()], {
229
264
  variants: {
230
265
  size: {
@@ -233,24 +268,15 @@ const cvaInput = cssClassVarianceUtilities.cvaMerge(["relative", "flex", "h-10",
233
268
  },
234
269
  disabled: {
235
270
  true: cvaInputBaseDisabled(),
236
- false: "",
271
+ false: [""],
237
272
  },
238
273
  invalid: {
239
274
  true: cvaInputBaseInvalid(),
240
- false: "",
275
+ false: [""],
241
276
  },
242
277
  },
243
278
  });
244
- const cvaInputField = cssClassVarianceUtilities.cvaMerge([
245
- "w-full",
246
- "px-3",
247
- "border-0",
248
- "bg-transparent",
249
- "text-base",
250
- "text-slate-900",
251
- "placeholder-slate-400",
252
- "focus-visible:outline-none",
253
- ], {
279
+ const cvaInputField = cssClassVarianceUtilities.cvaMerge(["w-full", "px-3", "border-0", "bg-transparent", "text-base", "text-slate-900", "placeholder-slate-400", "component-baseInput-border"], {
254
280
  variants: {
255
281
  size: {
256
282
  small: ["py-1"],
@@ -258,9 +284,28 @@ const cvaInputField = cssClassVarianceUtilities.cvaMerge([
258
284
  },
259
285
  disabled: {
260
286
  true: ["text-slate-700"],
261
- false: "",
287
+ false: [""],
288
+ },
289
+ autoFocus: {
290
+ true: [""],
291
+ false: ["focus-visible:outline-none"],
292
+ },
293
+ addonBefore: {
294
+ true: [""],
295
+ false: [""],
296
+ },
297
+ prefix: {
298
+ true: ["ps-10"],
299
+ false: [""],
262
300
  },
263
301
  },
302
+ compoundVariants: [
303
+ {
304
+ addonBefore: true,
305
+ prefix: true,
306
+ className: ["ps-4"],
307
+ },
308
+ ],
264
309
  });
265
310
  const cvaInputAddon = cssClassVarianceUtilities.cvaMerge([
266
311
  "flex",
@@ -272,7 +317,6 @@ const cvaInputAddon = cssClassVarianceUtilities.cvaMerge([
272
317
  "bg-slate-50",
273
318
  ]);
274
319
  const cvaInputAddonBefore = cssClassVarianceUtilities.cvaMerge([cvaInputAddon(), "border-r", "rounded-l-lg"]);
275
- const cvaInputAddonAfter = cssClassVarianceUtilities.cvaMerge([cvaInputAddon(), "border-l", "rounded-r-lg"]);
276
320
  const cvaInputPrefix = cssClassVarianceUtilities.cvaMerge([
277
321
  "flex",
278
322
  "justify-center",
@@ -282,21 +326,62 @@ const cvaInputPrefix = cssClassVarianceUtilities.cvaMerge([
282
326
  "component-baseInput-prefix",
283
327
  "component-search-borderless",
284
328
  "pl-3",
329
+ "absolute",
330
+ "inset-y-0",
285
331
  ], {
286
332
  variants: {
287
333
  disabled: {
288
334
  true: ["text-slate-500"],
289
- false: "",
335
+ false: [""],
336
+ },
337
+ addonBefore: {
338
+ true: ["relative"],
339
+ false: [""],
290
340
  },
291
341
  },
292
342
  });
293
- const cvaInputSuffix = cssClassVarianceUtilities.cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "px-3"], {
343
+ const cvaInputSuffix = cssClassVarianceUtilities.cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "px-3", "absolute", "inset-y-0", "right-0"], {
294
344
  variants: {
295
345
  disabled: {
296
346
  true: ["text-slate-500"],
297
- false: "",
347
+ false: [""],
348
+ },
349
+ addonAfter: {
350
+ true: ["relative"],
351
+ false: [""],
352
+ },
353
+ actions: {
354
+ true: ["right-10"],
355
+ false: [""],
298
356
  },
299
357
  },
358
+ compoundVariants: [
359
+ {
360
+ addonAfter: true,
361
+ actions: true,
362
+ className: ["right-0"],
363
+ },
364
+ ],
365
+ });
366
+ const cvaInputAddonAfter = cssClassVarianceUtilities.cvaMerge([cvaInputAddon(), "border-l", "rounded-r-lg", "ml-[1px]"]);
367
+ const cvaInputAction = cssClassVarianceUtilities.cvaMerge(["absolute", "end-0.5"], {
368
+ variants: {
369
+ addonAfter: {
370
+ true: ["relative"],
371
+ false: [""],
372
+ },
373
+ suffix: {
374
+ true: ["absolute"],
375
+ false: [""],
376
+ },
377
+ },
378
+ compoundVariants: [
379
+ {
380
+ addonAfter: true,
381
+ suffix: true,
382
+ className: ["relative"],
383
+ },
384
+ ],
300
385
  });
301
386
 
302
387
  /**
@@ -319,14 +404,27 @@ const BaseInput = React__namespace.forwardRef((_a, ref) => {
319
404
  invalid: isInvalid,
320
405
  size: fieldSize,
321
406
  className,
322
- }), "data-testid": dataTestId ? `${dataTestId}-container` : null, children: [addonBefore ? (jsxRuntime.jsx("div", { className: cvaInputAddonBefore({ className: addonBeforeClassName }), "data-testid": dataTestId ? `${dataTestId}-addonBefore` : null, children: addonBefore })) : null, prefix && addonBefore !== prefix ? (jsxRuntime.jsx("div", { className: cvaInputPrefix({
407
+ }), "data-testid": dataTestId ? `${dataTestId}-container` : null, children: [addonBefore ? (jsxRuntime.jsx("div", { className: cvaInputAddonBefore({ className: addonBeforeClassName }), "data-testid": dataTestId ? `${dataTestId}-addonBefore` : null, children: addonBefore })) : null, prefix && !compareReactNodes(addonBefore, prefix) ? (jsxRuntime.jsx("div", { className: cvaInputPrefix({
323
408
  disabled: renderAsDisabled,
324
- }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, 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({
409
+ addonBefore: addonBefore !== undefined,
410
+ }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, children: prefix })) : null, jsxRuntime.jsx("input", Object.assign({ "aria-required": rest.required, className: cvaInputField({
411
+ autoFocus: rest.autoFocus,
412
+ size: fieldSize,
325
413
  disabled: renderAsDisabled,
414
+ className: inputClassName,
415
+ addonBefore: addonBefore !== undefined,
416
+ prefix: !compareReactNodes(addonBefore, prefix),
417
+ }), "data-testid": dataTestId, placeholder: renderAsDisabled ? undefined : placeholder, ref: innerRef }, rest, { disabled: renderAsDisabled, readOnly: rest.readOnly || nonInteractive })), suffix && addonBefore !== suffix ? (jsxRuntime.jsx("div", { className: cvaInputSuffix({
418
+ disabled: renderAsDisabled,
419
+ addonAfter: addonAfter !== undefined && !compareReactNodes(addonBefore, addonAfter),
420
+ actions: (actions && !compareReactNodes(addonBefore, actions)) || false,
326
421
  }), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix })) : null, rest.readOnly === true &&
327
422
  showDefaultActions &&
328
423
  ((_b = innerRef.current) === null || _b === void 0 ? void 0 : _b.value.length) &&
329
- innerRef.current.value.length > 0 ? (jsxRuntime.jsx(ActionButton, { type: "COPY", value: innerRef }, "default-copy-action")) : null, actions && addonBefore !== actions ? actions : null, addonAfter && addonBefore !== addonAfter ? (jsxRuntime.jsx("div", { className: cvaInputAddonAfter(), "data-testid": dataTestId ? `${dataTestId}-addonAfter` : null, children: addonAfter })) : null] }));
424
+ innerRef.current.value.length > 0 ? (jsxRuntime.jsx(ActionButton, { type: "COPY", value: innerRef }, "default-copy-action")) : null, actions && !compareReactNodes(addonBefore, actions) ? (jsxRuntime.jsx("div", { className: cvaInputAction({
425
+ addonAfter: addonAfter !== undefined && !compareReactNodes(addonBefore, addonAfter),
426
+ suffix: !compareReactNodes(addonBefore, suffix),
427
+ }), children: actions })) : null, addonAfter && !compareReactNodes(addonBefore, addonAfter) && !compareReactNodes(addonAfter, suffix) ? (jsxRuntime.jsx("div", { className: cvaInputAddonAfter(), "data-testid": dataTestId ? `${dataTestId}-addonAfter` : null, children: addonAfter })) : null] }));
330
428
  });
331
429
  BaseInput.displayName = "BaseInput";
332
430
 
@@ -381,15 +479,11 @@ const cvaCheckbox = cssClassVarianceUtilities.cvaMerge([
381
479
  "justify-center",
382
480
  "box-border",
383
481
  "transition",
384
- "focus:bg-slate-200",
385
482
  "outline-0",
386
483
  "active:bg-slate-200",
387
484
  "active:ring-2",
388
485
  "active:ring-inset",
389
486
  "active:ring-primary-700",
390
- "focus:ring-2",
391
- "focus:ring-inset",
392
- "focus:ring-primary-700",
393
487
  "cursor-pointer",
394
488
  "group-active:ring-2",
395
489
  "group-active:ring-inset",
@@ -397,13 +491,7 @@ const cvaCheckbox = cssClassVarianceUtilities.cvaMerge([
397
491
  ], {
398
492
  variants: {
399
493
  invalid: {
400
- true: [
401
- "border-red-600",
402
- "active:ring-red-700",
403
- "focus:ring-red-700",
404
- "group-focus:ring-2",
405
- "group-focus:ring-inset",
406
- ],
494
+ true: ["border-red-600", "active:ring-red-700", "group-focus:ring-2", "group-focus:ring-inset"],
407
495
  false: "",
408
496
  },
409
497
  state: {
@@ -413,11 +501,8 @@ const cvaCheckbox = cssClassVarianceUtilities.cvaMerge([
413
501
  "hover:bg-primary-700",
414
502
  "hover:border-primary-700",
415
503
  "active:bg-primary-700",
416
- "focus:bg-primary-700",
417
504
  "group-hover:bg-primary-700",
418
505
  "group-hover:border-primary-700",
419
- "group-focus:bg-primary-700",
420
- "group-focus:border-primary-700",
421
506
  ],
422
507
  deselected: ["group-hover:bg-slate-100"],
423
508
  indeterminate: [
@@ -425,14 +510,10 @@ const cvaCheckbox = cssClassVarianceUtilities.cvaMerge([
425
510
  "border-primary-600",
426
511
  "hover:bg-primary-700",
427
512
  "hover:border-primary-700",
428
- "focus:bg-primary-800",
429
- "focus:border-primary-800",
430
513
  "active:bg-primary-800",
431
514
  "active:border-primary-800",
432
515
  "group-hover:bg-primary-700",
433
516
  "group-hover:border-primary-700",
434
- "group-focus:bg-primary-800",
435
- "group-focus:border-primary-800",
436
517
  ],
437
518
  },
438
519
  disabled: {
@@ -440,13 +521,8 @@ const cvaCheckbox = cssClassVarianceUtilities.cvaMerge([
440
521
  "bg-slate-300",
441
522
  "border-slate-300",
442
523
  "cursor-not-allowed",
443
- "group-hover:bg-slate-300",
444
- "group-focus:bg-slate-300",
445
524
  "hover:bg-slate-300",
446
- "focus:bg-slate-300",
447
525
  "active:bg-slate-300",
448
- "focus:ring-0",
449
- "focus:ring-inset",
450
526
  "group-active:ring-0",
451
527
  "group-active:ring-inset",
452
528
  ],
@@ -807,7 +883,7 @@ const validateEmailAddress = (email) => {
807
883
  * For specific input types make sure to use the corresponding input component.
808
884
  */
809
885
  const EmailInput = React__namespace.forwardRef((_a, ref) => {
810
- var { fieldSize = "medium", disabled = false, dataTestId, isInvalid = false, onChange } = _a, rest = __rest(_a, ["fieldSize", "disabled", "dataTestId", "isInvalid", "onChange"]);
886
+ var { fieldSize = "medium", disabled = false, dataTestId, isInvalid = false, onChange, disableAction = false } = _a, rest = __rest(_a, ["fieldSize", "disabled", "dataTestId", "isInvalid", "onChange", "disableAction"]);
811
887
  const [email, setEmail] = React__namespace.useState("");
812
888
  const sendEmail = () => {
813
889
  return window.open(`mailto:${email}`);
@@ -818,7 +894,7 @@ const EmailInput = React__namespace.forwardRef((_a, ref) => {
818
894
  setEmail(newValue);
819
895
  }, [onChange]);
820
896
  const renderAsInvalid = (email && !validateEmailAddress(email)) || isInvalid;
821
- return (jsxRuntime.jsx(BaseInput, Object.assign({ actions: email && email.length > 0 ? (jsxRuntime.jsx(ActionButton, { dataTestId: dataTestId ? `${dataTestId}-emailIcon` : undefined, disabled: disabled, iconSize: fieldSize, onClick: sendEmail, type: "EMAIL", value: email })) : null, dataTestId: dataTestId, isInvalid: renderAsInvalid, onChange: handleChange, placeholder: rest.placeholder || "mail@example.com", ref: ref, type: "email" }, rest)));
897
+ return (jsxRuntime.jsx(BaseInput, Object.assign({ actions: email && email.length > 0 ? (jsxRuntime.jsx(ActionButton, { dataTestId: dataTestId ? `${dataTestId}-emailIcon` : undefined, disabled: disableAction || isInvalid, iconSize: fieldSize, onClick: sendEmail, type: "EMAIL", value: email })) : null, dataTestId: dataTestId, disabled: disabled, isInvalid: renderAsInvalid, onChange: handleChange, placeholder: rest.placeholder || "mail@example.com", ref: ref, type: "email" }, rest)));
822
898
  });
823
899
  EmailInput.displayName = "EmailInput";
824
900
 
@@ -1045,7 +1121,7 @@ const PhoneInput = React.forwardRef((_a, ref) => {
1045
1121
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
1046
1122
  fieldIsFocused.current = true;
1047
1123
  }, [onFocus]);
1048
- return (jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-2", "data-testid": dataTestId ? `${dataTestId}-container` : null, children: jsxRuntime.jsx(BaseInput, Object.assign({ actions: !disableAction && innerValue && innerValue.length > 0 ? (jsxRuntime.jsx(ActionButton, { dataTestId: dataTestId ? `${dataTestId}-phoneIcon` : undefined, disabled: disabled || isInvalid, iconSize: fieldSize, type: "PHONE_NUMBER", value: (value === null || value === void 0 ? void 0 : value.toString()) || "" })) : null, dataTestId: dataTestId ? `${dataTestId}-phoneNumberInput` : undefined, 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)) }));
1124
+ return (jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-2", "data-testid": dataTestId ? `${dataTestId}-container` : null, children: jsxRuntime.jsx(BaseInput, Object.assign({ actions: !disableAction && innerValue && innerValue.length > 0 ? (jsxRuntime.jsx(ActionButton, { dataTestId: dataTestId ? `${dataTestId}-phoneIcon` : undefined, disabled: isInvalid, iconSize: fieldSize, type: "PHONE_NUMBER", value: (value === null || value === void 0 ? void 0 : value.toString()) || "" })) : null, dataTestId: dataTestId ? `${dataTestId}-phoneNumberInput` : undefined, 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)) }));
1049
1125
  });
1050
1126
  PhoneInput.displayName = "PhoneInput";
1051
1127
 
@@ -1146,9 +1222,6 @@ const cvaRadioItem = cssClassVarianceUtilities.cvaMerge([
1146
1222
  "box-border",
1147
1223
  "hover:cursor-pointer",
1148
1224
  "hover:bg-slate-100",
1149
- "focus:ring-2",
1150
- "focus:ring-inset",
1151
- "focus:ring-primary-700",
1152
1225
  ], {
1153
1226
  variants: {
1154
1227
  checked: {
@@ -1164,10 +1237,6 @@ const cvaRadioItem = cssClassVarianceUtilities.cvaMerge([
1164
1237
  "active:ring-2",
1165
1238
  "active:ring-inset",
1166
1239
  "active:ring-primary-700",
1167
- "focus:bg-slate-200",
1168
- "focus:ring-2",
1169
- "focus:ring-inset",
1170
- "focus:ring-primary-700",
1171
1240
  "group-active:ring-2",
1172
1241
  "group-active:ring-inset",
1173
1242
  "group-active:ring-primary-700",
@@ -1175,13 +1244,7 @@ const cvaRadioItem = cssClassVarianceUtilities.cvaMerge([
1175
1244
  false: "",
1176
1245
  },
1177
1246
  invalid: {
1178
- true: [
1179
- "border-red-600",
1180
- "active:ring-red-700",
1181
- "focus:ring-red-700",
1182
- "group-focus:ring-2",
1183
- "group-focus:ring-inset",
1184
- ],
1247
+ true: ["border-red-600", "active:ring-red-700"],
1185
1248
  false: "",
1186
1249
  },
1187
1250
  disabled: {
@@ -1189,13 +1252,8 @@ const cvaRadioItem = cssClassVarianceUtilities.cvaMerge([
1189
1252
  "bg-slate-400",
1190
1253
  "border-slate-300",
1191
1254
  "cursor-not-allowed",
1192
- "group-hover:bg-slate-400",
1193
- "group-focus:bg-slate-400",
1194
1255
  "hover:bg-slate-400",
1195
- "focus:bg-slate-400",
1196
1256
  "active:bg-slate-400",
1197
- "focus:ring-0",
1198
- "focus:ring-inset",
1199
1257
  "group-active:ring-0",
1200
1258
  "group-active:ring-inset",
1201
1259
  ],
@@ -1445,21 +1503,13 @@ const cvaSearch = cssClassVarianceUtilities.cvaMerge([
1445
1503
  "component-search-background",
1446
1504
  "hover:component-search-background",
1447
1505
  "hover:component-search-focus-hover",
1448
- "focus:component-search-focus-hover",
1449
- "focus-within:component-search-focus-within",
1450
1506
  "transition-all",
1451
1507
  "duration-300",
1452
1508
  ], {
1453
1509
  variants: {
1454
1510
  border: { true: ["!component-search-borderless"], false: "" },
1455
1511
  widenOnFocus: {
1456
- true: [
1457
- "component-search-width",
1458
- "component-search-widen",
1459
- "hover:component-search-widen",
1460
- "focus-within:component-search-widen-focus",
1461
- "focus-within:w-full",
1462
- ],
1512
+ true: ["component-search-width", "component-search-widen", "hover:component-search-widen"],
1463
1513
  false: "w-full",
1464
1514
  },
1465
1515
  },
@@ -1484,25 +1534,19 @@ const cvaSelect = cssClassVarianceUtilities.cvaMerge([
1484
1534
  "flex",
1485
1535
  "shadow-sm",
1486
1536
  "rounded-lg",
1487
- "border",
1488
1537
  "border-slate-300",
1489
- "focus-within:ring-2",
1490
- "focus-within:ring-inset",
1491
- "focus-within:ring-primary-600",
1492
- "focus-within:border-slate-400",
1493
1538
  "hover:border-slate-400",
1494
1539
  "hover:bg-slate-50",
1495
1540
  "bg-white",
1496
1541
  "transition",
1497
- "overflow-hidden",
1498
1542
  ], {
1499
1543
  variants: {
1500
1544
  invalid: {
1501
- true: "border-red-600 text-red-600 focus-within:ring-red-600 hover:border-red-600",
1545
+ true: "border border-red-600 text-red-600 hover:border-red-600",
1502
1546
  false: "",
1503
1547
  },
1504
1548
  disabled: {
1505
- true: "!bg-slate-100",
1549
+ true: "!bg-slate-100 hover:border-slate-300",
1506
1550
  false: "",
1507
1551
  },
1508
1552
  },
@@ -1511,10 +1555,56 @@ const cvaSelect = cssClassVarianceUtilities.cvaMerge([
1511
1555
  disabled: false,
1512
1556
  },
1513
1557
  });
1514
- const cvaSelectIcon = cssClassVarianceUtilities.cvaMerge(["mr-2", "flex", "cursor-pointer", "items-center", "justify-center", "text-slate-400", "hover:text-slate-500"]);
1515
- const cvaSelectPrefix = cssClassVarianceUtilities.cvaMerge(["flex", "justify-center", "items-center", "text-slate-400", "pl-2"]);
1516
- const cvaSelectXIcon = cssClassVarianceUtilities.cvaMerge(["mr-2", "flex", "cursor-pointer", "items-center", "justify-center", "text-slate-400", "hover:text-slate-500", "ml-1"]);
1517
- const cvaSelectMenuList = cssClassVarianceUtilities.cvaMerge(["min-w-min", "shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
1558
+ const cvaSelectControl = cssClassVarianceUtilities.cvaMerge([], {
1559
+ variants: {
1560
+ isDisabled: {
1561
+ true: "!bg-slate-100",
1562
+ false: "",
1563
+ },
1564
+ prefix: {
1565
+ true: ["ps-7"],
1566
+ false: "",
1567
+ },
1568
+ invalid: {
1569
+ true: "!border-0",
1570
+ false: "",
1571
+ },
1572
+ },
1573
+ defaultVariants: {
1574
+ isDisabled: false,
1575
+ prefix: false,
1576
+ invalid: false,
1577
+ },
1578
+ });
1579
+ const cvaSelectIcon = cssClassVarianceUtilities.cvaMerge([
1580
+ "mr-2",
1581
+ "flex",
1582
+ "cursor-pointer",
1583
+ "items-center",
1584
+ "justify-center",
1585
+ "text-slate-400",
1586
+ "hover:text-slate-500",
1587
+ ]);
1588
+ const cvaSelectPrefix = cssClassVarianceUtilities.cvaMerge([
1589
+ "flex",
1590
+ "justify-center",
1591
+ "items-center",
1592
+ "text-slate-400",
1593
+ "pl-2",
1594
+ "absolute",
1595
+ "inset-y-0",
1596
+ ]);
1597
+ const cvaSelectXIcon = cssClassVarianceUtilities.cvaMerge([
1598
+ "mr-2",
1599
+ "flex",
1600
+ "cursor-pointer",
1601
+ "items-center",
1602
+ "justify-center",
1603
+ "text-slate-400",
1604
+ "hover:text-slate-500",
1605
+ "ml-1",
1606
+ ]);
1607
+ const cvaSelectMenuList = cssClassVarianceUtilities.cvaMerge([], {
1518
1608
  variants: {
1519
1609
  menuIsOpen: {
1520
1610
  true: "animate-fade-in-fast",
@@ -1697,7 +1787,7 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
1697
1787
  * @param {JSX.Element} dropdownIcon an custom dropdown icon
1698
1788
  * @returns {Partial<SelectComponents<Option, boolean, GroupBase<Option>>> | undefined} components object to override react-select default components
1699
1789
  */
1700
- const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon) => {
1790
+ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon, prefix, hasError) => {
1701
1791
  const [t] = useTranslation();
1702
1792
  // perhaps it should not be wrap in memo (causing some issues with opening and closing on mobiles)
1703
1793
  const customComponents = React__namespace.useMemo(() => {
@@ -1748,7 +1838,11 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
1748
1838
  }
1749
1839
  return (jsxRuntime.jsx(ReactSelect.components.ClearIndicator, Object.assign({}, props, { children: jsxRuntime.jsx("div", { className: cvaSelectXIcon(), "data-testid": dataTestId ? `${dataTestId}-XMarkIcon` : null, onClick: props.clearValue, children: jsxRuntime.jsx(reactComponents.Icon, { name: "XCircle", size: "medium", title: t("clearIndicator.icon.tooltip.clearAll") }) }) })));
1750
1840
  }, Control: props => {
1751
- return jsxRuntime.jsx(ReactSelect.components.Control, Object.assign({}, props, { className: props.isDisabled ? "bg-slate-100" : "" }));
1841
+ return (jsxRuntime.jsx(ReactSelect.components.Control, Object.assign({}, props, { className: cvaSelectControl({
1842
+ isDisabled: props.isDisabled,
1843
+ prefix: prefix ? true : false,
1844
+ invalid: hasError,
1845
+ }) })));
1752
1846
  }, SingleValue: props => {
1753
1847
  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 }) })));
1754
1848
  }, Menu: props => {
@@ -1788,18 +1882,16 @@ const useCustomComponents = (componentsProps, disabled, menuIsOpen, refMenuIsEna
1788
1882
  const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, styles, disabled) => {
1789
1883
  const customStyles = React__namespace.useMemo(() => {
1790
1884
  return Object.assign({ control: base => {
1791
- return Object.assign(Object.assign({}, base), { border: "0", boxShadow: "0", "&:hover": {
1792
- border: "0",
1793
- }, backgroundColor: "" });
1885
+ return Object.assign(Object.assign({}, base), { borderRadius: "var(--border-radius-lg)", backgroundColor: "" });
1794
1886
  }, 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: () => ({
1795
1887
  width: "0px",
1796
1888
  }), menu: base => {
1797
1889
  return Object.assign(Object.assign({}, base), { width: "100%", marginTop: "4px", marginBottom: "18px", transition: "all 1s ease-in-out" });
1798
- }, input: base => (Object.assign(Object.assign({}, base), { marginLeft: "0px" })), placeholder: base => (Object.assign({}, base)), option: () => ({}), menuPortal: base => (Object.assign(Object.assign({}, base), { width: refContainer.current ? `${refContainer.current.clientWidth}px` : base.width, transform: 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 => {
1890
+ }, input: base => (Object.assign(Object.assign({}, base), { marginLeft: "0px" })), placeholder: base => (Object.assign({}, base)), option: () => ({}), menuPortal: base => (Object.assign(Object.assign({}, base), { width: refContainer.current ? `${refContainer.current.clientWidth}px` : base.width, transform: "translate(0px, 0px)", 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 => {
1799
1891
  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" });
1800
1892
  }, valueContainer: base => {
1801
1893
  return Object.assign(Object.assign({}, base), { flexWrap: maxSelectedDisplayCount !== undefined ? "wrap" : "nowrap", gap: "0.25rem" });
1802
- }, container: base => (Object.assign(Object.assign({}, base), { border: "none", width: "100%" })), dropdownIndicator: base => (Object.assign(Object.assign({}, base), { padding: "0px" })), clearIndicator: base => {
1894
+ }, container: base => (Object.assign(Object.assign({}, base), { width: "100%" })), dropdownIndicator: base => (Object.assign(Object.assign({}, base), { padding: "0px" })), clearIndicator: base => {
1803
1895
  return Object.assign(Object.assign({}, base), { padding: "0px" });
1804
1896
  } }, styles);
1805
1897
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1821,7 +1913,7 @@ const useSelect = (_a) => {
1821
1913
  const { customStyles } = useCustomStyles(refContainer, refPrefix, maxSelectedDisplayCount, styles, disabled);
1822
1914
  const [menuIsOpen, setMenuIsOpen] = React__default["default"].useState((_b = props.menuIsOpen) !== null && _b !== void 0 ? _b : false);
1823
1915
  const refMenuIsEnabled = React__default["default"].useRef(true);
1824
- const customComponents = useCustomComponents(components, disabled || false, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon);
1916
+ const customComponents = useCustomComponents(components, disabled || false, menuIsOpen, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon, prefix, hasError);
1825
1917
  const menuPlacement = "auto";
1826
1918
  const openMenuHandler = () => __awaiter(void 0, void 0, void 0, function* () {
1827
1919
  onMenuOpen && onMenuOpen();
@@ -1894,6 +1986,8 @@ const CreatableSelect = (props) => {
1894
1986
  onInputChange,
1895
1987
  allowCreateWhileLoading,
1896
1988
  onCreateOption,
1989
+ isDisabled: disabled || props.isDisabled,
1990
+ readOnly,
1897
1991
  };
1898
1992
  const renderAsDisabled = rest.disabled || rest.readOnly || rest.isDisabled; // TODO remove one of the disable props from the type
1899
1993
  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` : null, 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 })))] }));
@@ -1937,6 +2031,8 @@ const Select = (props) => {
1937
2031
  onMenuScrollToBottom,
1938
2032
  onInputChange,
1939
2033
  hideSelectedOptions,
2034
+ isDisabled: disabled || props.isDisabled,
2035
+ readOnly,
1940
2036
  };
1941
2037
  const renderAsDisabled = rest.disabled || rest.readOnly || rest.isDisabled; // TODO remove one of the disable props from the type
1942
2038
  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` : null, ref: refPrefix, children: prefix })), async ? (jsxRuntime.jsx(ReactAsyncSelect__default["default"], Object.assign({}, rest, selectProps, async, { menuPosition: menuPosition, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : placeholder }))) : (jsxRuntime.jsx(ReactSelect__default["default"], Object.assign({}, rest, selectProps, { isMulti: isMulti, menuPosition: menuPosition, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : placeholder })))] }));
@@ -2037,7 +2133,6 @@ const cvaTextArea = cssClassVarianceUtilities.cvaMerge([
2037
2133
  "text-base",
2038
2134
  "text-slate-900",
2039
2135
  "placeholder-slate-400",
2040
- "focus-visible:outline-none",
2041
2136
  "w-full",
2042
2137
  "h-20",
2043
2138
  "transition",
@@ -2116,7 +2211,7 @@ const TextField = React__namespace.forwardRef((_a, ref) => {
2116
2211
  }
2117
2212
  }, [onChange]);
2118
2213
  return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon ||
2119
- (typeof maxLength === "number" && 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 })) }));
2214
+ (typeof maxLength === "number" && 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 })) }));
2120
2215
  });
2121
2216
  TextField.displayName = "TextField";
2122
2217
 
@@ -2135,16 +2230,7 @@ const TimeRangeField = (_a) => {
2135
2230
 
2136
2231
  const cvaToggleWrapper = cssClassVarianceUtilities.cvaMerge(["flex", "gap-2", "items-center"]);
2137
2232
  cssClassVarianceUtilities.cvaMerge(["relative"]);
2138
- const cvaToggleTrack = cssClassVarianceUtilities.cvaMerge([
2139
- "shrink-0",
2140
- "p-1",
2141
- "cursor-pointer",
2142
- "rounded-full",
2143
- "bg-slate-300",
2144
- "focus:bg-slate-400",
2145
- "hover:bg-slate-400",
2146
- "active:bg-slate-500",
2147
- ], {
2233
+ const cvaToggleTrack = cssClassVarianceUtilities.cvaMerge(["shrink-0", "p-1", "cursor-pointer", "rounded-full", "bg-slate-300", "hover:bg-slate-400", "active:bg-slate-500"], {
2148
2234
  variants: {
2149
2235
  size: {
2150
2236
  small: ["w-8", "h-4"],
@@ -2155,7 +2241,7 @@ const cvaToggleTrack = cssClassVarianceUtilities.cvaMerge([
2155
2241
  false: "",
2156
2242
  },
2157
2243
  toggled: {
2158
- true: ["bg-primary-600", "focus:bg-primary-700", "hover:bg-primary-700", "active:bg-primary-800"],
2244
+ true: ["bg-primary-600", "hover:bg-primary-700", "active:bg-primary-800"],
2159
2245
  false: "",
2160
2246
  },
2161
2247
  },
@@ -2276,7 +2362,7 @@ const UrlInput = React.forwardRef((_a, ref) => {
2276
2362
  var { dataTestId, isInvalid, disabled = false, fieldSize = "medium", disableAction = false, value, defaultValue } = _a, rest = __rest(_a, ["dataTestId", "isInvalid", "disabled", "fieldSize", "disableAction", "value", "defaultValue"]);
2277
2363
  const [url, setUrl] = React.useState((value === null || value === void 0 ? void 0 : value.toString()) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString()));
2278
2364
  const renderAsInvalid = (url && typeof url === "string" && !validateUrlAddress(url)) || isInvalid;
2279
- return (jsxRuntime.jsx(BaseInput, Object.assign({ dataTestId: dataTestId ? `${dataTestId}-url-input` : undefined, 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 })) })));
2365
+ return (jsxRuntime.jsx(BaseInput, Object.assign({ dataTestId: dataTestId ? `${dataTestId}-url-input` : undefined, 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 })) })));
2280
2366
  });
2281
2367
  UrlInput.displayName = "UrlField";
2282
2368
 
@@ -2293,7 +2379,7 @@ const UrlField = React.forwardRef((_a, ref) => {
2293
2379
  return typeof inputValue === "string";
2294
2380
  }
2295
2381
  const renderAsInvalid = !!errorMessage || (value && isString(value) && !validateUrlAddress(value)) || isInvalid;
2296
- return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, 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 })) }));
2382
+ return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, 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 })) }));
2297
2383
  });
2298
2384
  UrlField.displayName = "UrlField";
2299
2385
 
@@ -2453,6 +2539,7 @@ exports.countryCodeToFlagEmoji = countryCodeToFlagEmoji;
2453
2539
  exports.cvaActionButton = cvaActionButton;
2454
2540
  exports.cvaActionContainer = cvaActionContainer;
2455
2541
  exports.cvaInput = cvaInput;
2542
+ exports.cvaInputAction = cvaInputAction;
2456
2543
  exports.cvaInputAddon = cvaInputAddon;
2457
2544
  exports.cvaInputAddonAfter = cvaInputAddonAfter;
2458
2545
  exports.cvaInputAddonBefore = cvaInputAddonBefore;
@@ -2463,6 +2550,7 @@ exports.cvaInputField = cvaInputField;
2463
2550
  exports.cvaInputPrefix = cvaInputPrefix;
2464
2551
  exports.cvaInputSuffix = cvaInputSuffix;
2465
2552
  exports.cvaSelect = cvaSelect;
2553
+ exports.cvaSelectControl = cvaSelectControl;
2466
2554
  exports.cvaSelectCounter = cvaSelectCounter;
2467
2555
  exports.cvaSelectDynamicTagContainer = cvaSelectDynamicTagContainer;
2468
2556
  exports.cvaSelectIcon = cvaSelectIcon;