@livechat/design-system-react-components 1.0.0-alpha.18 → 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.cjs.js +9 -9
- package/dist/dsrc.es.js +207 -68
- package/dist/dsrc.umd.js +9 -9
- package/dist/shadow/shadow.css +7 -0
- package/dist/shadow/shadow.css.map +1 -0
- package/dist/shadow/spacing.css +18 -0
- package/dist/shadow/spacing.css.map +1 -0
- package/dist/spacing/shadow.css +7 -0
- package/dist/spacing/shadow.css.map +1 -0
- package/dist/src/components/Avatar/Avatar.d.ts +19 -0
- package/dist/src/components/Avatar/Avatar.helpers.d.ts +2 -0
- package/dist/src/components/Avatar/index.d.ts +1 -0
- package/dist/src/components/Switch/Switch.d.ts +3 -1
- package/dist/src/components/Toast/Toast.d.ts +6 -6
- package/dist/src/foundations/shadow-token.d.ts +5 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +4 -4
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$
|
|
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$
|
|
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$
|
|
252
|
-
[styles$
|
|
253
|
-
[styles$
|
|
254
|
-
[styles$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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
|
|
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$
|
|
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$
|
|
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,15 @@ const Alert = ({
|
|
|
381
386
|
ref: containerRef,
|
|
382
387
|
className: mergedClassNames
|
|
383
388
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
384
|
-
className: styles$
|
|
385
|
-
}, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, IconConfig
|
|
386
|
-
className: styles$
|
|
389
|
+
className: styles$w[`${baseClass$D}__content`]
|
|
390
|
+
}, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, IconConfig[kind]), {
|
|
391
|
+
className: styles$w[`${baseClass$D}__content-icon`]
|
|
387
392
|
})), /* @__PURE__ */ React.createElement(Text, {
|
|
388
393
|
as: "div",
|
|
389
|
-
className: cx(styles$
|
|
394
|
+
className: cx(styles$w[`${baseClass$D}__content-text`], onClose && styles$w[`${baseClass$D}__content-text--margin`])
|
|
390
395
|
}, children)), onClose && /* @__PURE__ */ React.createElement("button", {
|
|
391
396
|
type: "button",
|
|
392
|
-
className: styles$
|
|
397
|
+
className: styles$w[`${baseClass$D}__close-icon`],
|
|
393
398
|
onClick: onClose
|
|
394
399
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
395
400
|
source: Close,
|
|
@@ -397,6 +402,122 @@ const Alert = ({
|
|
|
397
402
|
kind: "primary"
|
|
398
403
|
})));
|
|
399
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
|
+
};
|
|
400
521
|
const badge = "lc-Badge-module__badge___GhLnu";
|
|
401
522
|
const badge__dot = "lc-Badge-module__badge__dot___z6RO6";
|
|
402
523
|
var styles$u = {
|
|
@@ -1987,25 +2108,34 @@ const switch__input = "lc-Switch-module__switch__input___NiiOR";
|
|
|
1987
2108
|
const switch__container = "lc-Switch-module__switch__container___79F7W";
|
|
1988
2109
|
const switch__track = "lc-Switch-module__switch__track___2wr2M";
|
|
1989
2110
|
const switch__slider = "lc-Switch-module__switch__slider___WHd--";
|
|
2111
|
+
const switch__loader = "lc-Switch-module__switch__loader___FE-fA";
|
|
1990
2112
|
var styles$6 = {
|
|
1991
2113
|
"switch": "lc-Switch-module__switch___AaA2k",
|
|
1992
2114
|
"switch__track--enabled": "lc-Switch-module__switch__track--enabled___sy4Xl",
|
|
1993
2115
|
"switch__track--on": "lc-Switch-module__switch__track--on___aOMWe",
|
|
1994
2116
|
"switch__track--off": "lc-Switch-module__switch__track--off___NAisj",
|
|
1995
|
-
"switch--
|
|
2117
|
+
"switch--large": "lc-Switch-module__switch--large___pSoJ7",
|
|
1996
2118
|
"switch--compact": "lc-Switch-module__switch--compact___OGFIX",
|
|
2119
|
+
"switch--medium": "lc-Switch-module__switch--medium___EcZwT",
|
|
1997
2120
|
switch__input,
|
|
1998
2121
|
"switch__input--disabled": "lc-Switch-module__switch__input--disabled___Po8gh",
|
|
1999
2122
|
switch__container,
|
|
2000
2123
|
switch__track,
|
|
2001
2124
|
"switch__track--disabled": "lc-Switch-module__switch__track--disabled___HkDhl",
|
|
2002
2125
|
switch__slider,
|
|
2003
|
-
"switch__slider--
|
|
2004
|
-
"switch__slider--
|
|
2005
|
-
"switch__slider--
|
|
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",
|
|
2006
2129
|
"switch__slider--compact": "lc-Switch-module__switch__slider--compact___uZ-lS",
|
|
2007
2130
|
"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"
|
|
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"
|
|
2009
2139
|
};
|
|
2010
2140
|
const baseClass$c = "switch";
|
|
2011
2141
|
const Switch = (_O) => {
|
|
@@ -2013,15 +2143,17 @@ const Switch = (_O) => {
|
|
|
2013
2143
|
className = "",
|
|
2014
2144
|
defaultOn = false,
|
|
2015
2145
|
disabled = false,
|
|
2146
|
+
loading = false,
|
|
2016
2147
|
name = baseClass$c,
|
|
2017
2148
|
on,
|
|
2018
2149
|
onChange = noop,
|
|
2019
|
-
size = "
|
|
2150
|
+
size = "large",
|
|
2020
2151
|
innerRef
|
|
2021
2152
|
} = _P, props = __objRest(_P, [
|
|
2022
2153
|
"className",
|
|
2023
2154
|
"defaultOn",
|
|
2024
2155
|
"disabled",
|
|
2156
|
+
"loading",
|
|
2025
2157
|
"name",
|
|
2026
2158
|
"on",
|
|
2027
2159
|
"onChange",
|
|
@@ -2034,10 +2166,12 @@ const Switch = (_O) => {
|
|
|
2034
2166
|
setChecked(on);
|
|
2035
2167
|
}
|
|
2036
2168
|
}, [on]);
|
|
2037
|
-
const iconSize = size === "
|
|
2169
|
+
const iconSize = size === "large" ? "small" : "xsmall";
|
|
2038
2170
|
const toggleStyles = checked ? "on" : "off";
|
|
2039
|
-
const
|
|
2171
|
+
const shouldBehaveAsDisabled = disabled || loading;
|
|
2172
|
+
const availabilityStyles = shouldBehaveAsDisabled ? "disabled" : "enabled";
|
|
2040
2173
|
const mergedClassNames = cx(styles$6[baseClass$c], styles$6[`${baseClass$c}--${size}`], className);
|
|
2174
|
+
const shouldShowDisabledIcon = disabled && !loading;
|
|
2041
2175
|
const handleChange = (e) => {
|
|
2042
2176
|
const hasOnChangePassed = onChange !== noop;
|
|
2043
2177
|
if (hasOnChangePassed) {
|
|
@@ -2056,7 +2190,7 @@ const Switch = (_O) => {
|
|
|
2056
2190
|
checked,
|
|
2057
2191
|
name,
|
|
2058
2192
|
ref: innerRef,
|
|
2059
|
-
disabled,
|
|
2193
|
+
disabled: shouldBehaveAsDisabled,
|
|
2060
2194
|
"test-id": "foo"
|
|
2061
2195
|
}, props)), /* @__PURE__ */ React.createElement("span", {
|
|
2062
2196
|
className: styles$6[`${baseClass$c}__container`]
|
|
@@ -2064,7 +2198,10 @@ const Switch = (_O) => {
|
|
|
2064
2198
|
className: cx(styles$6[`${baseClass$c}__track`], styles$6[`${baseClass$c}__track--${toggleStyles}`], styles$6[`${baseClass$c}__track--${availabilityStyles}`])
|
|
2065
2199
|
}), /* @__PURE__ */ React.createElement("span", {
|
|
2066
2200
|
className: cx(styles$6[`${baseClass$c}__slider`], styles$6[`${baseClass$c}__slider--${size}`], styles$6[`${baseClass$c}__slider--${size}--${toggleStyles}`])
|
|
2067
|
-
},
|
|
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",
|
|
2068
2205
|
size: iconSize,
|
|
2069
2206
|
source: LockBlack,
|
|
2070
2207
|
kind: "primary"
|
|
@@ -2164,7 +2301,7 @@ const Tag = (_S) => {
|
|
|
2164
2301
|
onRemove,
|
|
2165
2302
|
outline = false,
|
|
2166
2303
|
icon: icon2,
|
|
2167
|
-
avatar,
|
|
2304
|
+
avatar: avatar2,
|
|
2168
2305
|
customColor
|
|
2169
2306
|
} = _T, restProps = __objRest(_T, [
|
|
2170
2307
|
"className",
|
|
@@ -2181,7 +2318,7 @@ const Tag = (_S) => {
|
|
|
2181
2318
|
const mergedClassNames = cx(styles$3[baseClass$9], className, styles$3[`${baseClass$9}--${size}`], styles$3[`${baseClass$9}--${kind}`], {
|
|
2182
2319
|
[styles$3[`${baseClass$9}--dismissible`]]: dismissible,
|
|
2183
2320
|
[styles$3[`${baseClass$9}--outline`]]: outline,
|
|
2184
|
-
[styles$3[`${baseClass$9}--with-icon`]]: !!icon2 || !!
|
|
2321
|
+
[styles$3[`${baseClass$9}--with-icon`]]: !!icon2 || !!avatar2,
|
|
2185
2322
|
[styles$3[`${baseClass$9}--${getCustomTextClass(customColor)}`]]: !!customColor
|
|
2186
2323
|
});
|
|
2187
2324
|
const getCustomColorStyles = () => {
|
|
@@ -2213,12 +2350,12 @@ const Tag = (_S) => {
|
|
|
2213
2350
|
}, restProps), getCustomColorStyles()), {
|
|
2214
2351
|
as: "div",
|
|
2215
2352
|
size: "md"
|
|
2216
|
-
}),
|
|
2353
|
+
}), avatar2 && /* @__PURE__ */ React.createElement("img", {
|
|
2217
2354
|
className: styles$3[`${baseClass$9}__avatar`],
|
|
2218
|
-
src:
|
|
2355
|
+
src: avatar2,
|
|
2219
2356
|
alt: "tag-avatar",
|
|
2220
2357
|
"data-testid": "lc-tag-avatar"
|
|
2221
|
-
}), " ", icon2 && !
|
|
2358
|
+
}), " ", icon2 && !avatar2 && /* @__PURE__ */ React.createElement(Icon, {
|
|
2222
2359
|
"data-testid": "lc-tag-icon",
|
|
2223
2360
|
className: styles$3[`${baseClass$9}__icon`],
|
|
2224
2361
|
source: icon2,
|
|
@@ -2436,18 +2573,13 @@ const EmailTagInput = ({
|
|
|
2436
2573
|
};
|
|
2437
2574
|
const toast = "lc-Toast-module__toast___j5Amn";
|
|
2438
2575
|
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
2576
|
const toast__actions = "lc-Toast-module__toast__actions___JWu-1";
|
|
2442
2577
|
var styles$1 = {
|
|
2443
2578
|
toast,
|
|
2444
2579
|
toast__content,
|
|
2445
|
-
toast__icon,
|
|
2446
|
-
toast__close,
|
|
2447
2580
|
toast__actions,
|
|
2448
|
-
"toast__actions
|
|
2449
|
-
"toast__actions
|
|
2450
|
-
"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",
|
|
2451
2583
|
"toast--success": "lc-Toast-module__toast--success___7UC6m",
|
|
2452
2584
|
"toast--warning": "lc-Toast-module__toast--warning___pteb7",
|
|
2453
2585
|
"toast--error": "lc-Toast-module__toast--error___trg--",
|
|
@@ -2469,8 +2601,7 @@ var styles$1 = {
|
|
|
2469
2601
|
"toast-exit--fade": "lc-Toast-module__toast-exit--fade___iDA1p",
|
|
2470
2602
|
"toast-exit-active--fade": "lc-Toast-module__toast-exit-active--fade___tL7sb"
|
|
2471
2603
|
};
|
|
2472
|
-
const
|
|
2473
|
-
const IconConfig = {
|
|
2604
|
+
const iconConfig = {
|
|
2474
2605
|
success: {
|
|
2475
2606
|
source: CheckCircleSolid,
|
|
2476
2607
|
kind: "inverted"
|
|
@@ -2485,47 +2616,55 @@ const IconConfig = {
|
|
|
2485
2616
|
info: {
|
|
2486
2617
|
source: Info$1,
|
|
2487
2618
|
kind: "inverted"
|
|
2488
|
-
},
|
|
2489
|
-
notification: {
|
|
2490
|
-
source: Info$1,
|
|
2491
|
-
kind: "link"
|
|
2492
2619
|
}
|
|
2493
2620
|
};
|
|
2494
|
-
const
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
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
|
+
]);
|
|
2502
2638
|
const mergedClassNames = cx(styles$1[baseClass$6], styles$1[`${baseClass$6}--${kind}`], className);
|
|
2503
2639
|
const onActionClick = (action2) => {
|
|
2504
|
-
if (action2 && action2.
|
|
2505
|
-
action2.
|
|
2640
|
+
if (action2 && action2.closesOnClick && onClose) {
|
|
2641
|
+
action2.onClick();
|
|
2506
2642
|
return onClose();
|
|
2507
2643
|
}
|
|
2508
|
-
return action2.
|
|
2644
|
+
return action2.onClick();
|
|
2509
2645
|
};
|
|
2510
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
2646
|
+
return /* @__PURE__ */ React.createElement("div", __spreadValues({
|
|
2511
2647
|
className: mergedClassNames
|
|
2512
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
2648
|
+
}, divProps), /* @__PURE__ */ React.createElement("div", {
|
|
2513
2649
|
className: styles$1[`${baseClass$6}__icon`]
|
|
2514
|
-
}, /* @__PURE__ */ React.createElement(Icon, __spreadValues({},
|
|
2650
|
+
}, /* @__PURE__ */ React.createElement(Icon, __spreadProps(__spreadValues({}, iconConfig[kind]), {
|
|
2651
|
+
size: "medium"
|
|
2652
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
2515
2653
|
className: styles$1[`${baseClass$6}__content`]
|
|
2516
2654
|
}, children), (action || removable) && /* @__PURE__ */ React.createElement("div", {
|
|
2517
2655
|
className: styles$1[`${baseClass$6}__actions`]
|
|
2518
|
-
}, action && /* @__PURE__ */ React.createElement(
|
|
2519
|
-
className: styles$1[`${baseClass$6}__actions
|
|
2656
|
+
}, action && /* @__PURE__ */ React.createElement(Button, {
|
|
2657
|
+
className: styles$1[`${baseClass$6}__actions--custom`],
|
|
2658
|
+
kind: "plain",
|
|
2520
2659
|
onClick: () => onActionClick(action)
|
|
2521
2660
|
}, action.label), removable && /* @__PURE__ */ React.createElement("div", {
|
|
2522
|
-
className: styles$1[`${baseClass$6}__actions
|
|
2661
|
+
className: styles$1[`${baseClass$6}__actions--close`],
|
|
2523
2662
|
"aria-label": "Close toast",
|
|
2524
2663
|
onClick: onClose
|
|
2525
2664
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
2526
2665
|
source: Close,
|
|
2527
|
-
size: "
|
|
2528
|
-
kind: ["warning"
|
|
2666
|
+
size: "medium",
|
|
2667
|
+
kind: ["warning"].includes(kind) ? "primary" : "inverted"
|
|
2529
2668
|
}))));
|
|
2530
2669
|
};
|
|
2531
2670
|
const ANIMATION_TIME = 200;
|
|
@@ -3032,4 +3171,4 @@ const UserGuide = (props) => {
|
|
|
3032
3171
|
})
|
|
3033
3172
|
}), props.children)) : null;
|
|
3034
3173
|
};
|
|
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 };
|
|
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 };
|