@livechat/design-system-react-components 1.0.0-alpha.16 → 1.0.0-alpha.19

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,16 +35,16 @@ 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 } 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";
46
46
  var index = "";
47
- const DesignTokens = {
47
+ const DesignToken = {
48
48
  Background: "--background",
49
49
  SurfaceBasicDefault: "--surface-basic-default",
50
50
  SurfaceBasicSubtle: "--surface-basic-subtle",
@@ -170,8 +170,29 @@ const DesignTokens = {
170
170
  DecorPurple100: "--decor-purple100",
171
171
  DecorPurple50: "--decor-purple50"
172
172
  };
173
+ const SpacingToken = {
174
+ Spacing0: "--spacing-0",
175
+ Spacing05: "--spacing-05",
176
+ Spacing1: "--spacing-1",
177
+ Spacing2: "--spacing-2",
178
+ Spacing3: "--spacing-3",
179
+ Spacing4: "--spacing-4",
180
+ Spacing5: "--spacing-5",
181
+ Spacing6: "--spacing-6",
182
+ Spacing8: "--spacing-8",
183
+ Spacing12: "--spacing-12",
184
+ Spacing16: "--spacing-16",
185
+ Spacing18: "--spacing-18",
186
+ Spacing20: "--spacing-20",
187
+ Spacing24: "--spacing-24"
188
+ };
189
+ const ShadowToken = {
190
+ Float: "--shadow-float",
191
+ PopOver: "--shadow-pop-over",
192
+ Modal: "--shadow-modal"
193
+ };
173
194
  const caps = "lc-Typography-module__caps___c3eNJ";
174
- var styles$x = {
195
+ var styles$y = {
175
196
  "heading-xl": "lc-Typography-module__heading-xl___nhr-6",
176
197
  "heading-lg": "lc-Typography-module__heading-lg___XYF7l",
177
198
  "heading-md": "lc-Typography-module__heading-md___wHOIs",
@@ -207,7 +228,7 @@ const Heading = (_a) => {
207
228
  "children",
208
229
  "className"
209
230
  ]);
210
- 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);
211
232
  };
212
233
  const Text = (_c) => {
213
234
  var _d = _c, {
@@ -232,15 +253,15 @@ const Text = (_c) => {
232
253
  const baseClassPrefix = caps2 ? "caps" : `paragraph-${size}`;
233
254
  return React.createElement(as, __spreadValues({
234
255
  className: cx({
235
- [styles$x[`${baseClassPrefix}`]]: true,
236
- [styles$x[`${baseClassPrefix}--bold`]]: bold,
237
- [styles$x[`${baseClassPrefix}--strike`]]: strike,
238
- [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
239
260
  }, className)
240
261
  }, props), children);
241
262
  };
242
263
  const icon$1 = "lc-Icon-module__icon___tw31R";
243
- var styles$w = {
264
+ var styles$x = {
244
265
  icon: icon$1,
245
266
  "icon--primary": "lc-Icon-module__icon--primary___JJnBV",
246
267
  "icon--subtle": "lc-Icon-module__icon--subtle___sZIzL",
@@ -281,7 +302,7 @@ const IconSizeMap = {
281
302
  height: 32
282
303
  }
283
304
  };
284
- const baseClass$C = "icon";
305
+ const baseClass$E = "icon";
285
306
  const Icon = (props) => {
286
307
  const _a = props, {
287
308
  source,
@@ -301,7 +322,7 @@ const Icon = (props) => {
301
322
  const GeneratedIcon = React.createElement(source, __spreadProps(__spreadValues({}, IconSizeMap[size]), {
302
323
  color: customColor
303
324
  }));
304
- const mergedClassNames = cx(className, styles$w[baseClass$C], kind && styles$w[`${baseClass$C}--${disabled ? "disabled--" : ""}${kind}`]);
325
+ const mergedClassNames = cx(className, styles$x[baseClass$E], kind && styles$x[`${baseClass$E}--${disabled ? "disabled--" : ""}${kind}`]);
305
326
  return /* @__PURE__ */ React.createElement("span", __spreadProps(__spreadValues({}, restProps), {
306
327
  className: mergedClassNames
307
328
  }), GeneratedIcon);
@@ -309,7 +330,7 @@ const Icon = (props) => {
309
330
  const alert = "lc-Alert-module__alert___HBTns";
310
331
  const alert__content = "lc-Alert-module__alert__content___9nZdf";
311
332
  const alert__icon = "lc-Alert-module__alert__icon___8TaAH";
312
- var styles$v = {
333
+ var styles$w = {
313
334
  alert,
314
335
  alert__content,
315
336
  "alert__content-text": "lc-Alert-module__alert__content-text___x2Un5",
@@ -323,7 +344,7 @@ var styles$v = {
323
344
  "alert--error": "lc-Alert-module__alert--error___DKPo0",
324
345
  alert__icon
325
346
  };
326
- const IconConfig$1 = {
347
+ const IconConfig = {
327
348
  info: {
328
349
  source: Info$1,
329
350
  kind: "link"
@@ -341,7 +362,7 @@ const IconConfig$1 = {
341
362
  kind: "error"
342
363
  }
343
364
  };
344
- const baseClass$B = "alert";
365
+ const baseClass$D = "alert";
345
366
  const Alert = ({
346
367
  children,
347
368
  className,
@@ -350,7 +371,7 @@ const Alert = ({
350
371
  }) => {
351
372
  const containerRef = React.useRef(null);
352
373
  const [isSmallContainer, setIsSmallContainer] = React.useState(false);
353
- const mergedClassNames = cx(styles$v[baseClass$B], styles$v[`${baseClass$B}--${kind}`], isSmallContainer && styles$v[`${baseClass$B}--small`], className);
374
+ const mergedClassNames = cx(styles$w[baseClass$D], styles$w[`${baseClass$D}--${kind}`], isSmallContainer && styles$w[`${baseClass$D}--small`], className);
354
375
  React.useEffect(() => {
355
376
  const handleResize = debounce(() => {
356
377
  if (containerRef.current && containerRef.current.offsetWidth <= 400) {
@@ -365,15 +386,15 @@ const Alert = ({
365
386
  ref: containerRef,
366
387
  className: mergedClassNames
367
388
  }, /* @__PURE__ */ React.createElement("div", {
368
- className: styles$v[`${baseClass$B}__content`]
369
- }, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, IconConfig$1[kind]), {
370
- className: styles$v[`${baseClass$B}__content-icon`]
389
+ className: styles$w[`${baseClass$D}__content`]
390
+ }, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, IconConfig[kind]), {
391
+ className: styles$w[`${baseClass$D}__content-icon`]
371
392
  })), /* @__PURE__ */ React.createElement(Text, {
372
393
  as: "div",
373
- className: cx(styles$v[`${baseClass$B}__content-text`], onClose && styles$v[`${baseClass$B}__content-text--margin`])
394
+ className: cx(styles$w[`${baseClass$D}__content-text`], onClose && styles$w[`${baseClass$D}__content-text--margin`])
374
395
  }, children)), onClose && /* @__PURE__ */ React.createElement("button", {
375
396
  type: "button",
376
- className: styles$v[`${baseClass$B}__close-icon`],
397
+ className: styles$w[`${baseClass$D}__close-icon`],
377
398
  onClick: onClose
378
399
  }, /* @__PURE__ */ React.createElement(Icon, {
379
400
  source: Close,
@@ -381,21 +402,153 @@ const Alert = ({
381
402
  kind: "primary"
382
403
  })));
383
404
  };
405
+ function getInitials(name = "", count = 2) {
406
+ return name.split(" ").map((el) => el.charAt(0)).join("").substring(0, count).toUpperCase();
407
+ }
408
+ function getFontColor(color) {
409
+ return getContrast(color, "#FFFFFF") > 4.5 ? "var(--color-white)" : "var(--color-black)";
410
+ }
411
+ const avatar = "lc-Avatar-module__avatar___1zTCE";
412
+ const avatar__status = "lc-Avatar-module__avatar__status___nX2Ls";
413
+ const avatar__rim = "lc-Avatar-module__avatar__rim___RCQ8Q";
414
+ const avatar__image = "lc-Avatar-module__avatar__image___YqfqE";
415
+ var styles$v = {
416
+ avatar,
417
+ avatar__status,
418
+ "avatar__status--available": "lc-Avatar-module__avatar__status--available___tcpFg",
419
+ "avatar__status--unavailable": "lc-Avatar-module__avatar__status--unavailable___ciauF",
420
+ "avatar__status--unknown": "lc-Avatar-module__avatar__status--unknown___MBaGB",
421
+ "avatar__status--xxxsmall": "lc-Avatar-module__avatar__status--xxxsmall___8pkEO",
422
+ "avatar__status--circle": "lc-Avatar-module__avatar__status--circle___doV5H",
423
+ "avatar__status--xxsmall": "lc-Avatar-module__avatar__status--xxsmall___M69lx",
424
+ "avatar__status--xsmall": "lc-Avatar-module__avatar__status--xsmall___RKQiI",
425
+ "avatar__status--small": "lc-Avatar-module__avatar__status--small___cVrA7",
426
+ "avatar__status--medium": "lc-Avatar-module__avatar__status--medium___n5z1H",
427
+ "avatar__status--large": "lc-Avatar-module__avatar__status--large___Lt-0p",
428
+ "avatar__status--xlarge": "lc-Avatar-module__avatar__status--xlarge___RWIcJ",
429
+ "avatar__status--xxlarge": "lc-Avatar-module__avatar__status--xxlarge___crG9D",
430
+ "avatar__status--rounded-square": "lc-Avatar-module__avatar__status--rounded-square___-My1P",
431
+ avatar__rim,
432
+ "avatar__rim--xxxsmall": "lc-Avatar-module__avatar__rim--xxxsmall___0CH9D",
433
+ "avatar__rim--xxsmall": "lc-Avatar-module__avatar__rim--xxsmall___Mde0K",
434
+ "avatar__rim--xsmall": "lc-Avatar-module__avatar__rim--xsmall___LAN-b",
435
+ "avatar__rim--small": "lc-Avatar-module__avatar__rim--small___FT8LX",
436
+ "avatar__rim--medium": "lc-Avatar-module__avatar__rim--medium___Dy0pr",
437
+ "avatar__rim--large": "lc-Avatar-module__avatar__rim--large___FPvGp",
438
+ "avatar__rim--xlarge": "lc-Avatar-module__avatar__rim--xlarge___CY0kN",
439
+ "avatar__rim--xxlarge": "lc-Avatar-module__avatar__rim--xxlarge___tE053",
440
+ avatar__image,
441
+ "avatar__icon--xxxsmall": "lc-Avatar-module__avatar__icon--xxxsmall___KaoMa",
442
+ "avatar__icon--xxsmall": "lc-Avatar-module__avatar__icon--xxsmall___NJJNV",
443
+ "avatar__icon--xsmall": "lc-Avatar-module__avatar__icon--xsmall___yHEZK",
444
+ "avatar__icon--small": "lc-Avatar-module__avatar__icon--small___l6lBu",
445
+ "avatar__icon--medium": "lc-Avatar-module__avatar__icon--medium___LF4w2",
446
+ "avatar__icon--large": "lc-Avatar-module__avatar__icon--large___QntBf",
447
+ "avatar__icon--xlarge": "lc-Avatar-module__avatar__icon--xlarge___bcHbI",
448
+ "avatar__icon--xxlarge": "lc-Avatar-module__avatar__icon--xxlarge___sx8Fq",
449
+ "avatar--circle": "lc-Avatar-module__avatar--circle___XwEz-",
450
+ "avatar--rounded-square": "lc-Avatar-module__avatar--rounded-square___m7-4I",
451
+ "avatar--with-rim": "lc-Avatar-module__avatar--with-rim___pvFZR",
452
+ "avatar--xxxsmall": "lc-Avatar-module__avatar--xxxsmall___EHzpP",
453
+ "avatar--xxsmall": "lc-Avatar-module__avatar--xxsmall___EDOVp",
454
+ "avatar--xsmall": "lc-Avatar-module__avatar--xsmall___nI348",
455
+ "avatar--small": "lc-Avatar-module__avatar--small___UuQen",
456
+ "avatar--medium": "lc-Avatar-module__avatar--medium___Bt9Eo",
457
+ "avatar--large": "lc-Avatar-module__avatar--large___OU-08",
458
+ "avatar--xlarge": "lc-Avatar-module__avatar--xlarge___zwgeW",
459
+ "avatar--xxlarge": "lc-Avatar-module__avatar--xxlarge___Ur0ul"
460
+ };
461
+ const baseClass$C = "avatar";
462
+ const defaultBackgroundColor = "var(--surface-basic-disabled)";
463
+ const defaultFontColor = "var(--content-subtle)";
464
+ const Avatar = ({
465
+ alt,
466
+ className,
467
+ color,
468
+ shape = "circle",
469
+ size = "medium",
470
+ src,
471
+ status,
472
+ text,
473
+ type,
474
+ withRim = false
475
+ }) => {
476
+ const isImproperImageSetup = type === "image" && !src;
477
+ const [shouldDisplayFallbackAvatar, setShouldDisplayFallbackAvatar] = React.useState(isImproperImageSetup);
478
+ const shouldDisplayImage = type === "image" && !!src && !shouldDisplayFallbackAvatar;
479
+ const shouldDisplayInitials = type === "text";
480
+ const letterCount = ["xxxsmall", "xxsmall", "xsmall"].includes(size) ? 1 : 2;
481
+ const initials = getInitials(text, letterCount);
482
+ const backgroundColor = color || defaultBackgroundColor;
483
+ const fontColor = color ? getFontColor(color) : defaultFontColor;
484
+ const mergedClassNames = cx({
485
+ [styles$v[baseClass$C]]: true,
486
+ [styles$v[`${baseClass$C}--${shape}`]]: true,
487
+ [styles$v[`${baseClass$C}--${size}`]]: true,
488
+ [styles$v[`${baseClass$C}--with-rim`]]: withRim,
489
+ [`${className}`]: className
490
+ });
491
+ 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}`]);
492
+ const mergedIconClassNames = cx(styles$v[`${baseClass$C}__icon`], styles$v[`${baseClass$C}__icon--${size}`]);
493
+ const mergedRimClassNames = cx(styles$v[`${baseClass$C}__rim`], styles$v[`${baseClass$C}__rim--${size}`]);
494
+ const handleError = React.useCallback(() => setShouldDisplayFallbackAvatar(true), []);
495
+ React.useEffect(() => {
496
+ setShouldDisplayFallbackAvatar(isImproperImageSetup);
497
+ }, [isImproperImageSetup]);
498
+ return /* @__PURE__ */ React.createElement("div", {
499
+ className: mergedClassNames,
500
+ style: { backgroundColor }
501
+ }, withRim && /* @__PURE__ */ React.createElement("div", {
502
+ "data-testid": `${baseClass$C}__rim`,
503
+ className: mergedRimClassNames
504
+ }), status && /* @__PURE__ */ React.createElement("div", {
505
+ "data-testid": `${baseClass$C}__status`,
506
+ className: mergedStatusClassNames
507
+ }), shouldDisplayImage && /* @__PURE__ */ React.createElement("img", {
508
+ className: styles$v[`${baseClass$C}__image`],
509
+ src,
510
+ alt,
511
+ onError: handleError
512
+ }), shouldDisplayInitials && /* @__PURE__ */ React.createElement("span", {
513
+ style: { color: fontColor }
514
+ }, initials), shouldDisplayFallbackAvatar && /* @__PURE__ */ React.createElement(Icon, {
515
+ "data-testid": `${baseClass$C}__icon`,
516
+ className: mergedIconClassNames,
517
+ source: Person,
518
+ kind: "primary"
519
+ }));
520
+ };
384
521
  const badge = "lc-Badge-module__badge___GhLnu";
522
+ const badge__dot = "lc-Badge-module__badge__dot___z6RO6";
385
523
  var styles$u = {
386
524
  badge,
387
- "badge--secondary": "lc-Badge-module__badge--secondary___JjNIJ"
388
- };
525
+ badge__dot,
526
+ "badge--large": "lc-Badge-module__badge--large___B131q",
527
+ "badge--medium": "lc-Badge-module__badge--medium___TDU8a",
528
+ "badge--compact": "lc-Badge-module__badge--compact___9xJ4y",
529
+ "badge--primary": "lc-Badge-module__badge--primary___8LRpp",
530
+ "badge--secondary": "lc-Badge-module__badge--secondary___JjNIJ",
531
+ "badge--tertiary": "lc-Badge-module__badge--tertiary___e83wV"
532
+ };
533
+ const baseClass$B = "badge";
389
534
  const Badge = ({
390
535
  children,
391
536
  className,
392
- secondary = false
537
+ kind = "primary",
538
+ size = "medium",
539
+ type = "content"
393
540
  }) => {
394
- return /* @__PURE__ */ React.createElement("span", {
395
- className: cx(styles$u.badge, className, {
396
- [styles$u["badge--secondary"]]: secondary
541
+ const mergedClassNames = cx(className, styles$u[baseClass$B], styles$u[`${baseClass$B}--${kind}`], styles$u[`${baseClass$B}--${size}`]);
542
+ const content = {
543
+ ["content"]: children,
544
+ ["alert"]: "!",
545
+ ["dot"]: /* @__PURE__ */ React.createElement("span", {
546
+ className: styles$u[`${baseClass$B}__dot`]
397
547
  })
398
- }, children);
548
+ }[type];
549
+ return /* @__PURE__ */ React.createElement("span", {
550
+ className: mergedClassNames
551
+ }, content);
399
552
  };
400
553
  const loader = "lc-Loader-module__loader___LRflD";
401
554
  const loader__spinner = "lc-Loader-module__loader__spinner___l3C1g";
@@ -1955,22 +2108,34 @@ const switch__input = "lc-Switch-module__switch__input___NiiOR";
1955
2108
  const switch__container = "lc-Switch-module__switch__container___79F7W";
1956
2109
  const switch__track = "lc-Switch-module__switch__track___2wr2M";
1957
2110
  const switch__slider = "lc-Switch-module__switch__slider___WHd--";
2111
+ const switch__loader = "lc-Switch-module__switch__loader___FE-fA";
1958
2112
  var styles$6 = {
1959
2113
  "switch": "lc-Switch-module__switch___AaA2k",
1960
2114
  "switch__track--enabled": "lc-Switch-module__switch__track--enabled___sy4Xl",
1961
- "switch__track--disabled": "lc-Switch-module__switch__track--disabled___HkDhl",
1962
- "switch--basic": "lc-Switch-module__switch--basic___jKO4n",
2115
+ "switch__track--on": "lc-Switch-module__switch__track--on___aOMWe",
2116
+ "switch__track--off": "lc-Switch-module__switch__track--off___NAisj",
2117
+ "switch--large": "lc-Switch-module__switch--large___pSoJ7",
1963
2118
  "switch--compact": "lc-Switch-module__switch--compact___OGFIX",
2119
+ "switch--medium": "lc-Switch-module__switch--medium___EcZwT",
1964
2120
  switch__input,
2121
+ "switch__input--disabled": "lc-Switch-module__switch__input--disabled___Po8gh",
1965
2122
  switch__container,
1966
2123
  switch__track,
2124
+ "switch__track--disabled": "lc-Switch-module__switch__track--disabled___HkDhl",
1967
2125
  switch__slider,
1968
- "switch__slider--basic": "lc-Switch-module__switch__slider--basic___OMKTp",
1969
- "switch__slider--basic--enabled": "lc-Switch-module__switch__slider--basic--enabled___sh9jo",
1970
- "switch__slider--basic--disabled": "lc-Switch-module__switch__slider--basic--disabled___GSTO9",
2126
+ "switch__slider--large": "lc-Switch-module__switch__slider--large___WoEgi",
2127
+ "switch__slider--large--on": "lc-Switch-module__switch__slider--large--on___7Qp3G",
2128
+ "switch__slider--large--off": "lc-Switch-module__switch__slider--large--off___iRMmD",
1971
2129
  "switch__slider--compact": "lc-Switch-module__switch__slider--compact___uZ-lS",
1972
- "switch__slider--compact--enabled": "lc-Switch-module__switch__slider--compact--enabled___04TFA",
1973
- "switch__slider--compact--disabled": "lc-Switch-module__switch__slider--compact--disabled___Vqznr"
2130
+ "switch__slider--compact--on": "lc-Switch-module__switch__slider--compact--on___FykE3",
2131
+ "switch__slider--compact--off": "lc-Switch-module__switch__slider--compact--off___s5yR8",
2132
+ "switch__slider--medium": "lc-Switch-module__switch__slider--medium___uhptz",
2133
+ "switch__slider--medium--on": "lc-Switch-module__switch__slider--medium--on___SfeAV",
2134
+ "switch__slider--medium--off": "lc-Switch-module__switch__slider--medium--off___eXJJz",
2135
+ switch__loader,
2136
+ "switch__loader--compact": "lc-Switch-module__switch__loader--compact___3imUh",
2137
+ "switch__loader--medium": "lc-Switch-module__switch__loader--medium___2zi05",
2138
+ "switch__loader--large": "lc-Switch-module__switch__loader--large___vLRFa"
1974
2139
  };
1975
2140
  const baseClass$c = "switch";
1976
2141
  const Switch = (_O) => {
@@ -1978,56 +2143,69 @@ const Switch = (_O) => {
1978
2143
  className = "",
1979
2144
  defaultOn = false,
1980
2145
  disabled = false,
2146
+ loading = false,
1981
2147
  name = baseClass$c,
1982
2148
  on,
1983
2149
  onChange = noop,
1984
- size = "basic",
2150
+ size = "large",
1985
2151
  innerRef
1986
2152
  } = _P, props = __objRest(_P, [
1987
2153
  "className",
1988
2154
  "defaultOn",
1989
2155
  "disabled",
2156
+ "loading",
1990
2157
  "name",
1991
2158
  "on",
1992
2159
  "onChange",
1993
2160
  "size",
1994
2161
  "innerRef"
1995
2162
  ]);
1996
- const [enabled, setEnabled] = React.useState(() => on !== void 0 ? on : defaultOn);
2163
+ const [checked, setChecked] = React.useState(() => on !== void 0 ? on : defaultOn);
1997
2164
  React.useEffect(() => {
1998
2165
  if (on !== void 0) {
1999
- setEnabled(on);
2166
+ setChecked(on);
2000
2167
  }
2001
2168
  }, [on]);
2002
- const valueStyles = enabled ? "enabled" : "disabled";
2169
+ const iconSize = size === "large" ? "small" : "xsmall";
2170
+ const toggleStyles = checked ? "on" : "off";
2171
+ const shouldBehaveAsDisabled = disabled || loading;
2172
+ const availabilityStyles = shouldBehaveAsDisabled ? "disabled" : "enabled";
2003
2173
  const mergedClassNames = cx(styles$6[baseClass$c], styles$6[`${baseClass$c}--${size}`], className);
2174
+ const shouldShowDisabledIcon = disabled && !loading;
2004
2175
  const handleChange = (e) => {
2005
2176
  const hasOnChangePassed = onChange !== noop;
2006
2177
  if (hasOnChangePassed) {
2007
- onChange(e, enabled);
2178
+ onChange(e, checked);
2008
2179
  return;
2009
2180
  }
2010
2181
  e.stopPropagation();
2011
- setEnabled((prevEnabled) => !prevEnabled);
2182
+ setChecked((prevEnabled) => !prevEnabled);
2012
2183
  };
2013
2184
  return /* @__PURE__ */ React.createElement("span", {
2014
2185
  className: mergedClassNames
2015
2186
  }, /* @__PURE__ */ React.createElement("input", __spreadValues({
2016
2187
  type: "checkbox",
2017
- className: styles$6[`${baseClass$c}__input`],
2188
+ className: cx(styles$6[`${baseClass$c}__input`], styles$6[`${baseClass$c}__input--${availabilityStyles}`]),
2018
2189
  onChange: handleChange,
2019
- checked: enabled,
2190
+ checked,
2020
2191
  name,
2021
2192
  ref: innerRef,
2022
- disabled,
2193
+ disabled: shouldBehaveAsDisabled,
2023
2194
  "test-id": "foo"
2024
2195
  }, props)), /* @__PURE__ */ React.createElement("span", {
2025
2196
  className: styles$6[`${baseClass$c}__container`]
2026
2197
  }, /* @__PURE__ */ React.createElement("span", {
2027
- className: cx(styles$6[`${baseClass$c}__track`], styles$6[`${baseClass$c}__track--${valueStyles}`])
2198
+ className: cx(styles$6[`${baseClass$c}__track`], styles$6[`${baseClass$c}__track--${toggleStyles}`], styles$6[`${baseClass$c}__track--${availabilityStyles}`])
2028
2199
  }), /* @__PURE__ */ React.createElement("span", {
2029
- className: cx(styles$6[`${baseClass$c}__slider`], styles$6[`${baseClass$c}__slider--${size}`], styles$6[`${baseClass$c}__slider--${size}--${valueStyles}`])
2030
- })));
2200
+ className: cx(styles$6[`${baseClass$c}__slider`], styles$6[`${baseClass$c}__slider--${size}`], styles$6[`${baseClass$c}__slider--${size}--${toggleStyles}`])
2201
+ }, loading && /* @__PURE__ */ React.createElement(Loader, {
2202
+ className: cx(styles$6[`${baseClass$c}__loader`], styles$6[`${baseClass$c}__loader--${size}`])
2203
+ }), shouldShowDisabledIcon && /* @__PURE__ */ React.createElement(Icon, {
2204
+ "data-testid": "disabled-icon",
2205
+ size: iconSize,
2206
+ source: LockBlack,
2207
+ kind: "primary"
2208
+ }))));
2031
2209
  };
2032
2210
  const tab = "lc-Tab-module__tab___fME7u";
2033
2211
  const tab__description = "lc-Tab-module__tab__description___JGXU6";
@@ -2123,7 +2301,7 @@ const Tag = (_S) => {
2123
2301
  onRemove,
2124
2302
  outline = false,
2125
2303
  icon: icon2,
2126
- avatar,
2304
+ avatar: avatar2,
2127
2305
  customColor
2128
2306
  } = _T, restProps = __objRest(_T, [
2129
2307
  "className",
@@ -2140,7 +2318,7 @@ const Tag = (_S) => {
2140
2318
  const mergedClassNames = cx(styles$3[baseClass$9], className, styles$3[`${baseClass$9}--${size}`], styles$3[`${baseClass$9}--${kind}`], {
2141
2319
  [styles$3[`${baseClass$9}--dismissible`]]: dismissible,
2142
2320
  [styles$3[`${baseClass$9}--outline`]]: outline,
2143
- [styles$3[`${baseClass$9}--with-icon`]]: !!icon2 || !!avatar,
2321
+ [styles$3[`${baseClass$9}--with-icon`]]: !!icon2 || !!avatar2,
2144
2322
  [styles$3[`${baseClass$9}--${getCustomTextClass(customColor)}`]]: !!customColor
2145
2323
  });
2146
2324
  const getCustomColorStyles = () => {
@@ -2172,12 +2350,12 @@ const Tag = (_S) => {
2172
2350
  }, restProps), getCustomColorStyles()), {
2173
2351
  as: "div",
2174
2352
  size: "md"
2175
- }), avatar && /* @__PURE__ */ React.createElement("img", {
2353
+ }), avatar2 && /* @__PURE__ */ React.createElement("img", {
2176
2354
  className: styles$3[`${baseClass$9}__avatar`],
2177
- src: avatar,
2355
+ src: avatar2,
2178
2356
  alt: "tag-avatar",
2179
2357
  "data-testid": "lc-tag-avatar"
2180
- }), " ", icon2 && !avatar && /* @__PURE__ */ React.createElement(Icon, {
2358
+ }), " ", icon2 && !avatar2 && /* @__PURE__ */ React.createElement(Icon, {
2181
2359
  "data-testid": "lc-tag-icon",
2182
2360
  className: styles$3[`${baseClass$9}__icon`],
2183
2361
  source: icon2,
@@ -2395,18 +2573,13 @@ const EmailTagInput = ({
2395
2573
  };
2396
2574
  const toast = "lc-Toast-module__toast___j5Amn";
2397
2575
  const toast__content = "lc-Toast-module__toast__content___HjaNw";
2398
- const toast__icon = "lc-Toast-module__toast__icon___wLbLu";
2399
- const toast__close = "lc-Toast-module__toast__close___O18Lh";
2400
2576
  const toast__actions = "lc-Toast-module__toast__actions___JWu-1";
2401
2577
  var styles$1 = {
2402
2578
  toast,
2403
2579
  toast__content,
2404
- toast__icon,
2405
- toast__close,
2406
2580
  toast__actions,
2407
- "toast__actions-close": "lc-Toast-module__toast__actions-close___xN8YT",
2408
- "toast__actions-custom": "lc-Toast-module__toast__actions-custom___z1UUf",
2409
- "toast--notification": "lc-Toast-module__toast--notification___pDXnc",
2581
+ "toast__actions--close": "lc-Toast-module__toast__actions--close___QuXHY",
2582
+ "toast__actions--custom": "lc-Toast-module__toast__actions--custom___lm-pM",
2410
2583
  "toast--success": "lc-Toast-module__toast--success___7UC6m",
2411
2584
  "toast--warning": "lc-Toast-module__toast--warning___pteb7",
2412
2585
  "toast--error": "lc-Toast-module__toast--error___trg--",
@@ -2428,8 +2601,7 @@ var styles$1 = {
2428
2601
  "toast-exit--fade": "lc-Toast-module__toast-exit--fade___iDA1p",
2429
2602
  "toast-exit-active--fade": "lc-Toast-module__toast-exit-active--fade___tL7sb"
2430
2603
  };
2431
- const baseClass$6 = "toast";
2432
- const IconConfig = {
2604
+ const iconConfig = {
2433
2605
  success: {
2434
2606
  source: CheckCircleSolid,
2435
2607
  kind: "inverted"
@@ -2444,47 +2616,55 @@ const IconConfig = {
2444
2616
  info: {
2445
2617
  source: Info$1,
2446
2618
  kind: "inverted"
2447
- },
2448
- notification: {
2449
- source: Info$1,
2450
- kind: "link"
2451
2619
  }
2452
2620
  };
2453
- const Toast = ({
2454
- action,
2455
- className,
2456
- children,
2457
- removable,
2458
- kind = "info",
2459
- onClose
2460
- }) => {
2621
+ const baseClass$6 = "toast";
2622
+ const Toast = (_U) => {
2623
+ var _V = _U, {
2624
+ action,
2625
+ className,
2626
+ children,
2627
+ removable,
2628
+ kind = "info",
2629
+ onClose
2630
+ } = _V, divProps = __objRest(_V, [
2631
+ "action",
2632
+ "className",
2633
+ "children",
2634
+ "removable",
2635
+ "kind",
2636
+ "onClose"
2637
+ ]);
2461
2638
  const mergedClassNames = cx(styles$1[baseClass$6], styles$1[`${baseClass$6}--${kind}`], className);
2462
2639
  const onActionClick = (action2) => {
2463
- if (action2 && action2.closeOnClick && onClose) {
2464
- action2.handler();
2640
+ if (action2 && action2.closesOnClick && onClose) {
2641
+ action2.onClick();
2465
2642
  return onClose();
2466
2643
  }
2467
- return action2.handler();
2644
+ return action2.onClick();
2468
2645
  };
2469
- return /* @__PURE__ */ React.createElement("div", {
2646
+ return /* @__PURE__ */ React.createElement("div", __spreadValues({
2470
2647
  className: mergedClassNames
2471
- }, /* @__PURE__ */ React.createElement("div", {
2648
+ }, divProps), /* @__PURE__ */ React.createElement("div", {
2472
2649
  className: styles$1[`${baseClass$6}__icon`]
2473
- }, /* @__PURE__ */ React.createElement(Icon, __spreadValues({}, IconConfig[kind]))), /* @__PURE__ */ React.createElement("div", {
2650
+ }, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, iconConfig[kind]), {
2651
+ size: "medium"
2652
+ }))), /* @__PURE__ */ React.createElement("div", {
2474
2653
  className: styles$1[`${baseClass$6}__content`]
2475
2654
  }, children), (action || removable) && /* @__PURE__ */ React.createElement("div", {
2476
2655
  className: styles$1[`${baseClass$6}__actions`]
2477
- }, action && /* @__PURE__ */ React.createElement("button", {
2478
- className: styles$1[`${baseClass$6}__actions-custom`],
2656
+ }, action && /* @__PURE__ */ React.createElement(Button, {
2657
+ className: styles$1[`${baseClass$6}__actions--custom`],
2658
+ kind: "plain",
2479
2659
  onClick: () => onActionClick(action)
2480
2660
  }, action.label), removable && /* @__PURE__ */ React.createElement("div", {
2481
- className: styles$1[`${baseClass$6}__actions-close`],
2661
+ className: styles$1[`${baseClass$6}__actions--close`],
2482
2662
  "aria-label": "Close toast",
2483
2663
  onClick: onClose
2484
2664
  }, /* @__PURE__ */ React.createElement(Icon, {
2485
2665
  source: Close,
2486
- size: "small",
2487
- kind: ["warning", "notification"].includes(kind) ? "primary" : "inverted"
2666
+ size: "medium",
2667
+ kind: ["warning"].includes(kind) ? "primary" : "inverted"
2488
2668
  }))));
2489
2669
  };
2490
2670
  const ANIMATION_TIME = 200;
@@ -2991,4 +3171,4 @@ const UserGuide = (props) => {
2991
3171
  })
2992
3172
  }), props.children)) : null;
2993
3173
  };
2994
- export { ANIMATION_TIME, ActionModal, Alert, Badge, Button, ButtonGroup, Card, Checkbox, DesignTokens, 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, Switch, Tab, TabsList, TabsWrapper, Tag, TagInput, Text, Toast, ToastWrapper, Tooltip, UserGuide };
3174
+ 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 };