@livechat/design-system-react-components 1.0.0-alpha.18 → 1.0.0-alpha.20

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/dist/dsrc.es.js CHANGED
@@ -35,11 +35,11 @@ var __publicField = (obj, key, value) => {
35
35
  };
36
36
  import * as React from "react";
37
37
  import cx from "clsx";
38
- import { Close, Info as Info$1, Warning, CheckCircleSolid, Block, Check, ChevronUp, ChevronDown, Error as Error2, Search, LockBlack } from "@livechat/design-system-icons/react/material";
38
+ import { Close, Info as Info$1, Warning, CheckCircleSolid, Block, Person, Check, ChevronUp, ChevronDown, Error as Error2, Search, LockBlack } from "@livechat/design-system-icons/react/material";
39
39
  import debounce from "lodash.debounce";
40
+ import { getContrast } from "polished";
40
41
  import * as ReactDOM from "react-dom";
41
42
  import { useFloating, offset, flip, autoUpdate, arrow } from "@floating-ui/react-dom";
42
- import { getContrast } from "polished";
43
43
  import escape from "lodash.escape";
44
44
  import { TransitionGroup, CSSTransition } from "react-transition-group";
45
45
  import { css } from "@emotion/css";
@@ -186,8 +186,13 @@ const SpacingToken = {
186
186
  Spacing20: "--spacing-20",
187
187
  Spacing24: "--spacing-24"
188
188
  };
189
+ const ShadowToken = {
190
+ Float: "--shadow-float",
191
+ PopOver: "--shadow-pop-over",
192
+ Modal: "--shadow-modal"
193
+ };
189
194
  const caps = "lc-Typography-module__caps___c3eNJ";
190
- var styles$x = {
195
+ var styles$y = {
191
196
  "heading-xl": "lc-Typography-module__heading-xl___nhr-6",
192
197
  "heading-lg": "lc-Typography-module__heading-lg___XYF7l",
193
198
  "heading-md": "lc-Typography-module__heading-md___wHOIs",
@@ -223,7 +228,7 @@ const Heading = (_a) => {
223
228
  "children",
224
229
  "className"
225
230
  ]);
226
- return React.createElement(as || SIZE_TO_ELEMENT_MAP[size], __spreadValues({ className: cx(styles$x[`heading-${size}`], className) }, props), children);
231
+ return React.createElement(as || SIZE_TO_ELEMENT_MAP[size], __spreadValues({ className: cx(styles$y[`heading-${size}`], className) }, props), children);
227
232
  };
228
233
  const Text = (_c) => {
229
234
  var _d = _c, {
@@ -248,15 +253,15 @@ const Text = (_c) => {
248
253
  const baseClassPrefix = caps2 ? "caps" : `paragraph-${size}`;
249
254
  return React.createElement(as, __spreadValues({
250
255
  className: cx({
251
- [styles$x[`${baseClassPrefix}`]]: true,
252
- [styles$x[`${baseClassPrefix}--bold`]]: bold,
253
- [styles$x[`${baseClassPrefix}--strike`]]: strike,
254
- [styles$x[`${baseClassPrefix}--underline`]]: underline
256
+ [styles$y[`${baseClassPrefix}`]]: true,
257
+ [styles$y[`${baseClassPrefix}--bold`]]: bold,
258
+ [styles$y[`${baseClassPrefix}--strike`]]: strike,
259
+ [styles$y[`${baseClassPrefix}--underline`]]: underline
255
260
  }, className)
256
261
  }, props), children);
257
262
  };
258
263
  const icon$1 = "lc-Icon-module__icon___tw31R";
259
- var styles$w = {
264
+ var styles$x = {
260
265
  icon: icon$1,
261
266
  "icon--primary": "lc-Icon-module__icon--primary___JJnBV",
262
267
  "icon--subtle": "lc-Icon-module__icon--subtle___sZIzL",
@@ -297,7 +302,7 @@ const IconSizeMap = {
297
302
  height: 32
298
303
  }
299
304
  };
300
- const baseClass$D = "icon";
305
+ const baseClass$E = "icon";
301
306
  const Icon = (props) => {
302
307
  const _a = props, {
303
308
  source,
@@ -317,7 +322,7 @@ const Icon = (props) => {
317
322
  const GeneratedIcon = React.createElement(source, __spreadProps(__spreadValues({}, IconSizeMap[size]), {
318
323
  color: customColor
319
324
  }));
320
- const mergedClassNames = cx(className, styles$w[baseClass$D], kind && styles$w[`${baseClass$D}--${disabled ? "disabled--" : ""}${kind}`]);
325
+ const mergedClassNames = cx(className, styles$x[baseClass$E], kind && styles$x[`${baseClass$E}--${disabled ? "disabled--" : ""}${kind}`]);
321
326
  return /* @__PURE__ */ React.createElement("span", __spreadProps(__spreadValues({}, restProps), {
322
327
  className: mergedClassNames
323
328
  }), GeneratedIcon);
@@ -325,7 +330,7 @@ const Icon = (props) => {
325
330
  const alert = "lc-Alert-module__alert___HBTns";
326
331
  const alert__content = "lc-Alert-module__alert__content___9nZdf";
327
332
  const alert__icon = "lc-Alert-module__alert__icon___8TaAH";
328
- var styles$v = {
333
+ var styles$w = {
329
334
  alert,
330
335
  alert__content,
331
336
  "alert__content-text": "lc-Alert-module__alert__content-text___x2Un5",
@@ -339,7 +344,7 @@ var styles$v = {
339
344
  "alert--error": "lc-Alert-module__alert--error___DKPo0",
340
345
  alert__icon
341
346
  };
342
- const IconConfig$1 = {
347
+ const IconConfig = {
343
348
  info: {
344
349
  source: Info$1,
345
350
  kind: "link"
@@ -357,7 +362,7 @@ const IconConfig$1 = {
357
362
  kind: "error"
358
363
  }
359
364
  };
360
- const baseClass$C = "alert";
365
+ const baseClass$D = "alert";
361
366
  const Alert = ({
362
367
  children,
363
368
  className,
@@ -366,7 +371,7 @@ const Alert = ({
366
371
  }) => {
367
372
  const containerRef = React.useRef(null);
368
373
  const [isSmallContainer, setIsSmallContainer] = React.useState(false);
369
- const mergedClassNames = cx(styles$v[baseClass$C], styles$v[`${baseClass$C}--${kind}`], isSmallContainer && styles$v[`${baseClass$C}--small`], className);
374
+ const mergedClassNames = cx(styles$w[baseClass$D], styles$w[`${baseClass$D}--${kind}`], isSmallContainer && styles$w[`${baseClass$D}--small`], className);
370
375
  React.useEffect(() => {
371
376
  const handleResize = debounce(() => {
372
377
  if (containerRef.current && containerRef.current.offsetWidth <= 400) {
@@ -381,15 +386,16 @@ const Alert = ({
381
386
  ref: containerRef,
382
387
  className: mergedClassNames
383
388
  }, /* @__PURE__ */ React.createElement("div", {
384
- className: styles$v[`${baseClass$C}__content`]
385
- }, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, IconConfig$1[kind]), {
386
- className: styles$v[`${baseClass$C}__content-icon`]
389
+ className: styles$w[`${baseClass$D}__content`]
390
+ }, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, IconConfig[kind]), {
391
+ size: "large",
392
+ className: styles$w[`${baseClass$D}__content-icon`]
387
393
  })), /* @__PURE__ */ React.createElement(Text, {
388
394
  as: "div",
389
- className: cx(styles$v[`${baseClass$C}__content-text`], onClose && styles$v[`${baseClass$C}__content-text--margin`])
395
+ className: cx(styles$w[`${baseClass$D}__content-text`], onClose && styles$w[`${baseClass$D}__content-text--margin`])
390
396
  }, children)), onClose && /* @__PURE__ */ React.createElement("button", {
391
397
  type: "button",
392
- className: styles$v[`${baseClass$C}__close-icon`],
398
+ className: styles$w[`${baseClass$D}__close-icon`],
393
399
  onClick: onClose
394
400
  }, /* @__PURE__ */ React.createElement(Icon, {
395
401
  source: Close,
@@ -397,6 +403,122 @@ const Alert = ({
397
403
  kind: "primary"
398
404
  })));
399
405
  };
406
+ function getInitials(name = "", count = 2) {
407
+ return name.split(" ").map((el) => el.charAt(0)).join("").substring(0, count).toUpperCase();
408
+ }
409
+ function getFontColor(color) {
410
+ return getContrast(color, "#FFFFFF") > 4.5 ? "var(--color-white)" : "var(--color-black)";
411
+ }
412
+ const avatar = "lc-Avatar-module__avatar___1zTCE";
413
+ const avatar__status = "lc-Avatar-module__avatar__status___nX2Ls";
414
+ const avatar__rim = "lc-Avatar-module__avatar__rim___RCQ8Q";
415
+ const avatar__image = "lc-Avatar-module__avatar__image___YqfqE";
416
+ var styles$v = {
417
+ avatar,
418
+ avatar__status,
419
+ "avatar__status--available": "lc-Avatar-module__avatar__status--available___tcpFg",
420
+ "avatar__status--unavailable": "lc-Avatar-module__avatar__status--unavailable___ciauF",
421
+ "avatar__status--unknown": "lc-Avatar-module__avatar__status--unknown___MBaGB",
422
+ "avatar__status--xxxsmall": "lc-Avatar-module__avatar__status--xxxsmall___8pkEO",
423
+ "avatar__status--circle": "lc-Avatar-module__avatar__status--circle___doV5H",
424
+ "avatar__status--xxsmall": "lc-Avatar-module__avatar__status--xxsmall___M69lx",
425
+ "avatar__status--xsmall": "lc-Avatar-module__avatar__status--xsmall___RKQiI",
426
+ "avatar__status--small": "lc-Avatar-module__avatar__status--small___cVrA7",
427
+ "avatar__status--medium": "lc-Avatar-module__avatar__status--medium___n5z1H",
428
+ "avatar__status--large": "lc-Avatar-module__avatar__status--large___Lt-0p",
429
+ "avatar__status--xlarge": "lc-Avatar-module__avatar__status--xlarge___RWIcJ",
430
+ "avatar__status--xxlarge": "lc-Avatar-module__avatar__status--xxlarge___crG9D",
431
+ "avatar__status--rounded-square": "lc-Avatar-module__avatar__status--rounded-square___-My1P",
432
+ avatar__rim,
433
+ "avatar__rim--xxxsmall": "lc-Avatar-module__avatar__rim--xxxsmall___0CH9D",
434
+ "avatar__rim--xxsmall": "lc-Avatar-module__avatar__rim--xxsmall___Mde0K",
435
+ "avatar__rim--xsmall": "lc-Avatar-module__avatar__rim--xsmall___LAN-b",
436
+ "avatar__rim--small": "lc-Avatar-module__avatar__rim--small___FT8LX",
437
+ "avatar__rim--medium": "lc-Avatar-module__avatar__rim--medium___Dy0pr",
438
+ "avatar__rim--large": "lc-Avatar-module__avatar__rim--large___FPvGp",
439
+ "avatar__rim--xlarge": "lc-Avatar-module__avatar__rim--xlarge___CY0kN",
440
+ "avatar__rim--xxlarge": "lc-Avatar-module__avatar__rim--xxlarge___tE053",
441
+ avatar__image,
442
+ "avatar__icon--xxxsmall": "lc-Avatar-module__avatar__icon--xxxsmall___KaoMa",
443
+ "avatar__icon--xxsmall": "lc-Avatar-module__avatar__icon--xxsmall___NJJNV",
444
+ "avatar__icon--xsmall": "lc-Avatar-module__avatar__icon--xsmall___yHEZK",
445
+ "avatar__icon--small": "lc-Avatar-module__avatar__icon--small___l6lBu",
446
+ "avatar__icon--medium": "lc-Avatar-module__avatar__icon--medium___LF4w2",
447
+ "avatar__icon--large": "lc-Avatar-module__avatar__icon--large___QntBf",
448
+ "avatar__icon--xlarge": "lc-Avatar-module__avatar__icon--xlarge___bcHbI",
449
+ "avatar__icon--xxlarge": "lc-Avatar-module__avatar__icon--xxlarge___sx8Fq",
450
+ "avatar--circle": "lc-Avatar-module__avatar--circle___XwEz-",
451
+ "avatar--rounded-square": "lc-Avatar-module__avatar--rounded-square___m7-4I",
452
+ "avatar--with-rim": "lc-Avatar-module__avatar--with-rim___pvFZR",
453
+ "avatar--xxxsmall": "lc-Avatar-module__avatar--xxxsmall___EHzpP",
454
+ "avatar--xxsmall": "lc-Avatar-module__avatar--xxsmall___EDOVp",
455
+ "avatar--xsmall": "lc-Avatar-module__avatar--xsmall___nI348",
456
+ "avatar--small": "lc-Avatar-module__avatar--small___UuQen",
457
+ "avatar--medium": "lc-Avatar-module__avatar--medium___Bt9Eo",
458
+ "avatar--large": "lc-Avatar-module__avatar--large___OU-08",
459
+ "avatar--xlarge": "lc-Avatar-module__avatar--xlarge___zwgeW",
460
+ "avatar--xxlarge": "lc-Avatar-module__avatar--xxlarge___Ur0ul"
461
+ };
462
+ const baseClass$C = "avatar";
463
+ const defaultBackgroundColor = "var(--surface-basic-disabled)";
464
+ const defaultFontColor = "var(--content-subtle)";
465
+ const Avatar = ({
466
+ alt,
467
+ className,
468
+ color,
469
+ shape = "circle",
470
+ size = "medium",
471
+ src,
472
+ status,
473
+ text,
474
+ type,
475
+ withRim = false
476
+ }) => {
477
+ const isImproperImageSetup = type === "image" && !src;
478
+ const [shouldDisplayFallbackAvatar, setShouldDisplayFallbackAvatar] = React.useState(isImproperImageSetup);
479
+ const shouldDisplayImage = type === "image" && !!src && !shouldDisplayFallbackAvatar;
480
+ const shouldDisplayInitials = type === "text";
481
+ const letterCount = ["xxxsmall", "xxsmall", "xsmall"].includes(size) ? 1 : 2;
482
+ const initials = getInitials(text, letterCount);
483
+ const backgroundColor = color || defaultBackgroundColor;
484
+ const fontColor = color ? getFontColor(color) : defaultFontColor;
485
+ const mergedClassNames = cx({
486
+ [styles$v[baseClass$C]]: true,
487
+ [styles$v[`${baseClass$C}--${shape}`]]: true,
488
+ [styles$v[`${baseClass$C}--${size}`]]: true,
489
+ [styles$v[`${baseClass$C}--with-rim`]]: withRim,
490
+ [`${className}`]: className
491
+ });
492
+ const mergedStatusClassNames = cx(styles$v[`${baseClass$C}__status`], styles$v[`${baseClass$C}__status--${shape}`], styles$v[`${baseClass$C}__status--${size}`], styles$v[`${baseClass$C}__status--${status}`]);
493
+ const mergedIconClassNames = cx(styles$v[`${baseClass$C}__icon`], styles$v[`${baseClass$C}__icon--${size}`]);
494
+ const mergedRimClassNames = cx(styles$v[`${baseClass$C}__rim`], styles$v[`${baseClass$C}__rim--${size}`]);
495
+ const handleError = React.useCallback(() => setShouldDisplayFallbackAvatar(true), []);
496
+ React.useEffect(() => {
497
+ setShouldDisplayFallbackAvatar(isImproperImageSetup);
498
+ }, [isImproperImageSetup]);
499
+ return /* @__PURE__ */ React.createElement("div", {
500
+ className: mergedClassNames,
501
+ style: { backgroundColor }
502
+ }, withRim && /* @__PURE__ */ React.createElement("div", {
503
+ "data-testid": `${baseClass$C}__rim`,
504
+ className: mergedRimClassNames
505
+ }), status && /* @__PURE__ */ React.createElement("div", {
506
+ "data-testid": `${baseClass$C}__status`,
507
+ className: mergedStatusClassNames
508
+ }), shouldDisplayImage && /* @__PURE__ */ React.createElement("img", {
509
+ className: styles$v[`${baseClass$C}__image`],
510
+ src,
511
+ alt,
512
+ onError: handleError
513
+ }), shouldDisplayInitials && /* @__PURE__ */ React.createElement("span", {
514
+ style: { color: fontColor }
515
+ }, initials), shouldDisplayFallbackAvatar && /* @__PURE__ */ React.createElement(Icon, {
516
+ "data-testid": `${baseClass$C}__icon`,
517
+ className: mergedIconClassNames,
518
+ source: Person,
519
+ kind: "primary"
520
+ }));
521
+ };
400
522
  const badge = "lc-Badge-module__badge___GhLnu";
401
523
  const badge__dot = "lc-Badge-module__badge__dot___z6RO6";
402
524
  var styles$u = {
@@ -409,25 +531,37 @@ var styles$u = {
409
531
  "badge--secondary": "lc-Badge-module__badge--secondary___JjNIJ",
410
532
  "badge--tertiary": "lc-Badge-module__badge--tertiary___e83wV"
411
533
  };
534
+ function formatCount(count, max) {
535
+ return count > max ? `${max}+` : `${count}`;
536
+ }
412
537
  const baseClass$B = "badge";
413
- const Badge = ({
414
- children,
415
- className,
416
- kind = "primary",
417
- size = "medium",
418
- type = "content"
419
- }) => {
538
+ const Badge = (_e) => {
539
+ var _f = _e, {
540
+ className,
541
+ count = 0,
542
+ max = 99,
543
+ kind = "primary",
544
+ size = "medium",
545
+ type = "counter"
546
+ } = _f, spanProps = __objRest(_f, [
547
+ "className",
548
+ "count",
549
+ "max",
550
+ "kind",
551
+ "size",
552
+ "type"
553
+ ]);
420
554
  const mergedClassNames = cx(className, styles$u[baseClass$B], styles$u[`${baseClass$B}--${kind}`], styles$u[`${baseClass$B}--${size}`]);
421
555
  const content = {
422
- ["content"]: children,
556
+ ["counter"]: formatCount(count, max),
423
557
  ["alert"]: "!",
424
558
  ["dot"]: /* @__PURE__ */ React.createElement("span", {
425
559
  className: styles$u[`${baseClass$B}__dot`]
426
560
  })
427
561
  }[type];
428
- return /* @__PURE__ */ React.createElement("span", {
562
+ return /* @__PURE__ */ React.createElement("span", __spreadValues({
429
563
  className: mergedClassNames
430
- }, content);
564
+ }, spanProps), content);
431
565
  };
432
566
  const loader = "lc-Loader-module__loader___LRflD";
433
567
  const loader__spinner = "lc-Loader-module__loader__spinner___l3C1g";
@@ -494,8 +628,8 @@ var styles$s = {
494
628
  btn__icon
495
629
  };
496
630
  const baseClass$z = "btn";
497
- const Button = (_e) => {
498
- var _f = _e, {
631
+ const Button = (_g) => {
632
+ var _h = _g, {
499
633
  loading = false,
500
634
  disabled = false,
501
635
  type = "button",
@@ -508,7 +642,7 @@ const Button = (_e) => {
508
642
  className,
509
643
  children,
510
644
  href
511
- } = _f, props = __objRest(_f, [
645
+ } = _h, props = __objRest(_h, [
512
646
  "loading",
513
647
  "disabled",
514
648
  "type",
@@ -558,8 +692,8 @@ var styles$r = {
558
692
  function noop() {
559
693
  }
560
694
  const baseClass$y = "btn-group";
561
- const ButtonGroup = (_g) => {
562
- var _h = _g, {
695
+ const ButtonGroup = (_i) => {
696
+ var _j = _i, {
563
697
  size = "medium",
564
698
  fullWidth = false,
565
699
  onIndexChange = noop,
@@ -567,7 +701,7 @@ const ButtonGroup = (_g) => {
567
701
  children,
568
702
  currentIndex,
569
703
  initialIndex = -1
570
- } = _h, restProps = __objRest(_h, [
704
+ } = _j, restProps = __objRest(_j, [
571
705
  "size",
572
706
  "fullWidth",
573
707
  "onIndexChange",
@@ -613,13 +747,13 @@ var styles$q = {
613
747
  card__text,
614
748
  card__img
615
749
  };
616
- const Card = (_i) => {
617
- var _j = _i, {
750
+ const Card = (_k) => {
751
+ var _l = _k, {
618
752
  img,
619
753
  title,
620
754
  children,
621
755
  className
622
- } = _j, restProps = __objRest(_j, [
756
+ } = _l, restProps = __objRest(_l, [
623
757
  "img",
624
758
  "title",
625
759
  "children",
@@ -644,11 +778,11 @@ var styles$p = {
644
778
  "field-description": "lc-FieldDescription-module__field-description___IcRDH"
645
779
  };
646
780
  const baseClass$x = "field-description";
647
- const FieldDescription = (_k) => {
648
- var _l = _k, {
781
+ const FieldDescription = (_m) => {
782
+ var _n = _m, {
649
783
  children,
650
784
  className = ""
651
- } = _l, props = __objRest(_l, [
785
+ } = _n, props = __objRest(_n, [
652
786
  "children",
653
787
  "className"
654
788
  ]);
@@ -679,8 +813,8 @@ var styles$o = {
679
813
  checkbox__helper
680
814
  };
681
815
  const baseClass$w = "checkbox";
682
- const Checkbox = React.forwardRef((_m, ref) => {
683
- var _n = _m, { checked, disabled, children, description, className } = _n, restInputProps = __objRest(_n, ["checked", "disabled", "children", "description", "className"]);
816
+ const Checkbox = React.forwardRef((_o, ref) => {
817
+ var _p = _o, { checked, disabled, children, description, className } = _p, restInputProps = __objRest(_p, ["checked", "disabled", "children", "description", "className"]);
684
818
  return /* @__PURE__ */ React.createElement("div", {
685
819
  className: cx(styles$o[baseClass$w], className, {
686
820
  [styles$o[`${baseClass$w}--selected`]]: checked,
@@ -713,11 +847,11 @@ var styles$n = {
713
847
  "field-error": "lc-FieldError-module__field-error___IDkPT"
714
848
  };
715
849
  const baseClass$v = "field-error";
716
- const FieldError = (_o) => {
717
- var _p = _o, {
850
+ const FieldError = (_q) => {
851
+ var _r = _q, {
718
852
  children,
719
853
  className = ""
720
- } = _p, props = __objRest(_p, [
854
+ } = _r, props = __objRest(_r, [
721
855
  "children",
722
856
  "className"
723
857
  ]);
@@ -735,15 +869,15 @@ var styles$m = {
735
869
  "field-group--stretched": "lc-FieldGroup-module__field-group--stretched___6rkuO"
736
870
  };
737
871
  const baseClass$u = "field-group";
738
- const FieldGroup = (_q) => {
739
- var _r = _q, {
872
+ const FieldGroup = (_s) => {
873
+ var _t = _s, {
740
874
  className = "",
741
875
  children,
742
876
  description,
743
877
  error,
744
878
  inline,
745
879
  stretch
746
- } = _r, props = __objRest(_r, [
880
+ } = _t, props = __objRest(_t, [
747
881
  "className",
748
882
  "children",
749
883
  "description",
@@ -772,14 +906,14 @@ var styles$l = {
772
906
  form__helper
773
907
  };
774
908
  const baseClass$t = "form";
775
- const Form = (_s) => {
776
- var _t = _s, {
909
+ const Form = (_u) => {
910
+ var _v = _u, {
777
911
  className,
778
912
  children,
779
913
  labelText,
780
914
  helperText,
781
915
  formFooter
782
- } = _t, restProps = __objRest(_t, [
916
+ } = _v, restProps = __objRest(_v, [
783
917
  "className",
784
918
  "children",
785
919
  "labelText",
@@ -864,13 +998,13 @@ var styles$j = {
864
998
  "form-group__helper": "lc-FormGroup-module__form-group__helper___SRuxe"
865
999
  };
866
1000
  const baseClass$r = "form-group";
867
- const FormGroup = (_u) => {
868
- var _v = _u, {
1001
+ const FormGroup = (_w) => {
1002
+ var _x = _w, {
869
1003
  className = "",
870
1004
  children,
871
1005
  labelText,
872
1006
  helperText
873
- } = _v, props = __objRest(_v, [
1007
+ } = _x, props = __objRest(_x, [
874
1008
  "className",
875
1009
  "children",
876
1010
  "labelText",
@@ -903,8 +1037,8 @@ var styles$i = {
903
1037
  "input--large": "lc-Input-module__input--large___jX5RW"
904
1038
  };
905
1039
  const baseClass$q = "input";
906
- const Input = React.forwardRef((_w, ref) => {
907
- var _x = _w, { size = "medium", error = false, className } = _x, inputProps = __objRest(_x, ["size", "error", "className"]);
1040
+ const Input = React.forwardRef((_y, ref) => {
1041
+ var _z = _y, { size = "medium", error = false, className } = _z, inputProps = __objRest(_z, ["size", "error", "className"]);
908
1042
  return /* @__PURE__ */ React.createElement("input", __spreadValues({
909
1043
  className: cx(className, styles$i[baseClass$q], styles$i[`${baseClass$q}--${size}`], {
910
1044
  [styles$i[`${baseClass$q}--error`]]: error
@@ -919,11 +1053,11 @@ var styles$h = {
919
1053
  "link--bold": "lc-Link-module__link--bold___1rGdO"
920
1054
  };
921
1055
  const baseClass$p = "link";
922
- const Link = (_y) => {
923
- var _z = _y, {
1056
+ const Link = (_A) => {
1057
+ var _B = _A, {
924
1058
  bold = false,
925
1059
  className = ""
926
- } = _z, rest = __objRest(_z, [
1060
+ } = _B, rest = __objRest(_B, [
927
1061
  "bold",
928
1062
  "className"
929
1063
  ]);
@@ -974,13 +1108,13 @@ const KeyCodes = {
974
1108
  arrowDown: "ArrowDown"
975
1109
  };
976
1110
  const baseClass$o = "modal-base";
977
- const ModalBase = (_A) => {
978
- var _B = _A, {
1111
+ const ModalBase = (_C) => {
1112
+ var _D = _C, {
979
1113
  children,
980
1114
  className = "",
981
1115
  onClose,
982
1116
  closeOnEscPress = true
983
- } = _B, props = __objRest(_B, [
1117
+ } = _D, props = __objRest(_D, [
984
1118
  "children",
985
1119
  "className",
986
1120
  "onClose",
@@ -1020,14 +1154,14 @@ const ModalBase = (_A) => {
1020
1154
  }), children));
1021
1155
  };
1022
1156
  const baseClass$n = "action-modal";
1023
- const ActionModal = (_C) => {
1024
- var _D = _C, {
1157
+ const ActionModal = (_E) => {
1158
+ var _F = _E, {
1025
1159
  children,
1026
1160
  className = "",
1027
1161
  icon: icon2,
1028
1162
  heading,
1029
1163
  actions
1030
- } = _D, props = __objRest(_D, [
1164
+ } = _F, props = __objRest(_F, [
1031
1165
  "children",
1032
1166
  "className",
1033
1167
  "icon",
@@ -1048,13 +1182,13 @@ const ActionModal = (_C) => {
1048
1182
  }, actions));
1049
1183
  };
1050
1184
  const baseClass$m = "modal";
1051
- const Modal = (_E) => {
1052
- var _F = _E, {
1185
+ const Modal = (_G) => {
1186
+ var _H = _G, {
1053
1187
  children,
1054
1188
  className = "",
1055
1189
  heading,
1056
1190
  footer
1057
- } = _F, props = __objRest(_F, [
1191
+ } = _H, props = __objRest(_H, [
1058
1192
  "children",
1059
1193
  "className",
1060
1194
  "heading",
@@ -1107,8 +1241,8 @@ var styles$f = {
1107
1241
  "numeric-input--error": "lc-NumericInput-module__numeric-input--error___TMxRx"
1108
1242
  };
1109
1243
  const baseClass$l = "numeric-input";
1110
- const NumericInput = (_G) => {
1111
- var _H = _G, {
1244
+ const NumericInput = (_I) => {
1245
+ var _J = _I, {
1112
1246
  className,
1113
1247
  error,
1114
1248
  value,
@@ -1118,7 +1252,7 @@ const NumericInput = (_G) => {
1118
1252
  noControls,
1119
1253
  style,
1120
1254
  onChange
1121
- } = _H, restProps = __objRest(_H, [
1255
+ } = _J, restProps = __objRest(_J, [
1122
1256
  "className",
1123
1257
  "error",
1124
1258
  "value",
@@ -1672,13 +1806,13 @@ const SIZE_VALUE_FROM_SIZE = {
1672
1806
  large: 56
1673
1807
  };
1674
1808
  const baseClass$h = "progress-circle";
1675
- const ProgressCircle = React.forwardRef((_I, ref) => {
1676
- var _J = _I, {
1809
+ const ProgressCircle = React.forwardRef((_K, ref) => {
1810
+ var _L = _K, {
1677
1811
  status = "normal",
1678
1812
  progressValue,
1679
1813
  className,
1680
1814
  size = "medium"
1681
- } = _J, restProps = __objRest(_J, [
1815
+ } = _L, restProps = __objRest(_L, [
1682
1816
  "status",
1683
1817
  "progressValue",
1684
1818
  "className",
@@ -1733,13 +1867,13 @@ var styles$a = {
1733
1867
  "progress-bar__indicator--normal": "lc-ProgressBar-module__progress-bar__indicator--normal___0Uhle"
1734
1868
  };
1735
1869
  const baseClass$g = "progress-bar";
1736
- const ProgressBar = React.forwardRef((_K, ref) => {
1737
- var _L = _K, {
1870
+ const ProgressBar = React.forwardRef((_M, ref) => {
1871
+ var _N = _M, {
1738
1872
  status = "normal",
1739
1873
  percent,
1740
1874
  size = "medium",
1741
1875
  className = ""
1742
- } = _L, restProps = __objRest(_L, [
1876
+ } = _N, restProps = __objRest(_N, [
1743
1877
  "status",
1744
1878
  "percent",
1745
1879
  "size",
@@ -1859,8 +1993,8 @@ var styles$8 = {
1859
1993
  "radio-button--disabled": "lc-RadioButton-module__radio-button--disabled___wHSA7"
1860
1994
  };
1861
1995
  const baseClass$e = "radio-button";
1862
- const RadioButton = React.forwardRef((_M, ref) => {
1863
- var _N = _M, { children, className = "", description, checked, disabled } = _N, props = __objRest(_N, ["children", "className", "description", "checked", "disabled"]);
1996
+ const RadioButton = React.forwardRef((_O, ref) => {
1997
+ var _P = _O, { children, className = "", description, checked, disabled } = _P, props = __objRest(_P, ["children", "className", "description", "checked", "disabled"]);
1864
1998
  const mergedClassNames = cx(styles$8[baseClass$e], className, {
1865
1999
  [styles$8[`${baseClass$e}--selected`]]: checked,
1866
2000
  [styles$8[`${baseClass$e}--disabled`]]: disabled
@@ -1987,38 +2121,48 @@ const switch__input = "lc-Switch-module__switch__input___NiiOR";
1987
2121
  const switch__container = "lc-Switch-module__switch__container___79F7W";
1988
2122
  const switch__track = "lc-Switch-module__switch__track___2wr2M";
1989
2123
  const switch__slider = "lc-Switch-module__switch__slider___WHd--";
2124
+ const switch__loader = "lc-Switch-module__switch__loader___FE-fA";
1990
2125
  var styles$6 = {
1991
2126
  "switch": "lc-Switch-module__switch___AaA2k",
1992
2127
  "switch__track--enabled": "lc-Switch-module__switch__track--enabled___sy4Xl",
1993
2128
  "switch__track--on": "lc-Switch-module__switch__track--on___aOMWe",
1994
2129
  "switch__track--off": "lc-Switch-module__switch__track--off___NAisj",
1995
- "switch--basic": "lc-Switch-module__switch--basic___jKO4n",
2130
+ "switch--large": "lc-Switch-module__switch--large___pSoJ7",
1996
2131
  "switch--compact": "lc-Switch-module__switch--compact___OGFIX",
2132
+ "switch--medium": "lc-Switch-module__switch--medium___EcZwT",
1997
2133
  switch__input,
1998
2134
  "switch__input--disabled": "lc-Switch-module__switch__input--disabled___Po8gh",
1999
2135
  switch__container,
2000
2136
  switch__track,
2001
2137
  "switch__track--disabled": "lc-Switch-module__switch__track--disabled___HkDhl",
2002
2138
  switch__slider,
2003
- "switch__slider--basic": "lc-Switch-module__switch__slider--basic___OMKTp",
2004
- "switch__slider--basic--on": "lc-Switch-module__switch__slider--basic--on___mn3f9",
2005
- "switch__slider--basic--off": "lc-Switch-module__switch__slider--basic--off___MRoBu",
2139
+ "switch__slider--large": "lc-Switch-module__switch__slider--large___WoEgi",
2140
+ "switch__slider--large--on": "lc-Switch-module__switch__slider--large--on___7Qp3G",
2141
+ "switch__slider--large--off": "lc-Switch-module__switch__slider--large--off___iRMmD",
2006
2142
  "switch__slider--compact": "lc-Switch-module__switch__slider--compact___uZ-lS",
2007
2143
  "switch__slider--compact--on": "lc-Switch-module__switch__slider--compact--on___FykE3",
2008
- "switch__slider--compact--off": "lc-Switch-module__switch__slider--compact--off___s5yR8"
2144
+ "switch__slider--compact--off": "lc-Switch-module__switch__slider--compact--off___s5yR8",
2145
+ "switch__slider--medium": "lc-Switch-module__switch__slider--medium___uhptz",
2146
+ "switch__slider--medium--on": "lc-Switch-module__switch__slider--medium--on___SfeAV",
2147
+ "switch__slider--medium--off": "lc-Switch-module__switch__slider--medium--off___eXJJz",
2148
+ switch__loader,
2149
+ "switch__loader--compact": "lc-Switch-module__switch__loader--compact___3imUh",
2150
+ "switch__loader--medium": "lc-Switch-module__switch__loader--medium___2zi05",
2151
+ "switch__loader--large": "lc-Switch-module__switch__loader--large___vLRFa"
2009
2152
  };
2010
2153
  const baseClass$c = "switch";
2011
- const Switch = (_O) => {
2012
- var _P = _O, {
2154
+ const Switch = (_Q) => {
2155
+ var _R = _Q, {
2013
2156
  className = "",
2014
2157
  defaultOn = false,
2015
2158
  disabled = false,
2016
2159
  name = baseClass$c,
2017
2160
  on,
2018
2161
  onChange = noop,
2019
- size = "basic",
2162
+ size = "large",
2163
+ state = "regular",
2020
2164
  innerRef
2021
- } = _P, props = __objRest(_P, [
2165
+ } = _R, props = __objRest(_R, [
2022
2166
  "className",
2023
2167
  "defaultOn",
2024
2168
  "disabled",
@@ -2026,6 +2170,7 @@ const Switch = (_O) => {
2026
2170
  "on",
2027
2171
  "onChange",
2028
2172
  "size",
2173
+ "state",
2029
2174
  "innerRef"
2030
2175
  ]);
2031
2176
  const [checked, setChecked] = React.useState(() => on !== void 0 ? on : defaultOn);
@@ -2034,9 +2179,12 @@ const Switch = (_O) => {
2034
2179
  setChecked(on);
2035
2180
  }
2036
2181
  }, [on]);
2037
- const iconSize = size === "basic" ? "small" : "xsmall";
2182
+ const isLoading = state === "loading";
2183
+ const isLocked = state === "locked";
2184
+ const iconSize = size === "large" ? "small" : "xsmall";
2038
2185
  const toggleStyles = checked ? "on" : "off";
2039
- const availabilityStyles = disabled ? "disabled" : "enabled";
2186
+ const shouldBehaveAsDisabled = disabled || isLoading || isLocked;
2187
+ const availabilityStyles = shouldBehaveAsDisabled ? "disabled" : "enabled";
2040
2188
  const mergedClassNames = cx(styles$6[baseClass$c], styles$6[`${baseClass$c}--${size}`], className);
2041
2189
  const handleChange = (e) => {
2042
2190
  const hasOnChangePassed = onChange !== noop;
@@ -2056,7 +2204,7 @@ const Switch = (_O) => {
2056
2204
  checked,
2057
2205
  name,
2058
2206
  ref: innerRef,
2059
- disabled,
2207
+ disabled: shouldBehaveAsDisabled,
2060
2208
  "test-id": "foo"
2061
2209
  }, props)), /* @__PURE__ */ React.createElement("span", {
2062
2210
  className: styles$6[`${baseClass$c}__container`]
@@ -2064,7 +2212,10 @@ const Switch = (_O) => {
2064
2212
  className: cx(styles$6[`${baseClass$c}__track`], styles$6[`${baseClass$c}__track--${toggleStyles}`], styles$6[`${baseClass$c}__track--${availabilityStyles}`])
2065
2213
  }), /* @__PURE__ */ React.createElement("span", {
2066
2214
  className: cx(styles$6[`${baseClass$c}__slider`], styles$6[`${baseClass$c}__slider--${size}`], styles$6[`${baseClass$c}__slider--${size}--${toggleStyles}`])
2067
- }, disabled && /* @__PURE__ */ React.createElement(Icon, {
2215
+ }, isLoading && /* @__PURE__ */ React.createElement(Loader, {
2216
+ className: cx(styles$6[`${baseClass$c}__loader`], styles$6[`${baseClass$c}__loader--${size}`])
2217
+ }), isLocked && /* @__PURE__ */ React.createElement(Icon, {
2218
+ "data-testid": "lock-icon",
2068
2219
  size: iconSize,
2069
2220
  source: LockBlack,
2070
2221
  kind: "primary"
@@ -2078,13 +2229,13 @@ var styles$5 = {
2078
2229
  "tab--selected": "lc-Tab-module__tab--selected___c0EkL"
2079
2230
  };
2080
2231
  const baseClass$b = "tab";
2081
- const Tab = (_Q) => {
2082
- var _R = _Q, {
2232
+ const Tab = (_S) => {
2233
+ var _T = _S, {
2083
2234
  children,
2084
2235
  className,
2085
2236
  description,
2086
2237
  isSelected
2087
- } = _R, restProps = __objRest(_R, [
2238
+ } = _T, restProps = __objRest(_T, [
2088
2239
  "children",
2089
2240
  "className",
2090
2241
  "description",
@@ -2154,8 +2305,8 @@ const getCustomTextClass = (customColor) => {
2154
2305
  }
2155
2306
  return getContrast(customColor, "#FFFFFF") > 4.5 ? "text-white" : "text-black";
2156
2307
  };
2157
- const Tag = (_S) => {
2158
- var _T = _S, {
2308
+ const Tag = (_U) => {
2309
+ var _V = _U, {
2159
2310
  className = "",
2160
2311
  children,
2161
2312
  dismissible = false,
@@ -2164,9 +2315,9 @@ const Tag = (_S) => {
2164
2315
  onRemove,
2165
2316
  outline = false,
2166
2317
  icon: icon2,
2167
- avatar,
2318
+ avatar: avatar2,
2168
2319
  customColor
2169
- } = _T, restProps = __objRest(_T, [
2320
+ } = _V, restProps = __objRest(_V, [
2170
2321
  "className",
2171
2322
  "children",
2172
2323
  "dismissible",
@@ -2181,7 +2332,7 @@ const Tag = (_S) => {
2181
2332
  const mergedClassNames = cx(styles$3[baseClass$9], className, styles$3[`${baseClass$9}--${size}`], styles$3[`${baseClass$9}--${kind}`], {
2182
2333
  [styles$3[`${baseClass$9}--dismissible`]]: dismissible,
2183
2334
  [styles$3[`${baseClass$9}--outline`]]: outline,
2184
- [styles$3[`${baseClass$9}--with-icon`]]: !!icon2 || !!avatar,
2335
+ [styles$3[`${baseClass$9}--with-icon`]]: !!icon2 || !!avatar2,
2185
2336
  [styles$3[`${baseClass$9}--${getCustomTextClass(customColor)}`]]: !!customColor
2186
2337
  });
2187
2338
  const getCustomColorStyles = () => {
@@ -2213,12 +2364,12 @@ const Tag = (_S) => {
2213
2364
  }, restProps), getCustomColorStyles()), {
2214
2365
  as: "div",
2215
2366
  size: "md"
2216
- }), avatar && /* @__PURE__ */ React.createElement("img", {
2367
+ }), avatar2 && /* @__PURE__ */ React.createElement("img", {
2217
2368
  className: styles$3[`${baseClass$9}__avatar`],
2218
- src: avatar,
2369
+ src: avatar2,
2219
2370
  alt: "tag-avatar",
2220
2371
  "data-testid": "lc-tag-avatar"
2221
- }), " ", icon2 && !avatar && /* @__PURE__ */ React.createElement(Icon, {
2372
+ }), " ", icon2 && !avatar2 && /* @__PURE__ */ React.createElement(Icon, {
2222
2373
  "data-testid": "lc-tag-icon",
2223
2374
  className: styles$3[`${baseClass$9}__icon`],
2224
2375
  source: icon2,
@@ -2436,18 +2587,13 @@ const EmailTagInput = ({
2436
2587
  };
2437
2588
  const toast = "lc-Toast-module__toast___j5Amn";
2438
2589
  const toast__content = "lc-Toast-module__toast__content___HjaNw";
2439
- const toast__icon = "lc-Toast-module__toast__icon___wLbLu";
2440
- const toast__close = "lc-Toast-module__toast__close___O18Lh";
2441
2590
  const toast__actions = "lc-Toast-module__toast__actions___JWu-1";
2442
2591
  var styles$1 = {
2443
2592
  toast,
2444
2593
  toast__content,
2445
- toast__icon,
2446
- toast__close,
2447
2594
  toast__actions,
2448
- "toast__actions-close": "lc-Toast-module__toast__actions-close___xN8YT",
2449
- "toast__actions-custom": "lc-Toast-module__toast__actions-custom___z1UUf",
2450
- "toast--notification": "lc-Toast-module__toast--notification___pDXnc",
2595
+ "toast__actions--close": "lc-Toast-module__toast__actions--close___QuXHY",
2596
+ "toast__actions--custom": "lc-Toast-module__toast__actions--custom___lm-pM",
2451
2597
  "toast--success": "lc-Toast-module__toast--success___7UC6m",
2452
2598
  "toast--warning": "lc-Toast-module__toast--warning___pteb7",
2453
2599
  "toast--error": "lc-Toast-module__toast--error___trg--",
@@ -2469,8 +2615,7 @@ var styles$1 = {
2469
2615
  "toast-exit--fade": "lc-Toast-module__toast-exit--fade___iDA1p",
2470
2616
  "toast-exit-active--fade": "lc-Toast-module__toast-exit-active--fade___tL7sb"
2471
2617
  };
2472
- const baseClass$6 = "toast";
2473
- const IconConfig = {
2618
+ const iconConfig = {
2474
2619
  success: {
2475
2620
  source: CheckCircleSolid,
2476
2621
  kind: "inverted"
@@ -2485,47 +2630,55 @@ const IconConfig = {
2485
2630
  info: {
2486
2631
  source: Info$1,
2487
2632
  kind: "inverted"
2488
- },
2489
- notification: {
2490
- source: Info$1,
2491
- kind: "link"
2492
2633
  }
2493
2634
  };
2494
- const Toast = ({
2495
- action,
2496
- className,
2497
- children,
2498
- removable,
2499
- kind = "info",
2500
- onClose
2501
- }) => {
2635
+ const baseClass$6 = "toast";
2636
+ const Toast = (_W) => {
2637
+ var _X = _W, {
2638
+ action,
2639
+ className,
2640
+ children,
2641
+ removable,
2642
+ kind = "info",
2643
+ onClose
2644
+ } = _X, divProps = __objRest(_X, [
2645
+ "action",
2646
+ "className",
2647
+ "children",
2648
+ "removable",
2649
+ "kind",
2650
+ "onClose"
2651
+ ]);
2502
2652
  const mergedClassNames = cx(styles$1[baseClass$6], styles$1[`${baseClass$6}--${kind}`], className);
2503
2653
  const onActionClick = (action2) => {
2504
- if (action2 && action2.closeOnClick && onClose) {
2505
- action2.handler();
2654
+ if (action2 && action2.closesOnClick && onClose) {
2655
+ action2.onClick();
2506
2656
  return onClose();
2507
2657
  }
2508
- return action2.handler();
2658
+ return action2.onClick();
2509
2659
  };
2510
- return /* @__PURE__ */ React.createElement("div", {
2660
+ return /* @__PURE__ */ React.createElement("div", __spreadValues({
2511
2661
  className: mergedClassNames
2512
- }, /* @__PURE__ */ React.createElement("div", {
2662
+ }, divProps), /* @__PURE__ */ React.createElement("div", {
2513
2663
  className: styles$1[`${baseClass$6}__icon`]
2514
- }, /* @__PURE__ */ React.createElement(Icon, __spreadValues({}, IconConfig[kind]))), /* @__PURE__ */ React.createElement("div", {
2664
+ }, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, iconConfig[kind]), {
2665
+ size: "medium"
2666
+ }))), /* @__PURE__ */ React.createElement("div", {
2515
2667
  className: styles$1[`${baseClass$6}__content`]
2516
2668
  }, children), (action || removable) && /* @__PURE__ */ React.createElement("div", {
2517
2669
  className: styles$1[`${baseClass$6}__actions`]
2518
- }, action && /* @__PURE__ */ React.createElement("button", {
2519
- className: styles$1[`${baseClass$6}__actions-custom`],
2670
+ }, action && /* @__PURE__ */ React.createElement(Button, {
2671
+ className: styles$1[`${baseClass$6}__actions--custom`],
2672
+ kind: "plain",
2520
2673
  onClick: () => onActionClick(action)
2521
2674
  }, action.label), removable && /* @__PURE__ */ React.createElement("div", {
2522
- className: styles$1[`${baseClass$6}__actions-close`],
2675
+ className: styles$1[`${baseClass$6}__actions--close`],
2523
2676
  "aria-label": "Close toast",
2524
2677
  onClick: onClose
2525
2678
  }, /* @__PURE__ */ React.createElement(Icon, {
2526
2679
  source: Close,
2527
- size: "small",
2528
- kind: ["warning", "notification"].includes(kind) ? "primary" : "inverted"
2680
+ size: "medium",
2681
+ kind: ["warning"].includes(kind) ? "primary" : "inverted"
2529
2682
  }))));
2530
2683
  };
2531
2684
  const ANIMATION_TIME = 200;
@@ -3032,4 +3185,4 @@ const UserGuide = (props) => {
3032
3185
  })
3033
3186
  }), props.children)) : null;
3034
3187
  };
3035
- export { ANIMATION_TIME, ActionModal, Alert, Badge, Button, ButtonGroup, Card, Checkbox, DesignToken, EmailTagInput, FieldDescription, FieldError, FieldGroup, Form, FormField, FormGroup, Heading, Icon, Info, Input, Interactive, Link, Loader, Modal, ModalBase, ModalCloseButton, ModalPortal, NumericInput, Picker, Popover, ProgressBar, ProgressCircle, PromoBanner, RadioButton, SearchInput, Simple, SpacingToken, Switch, Tab, TabsList, TabsWrapper, Tag, TagInput, Text, Toast, ToastWrapper, Tooltip, UserGuide };
3188
+ export { ANIMATION_TIME, ActionModal, Alert, Avatar, Badge, Button, ButtonGroup, Card, Checkbox, DesignToken, EmailTagInput, FieldDescription, FieldError, FieldGroup, Form, FormField, FormGroup, Heading, Icon, Info, Input, Interactive, Link, Loader, Modal, ModalBase, ModalCloseButton, ModalPortal, NumericInput, Picker, Popover, ProgressBar, ProgressCircle, PromoBanner, RadioButton, SearchInput, ShadowToken, Simple, SpacingToken, Switch, Tab, TabsList, TabsWrapper, Tag, TagInput, Text, Toast, ToastWrapper, Tooltip, UserGuide };