@livechat/design-system-react-components 1.0.0-alpha.51 → 1.0.0-alpha.53
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 +5 -5
- package/dist/dsrc.es.js +268 -173
- package/dist/dsrc.umd.js +5 -5
- package/dist/src/components/ActionMenu/ActionMenu.d.ts +27 -0
- package/dist/src/components/ActionMenu/index.d.ts +1 -0
- package/dist/src/components/Alert/Alert.d.ts +9 -0
- package/dist/src/components/Avatar/Avatar.d.ts +30 -0
- package/dist/src/components/Badge/Badge.d.ts +15 -0
- package/dist/src/components/Button/Button.d.ts +44 -2
- package/dist/src/components/Picker/Picker.d.ts +49 -0
- package/dist/src/components/Picker/Trigger.d.ts +1 -0
- package/dist/src/components/Popover/Popover.d.ts +22 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +4 -4
package/dist/dsrc.es.js
CHANGED
|
@@ -36,13 +36,13 @@ var __publicField = (obj, key, value) => {
|
|
|
36
36
|
import * as React from "react";
|
|
37
37
|
import { useReducer, useRef, useEffect, useCallback, useMemo } from "react";
|
|
38
38
|
import cx from "clsx";
|
|
39
|
+
import { useFloating, offset, flip, autoUpdate, arrow } from "@floating-ui/react-dom";
|
|
39
40
|
import { Close, Info as Info$1, Warning, CheckCircleSolid, Block, Person, ChevronUp, ChevronDown, Check, DoubleArrowLeft, ChevronLeft, ChevronRight, DoubleArrowRight, VisibilityOn, VisibilityOff, Search, LockBlack, Refresh, Error as Error2 } from "@livechat/design-system-icons/react/material";
|
|
40
41
|
import debounce from "lodash.debounce";
|
|
41
42
|
import { getContrast } from "polished";
|
|
42
43
|
import ReactDayPicker from "react-day-picker";
|
|
43
44
|
import { subMonths, differenceInCalendarMonths, addMonths, isSameMonth, isSameDay, isAfter, differenceInCalendarDays } from "date-fns";
|
|
44
45
|
import * as ReactDOM from "react-dom";
|
|
45
|
-
import { useFloating, offset, flip, autoUpdate, arrow } from "@floating-ui/react-dom";
|
|
46
46
|
import escape from "lodash.escape";
|
|
47
47
|
import { TransitionGroup, CSSTransition } from "react-transition-group";
|
|
48
48
|
import { css } from "@emotion/css";
|
|
@@ -294,6 +294,190 @@ const ShadowToken = {
|
|
|
294
294
|
PopOver: "--shadow-pop-over",
|
|
295
295
|
Modal: "--shadow-modal"
|
|
296
296
|
};
|
|
297
|
+
const popover = "lc-Popover-module__popover___8X1b2";
|
|
298
|
+
var cssStyles = {
|
|
299
|
+
popover,
|
|
300
|
+
"popover--visible": "lc-Popover-module__popover--visible___u5NXB"
|
|
301
|
+
};
|
|
302
|
+
const Popover = ({
|
|
303
|
+
triggerRenderer,
|
|
304
|
+
onClose,
|
|
305
|
+
children,
|
|
306
|
+
className,
|
|
307
|
+
placement,
|
|
308
|
+
flipOptions,
|
|
309
|
+
isVisible = false,
|
|
310
|
+
closeOnEsc = true
|
|
311
|
+
}) => {
|
|
312
|
+
const [visible, setVisibility] = React.useState(false);
|
|
313
|
+
const prevVisibleState = React.useRef(false);
|
|
314
|
+
const {
|
|
315
|
+
x,
|
|
316
|
+
y,
|
|
317
|
+
reference,
|
|
318
|
+
floating,
|
|
319
|
+
strategy,
|
|
320
|
+
refs,
|
|
321
|
+
update,
|
|
322
|
+
placement: updatedPlacement
|
|
323
|
+
} = useFloating({
|
|
324
|
+
middleware: [offset(4), flip(flipOptions)],
|
|
325
|
+
placement
|
|
326
|
+
});
|
|
327
|
+
React.useEffect(() => {
|
|
328
|
+
setVisibility(isVisible);
|
|
329
|
+
}, [isVisible]);
|
|
330
|
+
React.useEffect(() => {
|
|
331
|
+
if (onClose && prevVisibleState.current !== visible && !visible) {
|
|
332
|
+
onClose();
|
|
333
|
+
}
|
|
334
|
+
prevVisibleState.current = visible;
|
|
335
|
+
}, [visible]);
|
|
336
|
+
React.useEffect(() => {
|
|
337
|
+
if (!refs.reference.current || !refs.floating.current) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
return autoUpdate(refs.reference.current, refs.floating.current, update);
|
|
341
|
+
}, [refs.reference, refs.floating, update, updatedPlacement, visible]);
|
|
342
|
+
function handleDocumentClick(event) {
|
|
343
|
+
if (refs.floating.current && refs.floating.current.contains(event.target)) {
|
|
344
|
+
return;
|
|
345
|
+
} else if (refs.reference.current && refs.reference.current.contains(event.target)) {
|
|
346
|
+
setVisibility((prevVisible) => !prevVisible);
|
|
347
|
+
} else {
|
|
348
|
+
setVisibility(false);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
const handleHideOnEscape = (event) => {
|
|
352
|
+
if (event.key === "Escape") {
|
|
353
|
+
setVisibility(false);
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
React.useEffect(() => {
|
|
357
|
+
document.addEventListener("mousedown", handleDocumentClick);
|
|
358
|
+
if (closeOnEsc) {
|
|
359
|
+
document.addEventListener("keydown", handleHideOnEscape);
|
|
360
|
+
}
|
|
361
|
+
return () => {
|
|
362
|
+
document.removeEventListener("keydown", handleHideOnEscape);
|
|
363
|
+
document.removeEventListener("mousedown", handleDocumentClick);
|
|
364
|
+
};
|
|
365
|
+
}, []);
|
|
366
|
+
const mergedClassNames = cx(cssStyles["popover"], className, {
|
|
367
|
+
[cssStyles["popover--visible"]]: visible
|
|
368
|
+
});
|
|
369
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
370
|
+
style: { width: "fit-content" },
|
|
371
|
+
ref: reference
|
|
372
|
+
}, triggerRenderer()), /* @__PURE__ */ React.createElement("div", {
|
|
373
|
+
ref: floating,
|
|
374
|
+
className: mergedClassNames,
|
|
375
|
+
style: {
|
|
376
|
+
position: strategy,
|
|
377
|
+
top: y != null ? y : "",
|
|
378
|
+
left: x != null ? x : ""
|
|
379
|
+
}
|
|
380
|
+
}, children));
|
|
381
|
+
};
|
|
382
|
+
var styles$F = {
|
|
383
|
+
"action-menu__trigger-button": "lc-ActionMenu-module__action-menu__trigger-button___tBrz5",
|
|
384
|
+
"action-menu__list": "lc-ActionMenu-module__action-menu__list___9pNUX",
|
|
385
|
+
"action-menu__list__item": "lc-ActionMenu-module__action-menu__list__item___n-OgH",
|
|
386
|
+
"action-menu__list__item--with-divider": "lc-ActionMenu-module__action-menu__list__item--with-divider___2H3Vm",
|
|
387
|
+
"action-menu__list__item--disabled": "lc-ActionMenu-module__action-menu__list__item--disabled___MgaX8"
|
|
388
|
+
};
|
|
389
|
+
const KeyCodes = {
|
|
390
|
+
esc: "Escape",
|
|
391
|
+
enter: "Enter",
|
|
392
|
+
backspace: "Backspace",
|
|
393
|
+
delete: "Delete",
|
|
394
|
+
spacebar: " ",
|
|
395
|
+
tab: "Tab",
|
|
396
|
+
semicolon: ";",
|
|
397
|
+
comma: ",",
|
|
398
|
+
arrowUp: "ArrowUp",
|
|
399
|
+
arrowDown: "ArrowDown"
|
|
400
|
+
};
|
|
401
|
+
const baseClass$N = "action-menu";
|
|
402
|
+
const ActionMenu = (_a) => {
|
|
403
|
+
var _b = _a, {
|
|
404
|
+
className,
|
|
405
|
+
options,
|
|
406
|
+
triggerRenderer,
|
|
407
|
+
placement = "bottom-end"
|
|
408
|
+
} = _b, props = __objRest(_b, [
|
|
409
|
+
"className",
|
|
410
|
+
"options",
|
|
411
|
+
"triggerRenderer",
|
|
412
|
+
"placement"
|
|
413
|
+
]);
|
|
414
|
+
const [isVisible, setIsVisible] = React.useState(false);
|
|
415
|
+
const indexRef = React.useRef(-1);
|
|
416
|
+
const getIndex = (val) => {
|
|
417
|
+
indexRef.current = indexRef.current + val;
|
|
418
|
+
while (options[indexRef.current].disabled) {
|
|
419
|
+
indexRef.current = indexRef.current + val;
|
|
420
|
+
}
|
|
421
|
+
return indexRef.current;
|
|
422
|
+
};
|
|
423
|
+
const onKeyDown = (e) => {
|
|
424
|
+
var _a2, _b2;
|
|
425
|
+
if (e.key === KeyCodes.arrowUp && indexRef.current > 0) {
|
|
426
|
+
e.preventDefault();
|
|
427
|
+
indexRef.current = getIndex(-1);
|
|
428
|
+
(_a2 = document.getElementById(`list-item-${indexRef.current}`)) == null ? void 0 : _a2.focus();
|
|
429
|
+
}
|
|
430
|
+
if (e.key === KeyCodes.arrowDown && indexRef.current + 1 < options.length) {
|
|
431
|
+
e.preventDefault();
|
|
432
|
+
indexRef.current = getIndex(1);
|
|
433
|
+
(_b2 = document.getElementById(`list-item-${indexRef.current}`)) == null ? void 0 : _b2.focus();
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
React.useEffect(() => {
|
|
437
|
+
if (isVisible) {
|
|
438
|
+
document.addEventListener("keydown", onKeyDown);
|
|
439
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
440
|
+
} else {
|
|
441
|
+
indexRef.current = -1;
|
|
442
|
+
}
|
|
443
|
+
}, [isVisible, onKeyDown]);
|
|
444
|
+
const handleTriggerClick = () => {
|
|
445
|
+
setIsVisible(true);
|
|
446
|
+
};
|
|
447
|
+
const handleItemClick = (itemOnClick) => {
|
|
448
|
+
itemOnClick();
|
|
449
|
+
setIsVisible(false);
|
|
450
|
+
};
|
|
451
|
+
return /* @__PURE__ */ React.createElement(Popover, {
|
|
452
|
+
isVisible,
|
|
453
|
+
placement,
|
|
454
|
+
onClose: () => setIsVisible(false),
|
|
455
|
+
triggerRenderer: () => /* @__PURE__ */ React.createElement("button", {
|
|
456
|
+
"data-testid": "action-menu-trigger-button",
|
|
457
|
+
className: styles$F[`${baseClass$N}__trigger-button`],
|
|
458
|
+
onClick: handleTriggerClick
|
|
459
|
+
}, triggerRenderer)
|
|
460
|
+
}, /* @__PURE__ */ React.createElement("ul", __spreadProps(__spreadValues({}, props), {
|
|
461
|
+
className: cx(styles$F[`${baseClass$N}__list`], className),
|
|
462
|
+
role: "menu",
|
|
463
|
+
"aria-hidden": !isVisible
|
|
464
|
+
}), options.map((o, i) => /* @__PURE__ */ React.createElement("li", {
|
|
465
|
+
key: o.key,
|
|
466
|
+
role: "none"
|
|
467
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
468
|
+
id: `list-item-${i}`,
|
|
469
|
+
"data-testid": o.key,
|
|
470
|
+
tabIndex: -1,
|
|
471
|
+
key: o.key,
|
|
472
|
+
disabled: o.disabled,
|
|
473
|
+
onClick: () => handleItemClick(o.onClick),
|
|
474
|
+
role: "menuitem",
|
|
475
|
+
className: cx(styles$F[`${baseClass$N}__list__item`], {
|
|
476
|
+
[styles$F[`${baseClass$N}__list__item--disabled`]]: o.disabled,
|
|
477
|
+
[styles$F[`${baseClass$N}__list__item--with-divider`]]: o.withDivider
|
|
478
|
+
})
|
|
479
|
+
}, o.element)))));
|
|
480
|
+
};
|
|
297
481
|
const caps = "lc-Typography-module__caps___c3eNJ";
|
|
298
482
|
var styles$E = {
|
|
299
483
|
"heading-xl": "lc-Typography-module__heading-xl___nhr-6",
|
|
@@ -319,13 +503,13 @@ const SIZE_TO_ELEMENT_MAP = {
|
|
|
319
503
|
sm: "h4",
|
|
320
504
|
xs: "h5"
|
|
321
505
|
};
|
|
322
|
-
const Heading = (
|
|
323
|
-
var
|
|
506
|
+
const Heading = (_c) => {
|
|
507
|
+
var _d = _c, {
|
|
324
508
|
as,
|
|
325
509
|
size = "md",
|
|
326
510
|
children,
|
|
327
511
|
className
|
|
328
|
-
} =
|
|
512
|
+
} = _d, props = __objRest(_d, [
|
|
329
513
|
"as",
|
|
330
514
|
"size",
|
|
331
515
|
"children",
|
|
@@ -333,8 +517,8 @@ const Heading = (_a) => {
|
|
|
333
517
|
]);
|
|
334
518
|
return React.createElement(as || SIZE_TO_ELEMENT_MAP[size], __spreadValues({ className: cx(styles$E[`heading-${size}`], className) }, props), children);
|
|
335
519
|
};
|
|
336
|
-
const Text = (
|
|
337
|
-
var
|
|
520
|
+
const Text = (_e) => {
|
|
521
|
+
var _f = _e, {
|
|
338
522
|
as = "p",
|
|
339
523
|
size = "md",
|
|
340
524
|
caps: caps2 = false,
|
|
@@ -343,7 +527,7 @@ const Text = (_c) => {
|
|
|
343
527
|
strike = false,
|
|
344
528
|
children,
|
|
345
529
|
className
|
|
346
|
-
} =
|
|
530
|
+
} = _f, props = __objRest(_f, [
|
|
347
531
|
"as",
|
|
348
532
|
"size",
|
|
349
533
|
"caps",
|
|
@@ -466,13 +650,13 @@ const IconConfig = {
|
|
|
466
650
|
}
|
|
467
651
|
};
|
|
468
652
|
const baseClass$L = "alert";
|
|
469
|
-
const Alert = (
|
|
470
|
-
var
|
|
653
|
+
const Alert = (_g) => {
|
|
654
|
+
var _h = _g, {
|
|
471
655
|
children,
|
|
472
656
|
className,
|
|
473
657
|
kind = "info",
|
|
474
658
|
onClose
|
|
475
|
-
} =
|
|
659
|
+
} = _h, props = __objRest(_h, [
|
|
476
660
|
"children",
|
|
477
661
|
"className",
|
|
478
662
|
"kind",
|
|
@@ -640,15 +824,15 @@ function formatCount(count, max) {
|
|
|
640
824
|
return count > max ? `${max}+` : `${count}`;
|
|
641
825
|
}
|
|
642
826
|
const baseClass$J = "badge";
|
|
643
|
-
const Badge = (
|
|
644
|
-
var
|
|
827
|
+
const Badge = (_i) => {
|
|
828
|
+
var _j = _i, {
|
|
645
829
|
className,
|
|
646
830
|
count = 0,
|
|
647
831
|
max = 99,
|
|
648
832
|
kind = "primary",
|
|
649
833
|
size = "medium",
|
|
650
834
|
type = "counter"
|
|
651
|
-
} =
|
|
835
|
+
} = _j, spanProps = __objRest(_j, [
|
|
652
836
|
"className",
|
|
653
837
|
"count",
|
|
654
838
|
"max",
|
|
@@ -726,6 +910,7 @@ var styles$y = {
|
|
|
726
910
|
"btn--plain": "lc-Button-module__btn--plain___eOPui",
|
|
727
911
|
"btn--plain-light": "lc-Button-module__btn--plain-light___eS9em",
|
|
728
912
|
"btn--subtle": "lc-Button-module__btn--subtle___s22xR",
|
|
913
|
+
"btn--float": "lc-Button-module__btn--float___J4lTs",
|
|
729
914
|
"btn--loading": "lc-Button-module__btn--loading___ZAgjv",
|
|
730
915
|
btn__loader,
|
|
731
916
|
btn__content,
|
|
@@ -735,8 +920,8 @@ var styles$y = {
|
|
|
735
920
|
"btn--icon-only--bg": "lc-Button-module__btn--icon-only--bg___X-4V2"
|
|
736
921
|
};
|
|
737
922
|
const baseClass$H = "btn";
|
|
738
|
-
const Button = React.forwardRef((
|
|
739
|
-
var
|
|
923
|
+
const Button = React.forwardRef((_k, ref) => {
|
|
924
|
+
var _l = _k, {
|
|
740
925
|
loading = false,
|
|
741
926
|
disabled = false,
|
|
742
927
|
type = "button",
|
|
@@ -750,7 +935,7 @@ const Button = React.forwardRef((_i, ref) => {
|
|
|
750
935
|
children,
|
|
751
936
|
href,
|
|
752
937
|
onClick
|
|
753
|
-
} =
|
|
938
|
+
} = _l, props = __objRest(_l, [
|
|
754
939
|
"loading",
|
|
755
940
|
"disabled",
|
|
756
941
|
"type",
|
|
@@ -889,8 +1074,8 @@ const headerClass = `${baseClass$F}__header`;
|
|
|
889
1074
|
const headingClass = `${headerClass}__heading`;
|
|
890
1075
|
const actionsClass = `${baseClass$F}__actions`;
|
|
891
1076
|
const noImageClass = `${headerClass}__no-image`;
|
|
892
|
-
const Card = (
|
|
893
|
-
var
|
|
1077
|
+
const Card = (_m) => {
|
|
1078
|
+
var _n = _m, {
|
|
894
1079
|
alt,
|
|
895
1080
|
buttonsOptions = [],
|
|
896
1081
|
children,
|
|
@@ -899,7 +1084,7 @@ const Card = (_k) => {
|
|
|
899
1084
|
expandableContent,
|
|
900
1085
|
src,
|
|
901
1086
|
title
|
|
902
|
-
} =
|
|
1087
|
+
} = _n, divProps = __objRest(_n, [
|
|
903
1088
|
"alt",
|
|
904
1089
|
"buttonsOptions",
|
|
905
1090
|
"children",
|
|
@@ -966,11 +1151,11 @@ var styles$v = {
|
|
|
966
1151
|
"field-description": "lc-FieldDescription-module__field-description___IcRDH"
|
|
967
1152
|
};
|
|
968
1153
|
const baseClass$E = "field-description";
|
|
969
|
-
const FieldDescription = (
|
|
970
|
-
var
|
|
1154
|
+
const FieldDescription = (_o) => {
|
|
1155
|
+
var _p = _o, {
|
|
971
1156
|
children,
|
|
972
1157
|
className = ""
|
|
973
|
-
} =
|
|
1158
|
+
} = _p, props = __objRest(_p, [
|
|
974
1159
|
"children",
|
|
975
1160
|
"className"
|
|
976
1161
|
]);
|
|
@@ -1001,8 +1186,8 @@ var styles$u = {
|
|
|
1001
1186
|
checkbox__helper
|
|
1002
1187
|
};
|
|
1003
1188
|
const baseClass$D = "checkbox";
|
|
1004
|
-
const Checkbox = React.forwardRef((
|
|
1005
|
-
var
|
|
1189
|
+
const Checkbox = React.forwardRef((_q, ref) => {
|
|
1190
|
+
var _r = _q, { checked, disabled, children, description, className } = _r, restInputProps = __objRest(_r, ["checked", "disabled", "children", "description", "className"]);
|
|
1006
1191
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1007
1192
|
className: cx(styles$u[baseClass$D], className, {
|
|
1008
1193
|
[styles$u[`${baseClass$D}--selected`]]: checked,
|
|
@@ -1597,11 +1782,11 @@ var styles$s = {
|
|
|
1597
1782
|
"field-error": "lc-FieldError-module__field-error___IDkPT"
|
|
1598
1783
|
};
|
|
1599
1784
|
const baseClass$z = "field-error";
|
|
1600
|
-
const FieldError = (
|
|
1601
|
-
var
|
|
1785
|
+
const FieldError = (_s) => {
|
|
1786
|
+
var _t = _s, {
|
|
1602
1787
|
children,
|
|
1603
1788
|
className = ""
|
|
1604
|
-
} =
|
|
1789
|
+
} = _t, props = __objRest(_t, [
|
|
1605
1790
|
"children",
|
|
1606
1791
|
"className"
|
|
1607
1792
|
]);
|
|
@@ -1619,15 +1804,15 @@ var styles$r = {
|
|
|
1619
1804
|
"field-group--stretched": "lc-FieldGroup-module__field-group--stretched___6rkuO"
|
|
1620
1805
|
};
|
|
1621
1806
|
const baseClass$y = "field-group";
|
|
1622
|
-
const FieldGroup = (
|
|
1623
|
-
var
|
|
1807
|
+
const FieldGroup = (_u) => {
|
|
1808
|
+
var _v = _u, {
|
|
1624
1809
|
className = "",
|
|
1625
1810
|
children,
|
|
1626
1811
|
description,
|
|
1627
1812
|
error,
|
|
1628
1813
|
inline,
|
|
1629
1814
|
stretch
|
|
1630
|
-
} =
|
|
1815
|
+
} = _v, props = __objRest(_v, [
|
|
1631
1816
|
"className",
|
|
1632
1817
|
"children",
|
|
1633
1818
|
"description",
|
|
@@ -1656,14 +1841,14 @@ var styles$q = {
|
|
|
1656
1841
|
form__helper
|
|
1657
1842
|
};
|
|
1658
1843
|
const baseClass$x = "form";
|
|
1659
|
-
const Form = (
|
|
1660
|
-
var
|
|
1844
|
+
const Form = (_w) => {
|
|
1845
|
+
var _x = _w, {
|
|
1661
1846
|
className,
|
|
1662
1847
|
children,
|
|
1663
1848
|
labelText,
|
|
1664
1849
|
helperText,
|
|
1665
1850
|
formFooter
|
|
1666
|
-
} =
|
|
1851
|
+
} = _x, restProps = __objRest(_x, [
|
|
1667
1852
|
"className",
|
|
1668
1853
|
"children",
|
|
1669
1854
|
"labelText",
|
|
@@ -1748,13 +1933,13 @@ var styles$o = {
|
|
|
1748
1933
|
"form-group__helper": "lc-FormGroup-module__form-group__helper___SRuxe"
|
|
1749
1934
|
};
|
|
1750
1935
|
const baseClass$v = "form-group";
|
|
1751
|
-
const FormGroup = (
|
|
1752
|
-
var
|
|
1936
|
+
const FormGroup = (_y) => {
|
|
1937
|
+
var _z = _y, {
|
|
1753
1938
|
className = "",
|
|
1754
1939
|
children,
|
|
1755
1940
|
labelText,
|
|
1756
1941
|
helperText
|
|
1757
|
-
} =
|
|
1942
|
+
} = _z, props = __objRest(_z, [
|
|
1758
1943
|
"className",
|
|
1759
1944
|
"children",
|
|
1760
1945
|
"labelText",
|
|
@@ -1798,14 +1983,14 @@ const renderIcon = (icon2, disabled) => React.cloneElement(icon2.source, {
|
|
|
1798
1983
|
[styles$n[`${baseClass$u}__icon--disabled`]]: disabled
|
|
1799
1984
|
})
|
|
1800
1985
|
});
|
|
1801
|
-
const Input = React.forwardRef((
|
|
1802
|
-
var
|
|
1986
|
+
const Input = React.forwardRef((_A, ref) => {
|
|
1987
|
+
var _B = _A, {
|
|
1803
1988
|
inputSize = "medium",
|
|
1804
1989
|
error = false,
|
|
1805
1990
|
disabled,
|
|
1806
1991
|
icon: icon2 = null,
|
|
1807
1992
|
className
|
|
1808
|
-
} =
|
|
1993
|
+
} = _B, inputProps = __objRest(_B, [
|
|
1809
1994
|
"inputSize",
|
|
1810
1995
|
"error",
|
|
1811
1996
|
"disabled",
|
|
@@ -1859,11 +2044,11 @@ var styles$m = {
|
|
|
1859
2044
|
"link--bold": "lc-Link-module__link--bold___1rGdO"
|
|
1860
2045
|
};
|
|
1861
2046
|
const baseClass$t = "link";
|
|
1862
|
-
const Link = (
|
|
1863
|
-
var
|
|
2047
|
+
const Link = (_C) => {
|
|
2048
|
+
var _D = _C, {
|
|
1864
2049
|
bold = false,
|
|
1865
2050
|
className = ""
|
|
1866
|
-
} =
|
|
2051
|
+
} = _D, rest = __objRest(_D, [
|
|
1867
2052
|
"bold",
|
|
1868
2053
|
"className"
|
|
1869
2054
|
]);
|
|
@@ -1871,18 +2056,6 @@ const Link = (_A) => {
|
|
|
1871
2056
|
className: cx(styles$m[baseClass$t], bold && styles$m[`${baseClass$t}--bold`], className)
|
|
1872
2057
|
}, rest));
|
|
1873
2058
|
};
|
|
1874
|
-
const KeyCodes = {
|
|
1875
|
-
esc: "Escape",
|
|
1876
|
-
enter: "Enter",
|
|
1877
|
-
backspace: "Backspace",
|
|
1878
|
-
delete: "Delete",
|
|
1879
|
-
spacebar: " ",
|
|
1880
|
-
tab: "Tab",
|
|
1881
|
-
semicolon: ";",
|
|
1882
|
-
comma: ",",
|
|
1883
|
-
arrowUp: "ArrowUp",
|
|
1884
|
-
arrowDown: "ArrowDown"
|
|
1885
|
-
};
|
|
1886
2059
|
const modal__header = "lc-Modal-module__modal__header___Fp5VE";
|
|
1887
2060
|
const modal__heading = "lc-Modal-module__modal__heading___G9KVK";
|
|
1888
2061
|
const modal__body = "lc-Modal-module__modal__body___M-jmN";
|
|
@@ -1902,14 +2075,14 @@ var styles$l = {
|
|
|
1902
2075
|
modal__footer
|
|
1903
2076
|
};
|
|
1904
2077
|
const baseClass$s = "modal-base";
|
|
1905
|
-
const ModalBase = (
|
|
1906
|
-
var
|
|
2078
|
+
const ModalBase = (_E) => {
|
|
2079
|
+
var _F = _E, {
|
|
1907
2080
|
children,
|
|
1908
2081
|
className = "",
|
|
1909
2082
|
onClose,
|
|
1910
2083
|
closeOnEscPress = true,
|
|
1911
2084
|
closeOnOverlayPress = true
|
|
1912
|
-
} =
|
|
2085
|
+
} = _F, props = __objRest(_F, [
|
|
1913
2086
|
"children",
|
|
1914
2087
|
"className",
|
|
1915
2088
|
"onClose",
|
|
@@ -1959,8 +2132,8 @@ const ModalCloseButton = ({
|
|
|
1959
2132
|
customColor
|
|
1960
2133
|
}));
|
|
1961
2134
|
const baseClass$r = "modal";
|
|
1962
|
-
const Modal = (
|
|
1963
|
-
var
|
|
2135
|
+
const Modal = (_G) => {
|
|
2136
|
+
var _H = _G, {
|
|
1964
2137
|
children,
|
|
1965
2138
|
className = "",
|
|
1966
2139
|
heading,
|
|
@@ -1968,7 +2141,7 @@ const Modal = (_E) => {
|
|
|
1968
2141
|
fullSpaceContent,
|
|
1969
2142
|
footer,
|
|
1970
2143
|
onClose
|
|
1971
|
-
} =
|
|
2144
|
+
} = _H, props = __objRest(_H, [
|
|
1972
2145
|
"children",
|
|
1973
2146
|
"className",
|
|
1974
2147
|
"heading",
|
|
@@ -2043,8 +2216,8 @@ var styles$k = {
|
|
|
2043
2216
|
"numeric-input--error": "lc-NumericInput-module__numeric-input--error___TMxRx"
|
|
2044
2217
|
};
|
|
2045
2218
|
const baseClass$q = "numeric-input";
|
|
2046
|
-
const NumericInput = (
|
|
2047
|
-
var
|
|
2219
|
+
const NumericInput = (_I) => {
|
|
2220
|
+
var _J = _I, {
|
|
2048
2221
|
className,
|
|
2049
2222
|
error,
|
|
2050
2223
|
value,
|
|
@@ -2054,7 +2227,7 @@ const NumericInput = (_G) => {
|
|
|
2054
2227
|
noControls,
|
|
2055
2228
|
style,
|
|
2056
2229
|
onChange
|
|
2057
|
-
} =
|
|
2230
|
+
} = _J, restProps = __objRest(_J, [
|
|
2058
2231
|
"className",
|
|
2059
2232
|
"error",
|
|
2060
2233
|
"value",
|
|
@@ -2181,6 +2354,7 @@ const Trigger = ({
|
|
|
2181
2354
|
isRequired,
|
|
2182
2355
|
isMultiSelect,
|
|
2183
2356
|
size = "medium",
|
|
2357
|
+
hideClearButton,
|
|
2184
2358
|
onTrigger,
|
|
2185
2359
|
onClear
|
|
2186
2360
|
}) => {
|
|
@@ -2209,6 +2383,7 @@ const Trigger = ({
|
|
|
2209
2383
|
e.stopPropagation();
|
|
2210
2384
|
onClear();
|
|
2211
2385
|
};
|
|
2386
|
+
const shouldShowClearButton = !hideClearButton && isItemSelected && !isDisabled && !isRequired;
|
|
2212
2387
|
return /* @__PURE__ */ React.createElement("div", {
|
|
2213
2388
|
ref: triggerRef,
|
|
2214
2389
|
className: mergedClassNames,
|
|
@@ -2218,7 +2393,7 @@ const Trigger = ({
|
|
|
2218
2393
|
className: styles$j[`${baseClass$p}__content`]
|
|
2219
2394
|
}, children), /* @__PURE__ */ React.createElement("div", {
|
|
2220
2395
|
className: cx(styles$j[`${baseClass$p}__controls`], styles$j[`${baseClass$p}__controls--${size}`])
|
|
2221
|
-
},
|
|
2396
|
+
}, shouldShowClearButton && /* @__PURE__ */ React.createElement("div", {
|
|
2222
2397
|
"data-testid": `${baseClass$p}__clear-icon`,
|
|
2223
2398
|
className: styles$j[`${baseClass$p}__clear-icon`],
|
|
2224
2399
|
onClick: handleOnClearClick
|
|
@@ -2447,8 +2622,8 @@ const getCustomTextClass = (customColor) => {
|
|
|
2447
2622
|
}
|
|
2448
2623
|
return getContrast(customColor, "#FFFFFF") > 4.5 ? "text-white" : "text-black";
|
|
2449
2624
|
};
|
|
2450
|
-
const Tag = (
|
|
2451
|
-
var
|
|
2625
|
+
const Tag = (_K) => {
|
|
2626
|
+
var _L = _K, {
|
|
2452
2627
|
className = "",
|
|
2453
2628
|
children,
|
|
2454
2629
|
dismissible = false,
|
|
@@ -2460,7 +2635,7 @@ const Tag = (_I) => {
|
|
|
2460
2635
|
icon: icon2,
|
|
2461
2636
|
avatar: avatar2,
|
|
2462
2637
|
customColor
|
|
2463
|
-
} =
|
|
2638
|
+
} = _L, restProps = __objRest(_L, [
|
|
2464
2639
|
"className",
|
|
2465
2640
|
"children",
|
|
2466
2641
|
"dismissible",
|
|
@@ -2587,8 +2762,8 @@ const TriggerBody = ({
|
|
|
2587
2762
|
}), shouldDisplaySearch && getSearch());
|
|
2588
2763
|
};
|
|
2589
2764
|
const baseClass$l = "picker";
|
|
2590
|
-
const Picker = (
|
|
2591
|
-
var
|
|
2765
|
+
const Picker = (_M) => {
|
|
2766
|
+
var _N = _M, {
|
|
2592
2767
|
className,
|
|
2593
2768
|
disabled,
|
|
2594
2769
|
error,
|
|
@@ -2602,8 +2777,9 @@ const Picker = (_K) => {
|
|
|
2602
2777
|
selectAllOptionText,
|
|
2603
2778
|
type = "single",
|
|
2604
2779
|
searchDisabled = false,
|
|
2780
|
+
hideClearButton,
|
|
2605
2781
|
onSelect
|
|
2606
|
-
} =
|
|
2782
|
+
} = _N, props = __objRest(_N, [
|
|
2607
2783
|
"className",
|
|
2608
2784
|
"disabled",
|
|
2609
2785
|
"error",
|
|
@@ -2617,6 +2793,7 @@ const Picker = (_K) => {
|
|
|
2617
2793
|
"selectAllOptionText",
|
|
2618
2794
|
"type",
|
|
2619
2795
|
"searchDisabled",
|
|
2796
|
+
"hideClearButton",
|
|
2620
2797
|
"onSelect"
|
|
2621
2798
|
]);
|
|
2622
2799
|
const [isListOpen, setIsListOpen] = React.useState(false);
|
|
@@ -2724,6 +2901,7 @@ const Picker = (_K) => {
|
|
|
2724
2901
|
isRequired,
|
|
2725
2902
|
isMultiSelect: type === "multi",
|
|
2726
2903
|
size,
|
|
2904
|
+
hideClearButton,
|
|
2727
2905
|
onTrigger: handleTrigger,
|
|
2728
2906
|
onClear: handleClear
|
|
2729
2907
|
}, /* @__PURE__ */ React.createElement(TriggerBody, {
|
|
@@ -2748,89 +2926,6 @@ const Picker = (_K) => {
|
|
|
2748
2926
|
onSelectAll: handleSelectAll
|
|
2749
2927
|
})));
|
|
2750
2928
|
};
|
|
2751
|
-
const popover = "lc-Popover-module__popover___8X1b2";
|
|
2752
|
-
var cssStyles = {
|
|
2753
|
-
popover,
|
|
2754
|
-
"popover--visible": "lc-Popover-module__popover--visible___u5NXB"
|
|
2755
|
-
};
|
|
2756
|
-
const Popover = (props) => {
|
|
2757
|
-
const {
|
|
2758
|
-
triggerRenderer,
|
|
2759
|
-
onClose,
|
|
2760
|
-
children,
|
|
2761
|
-
className,
|
|
2762
|
-
placement,
|
|
2763
|
-
flipOptions,
|
|
2764
|
-
isVisible = false
|
|
2765
|
-
} = props;
|
|
2766
|
-
const [visible, setVisibility] = React.useState(false);
|
|
2767
|
-
const prevVisibleState = React.useRef(false);
|
|
2768
|
-
const {
|
|
2769
|
-
x,
|
|
2770
|
-
y,
|
|
2771
|
-
reference,
|
|
2772
|
-
floating,
|
|
2773
|
-
strategy,
|
|
2774
|
-
refs,
|
|
2775
|
-
update,
|
|
2776
|
-
placement: updatedPlacement
|
|
2777
|
-
} = useFloating({
|
|
2778
|
-
middleware: [offset(4), flip(flipOptions)],
|
|
2779
|
-
placement
|
|
2780
|
-
});
|
|
2781
|
-
React.useEffect(() => {
|
|
2782
|
-
setVisibility(isVisible);
|
|
2783
|
-
}, [isVisible]);
|
|
2784
|
-
React.useEffect(() => {
|
|
2785
|
-
if (onClose && prevVisibleState.current !== visible && !visible) {
|
|
2786
|
-
onClose();
|
|
2787
|
-
}
|
|
2788
|
-
prevVisibleState.current = visible;
|
|
2789
|
-
}, [visible]);
|
|
2790
|
-
React.useEffect(() => {
|
|
2791
|
-
if (!refs.reference.current || !refs.floating.current) {
|
|
2792
|
-
return;
|
|
2793
|
-
}
|
|
2794
|
-
return autoUpdate(refs.reference.current, refs.floating.current, update);
|
|
2795
|
-
}, [refs.reference, refs.floating, update, updatedPlacement, visible]);
|
|
2796
|
-
function handleDocumentClick(event) {
|
|
2797
|
-
if (refs.floating.current && refs.floating.current.contains(event.target)) {
|
|
2798
|
-
return;
|
|
2799
|
-
} else if (refs.reference.current && refs.reference.current.contains(event.target)) {
|
|
2800
|
-
setVisibility((prevVisible) => !prevVisible);
|
|
2801
|
-
} else {
|
|
2802
|
-
setVisibility(false);
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
const handleHideOnEscape = (event) => {
|
|
2806
|
-
if (event.key === "Escape") {
|
|
2807
|
-
setVisibility(false);
|
|
2808
|
-
}
|
|
2809
|
-
};
|
|
2810
|
-
React.useEffect(() => {
|
|
2811
|
-
document.addEventListener("keydown", handleHideOnEscape);
|
|
2812
|
-
document.addEventListener("mousedown", handleDocumentClick);
|
|
2813
|
-
return () => {
|
|
2814
|
-
document.removeEventListener("keydown", handleHideOnEscape);
|
|
2815
|
-
document.removeEventListener("mousedown", handleDocumentClick);
|
|
2816
|
-
};
|
|
2817
|
-
}, []);
|
|
2818
|
-
const mergedClassNames = cx(cssStyles["popover"], className, {
|
|
2819
|
-
[cssStyles["popover--visible"]]: visible
|
|
2820
|
-
});
|
|
2821
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
2822
|
-
style: { width: "fit-content" },
|
|
2823
|
-
ref: reference
|
|
2824
|
-
}, triggerRenderer()), /* @__PURE__ */ React.createElement("div", {
|
|
2825
|
-
ref: floating,
|
|
2826
|
-
className: mergedClassNames,
|
|
2827
|
-
style: {
|
|
2828
|
-
position: strategy,
|
|
2829
|
-
top: y != null ? y : "",
|
|
2830
|
-
left: x != null ? x : ""
|
|
2831
|
-
}
|
|
2832
|
-
}, children));
|
|
2833
|
-
};
|
|
2834
2929
|
const PROGRESS_STATUSES = [
|
|
2835
2930
|
"normal",
|
|
2836
2931
|
"error",
|
|
@@ -2876,13 +2971,13 @@ const SIZE_VALUE_FROM_SIZE = {
|
|
|
2876
2971
|
large: 56
|
|
2877
2972
|
};
|
|
2878
2973
|
const baseClass$k = "progress-circle";
|
|
2879
|
-
const ProgressCircle = React.forwardRef((
|
|
2880
|
-
var
|
|
2974
|
+
const ProgressCircle = React.forwardRef((_O, ref) => {
|
|
2975
|
+
var _P = _O, {
|
|
2881
2976
|
status = "normal",
|
|
2882
2977
|
progressValue,
|
|
2883
2978
|
className,
|
|
2884
2979
|
size = "medium"
|
|
2885
|
-
} =
|
|
2980
|
+
} = _P, restProps = __objRest(_P, [
|
|
2886
2981
|
"status",
|
|
2887
2982
|
"progressValue",
|
|
2888
2983
|
"className",
|
|
@@ -2937,13 +3032,13 @@ var styles$d = {
|
|
|
2937
3032
|
"progress-bar__indicator--normal": "lc-ProgressBar-module__progress-bar__indicator--normal___0Uhle"
|
|
2938
3033
|
};
|
|
2939
3034
|
const baseClass$j = "progress-bar";
|
|
2940
|
-
const ProgressBar = React.forwardRef((
|
|
2941
|
-
var
|
|
3035
|
+
const ProgressBar = React.forwardRef((_Q, ref) => {
|
|
3036
|
+
var _R = _Q, {
|
|
2942
3037
|
status = "normal",
|
|
2943
3038
|
percent,
|
|
2944
3039
|
size = "medium",
|
|
2945
3040
|
className = ""
|
|
2946
|
-
} =
|
|
3041
|
+
} = _R, restProps = __objRest(_R, [
|
|
2947
3042
|
"status",
|
|
2948
3043
|
"percent",
|
|
2949
3044
|
"size",
|
|
@@ -3064,8 +3159,8 @@ var styles$b = {
|
|
|
3064
3159
|
"radio-button--disabled": "lc-RadioButton-module__radio-button--disabled___wHSA7"
|
|
3065
3160
|
};
|
|
3066
3161
|
const baseClass$h = "radio-button";
|
|
3067
|
-
const RadioButton = React.forwardRef((
|
|
3068
|
-
var
|
|
3162
|
+
const RadioButton = React.forwardRef((_S, ref) => {
|
|
3163
|
+
var _T = _S, { children, className = "", description, checked, disabled } = _T, props = __objRest(_T, ["children", "className", "description", "checked", "disabled"]);
|
|
3069
3164
|
const mergedClassNames = cx(styles$b[baseClass$h], className, {
|
|
3070
3165
|
[styles$b[`${baseClass$h}--selected`]]: checked,
|
|
3071
3166
|
[styles$b[`${baseClass$h}--disabled`]]: disabled
|
|
@@ -3231,8 +3326,8 @@ var styles$9 = {
|
|
|
3231
3326
|
switch__icon
|
|
3232
3327
|
};
|
|
3233
3328
|
const baseClass$f = "switch";
|
|
3234
|
-
const Switch = (
|
|
3235
|
-
var
|
|
3329
|
+
const Switch = (_U) => {
|
|
3330
|
+
var _V = _U, {
|
|
3236
3331
|
className = "",
|
|
3237
3332
|
defaultOn = false,
|
|
3238
3333
|
disabled = false,
|
|
@@ -3243,7 +3338,7 @@ const Switch = (_S) => {
|
|
|
3243
3338
|
state = "regular",
|
|
3244
3339
|
innerRef,
|
|
3245
3340
|
ariaLabel
|
|
3246
|
-
} =
|
|
3341
|
+
} = _V, props = __objRest(_V, [
|
|
3247
3342
|
"className",
|
|
3248
3343
|
"defaultOn",
|
|
3249
3344
|
"disabled",
|
|
@@ -3318,15 +3413,15 @@ var styles$8 = {
|
|
|
3318
3413
|
"tab--disabled": "lc-Tab-module__tab--disabled___URdTh"
|
|
3319
3414
|
};
|
|
3320
3415
|
const baseClass$e = "tab";
|
|
3321
|
-
const Tab = (
|
|
3322
|
-
var
|
|
3416
|
+
const Tab = (_W) => {
|
|
3417
|
+
var _X = _W, {
|
|
3323
3418
|
children,
|
|
3324
3419
|
className,
|
|
3325
3420
|
count,
|
|
3326
3421
|
isSelected,
|
|
3327
3422
|
asBadge,
|
|
3328
3423
|
size = "medium"
|
|
3329
|
-
} =
|
|
3424
|
+
} = _X, restProps = __objRest(_X, [
|
|
3330
3425
|
"children",
|
|
3331
3426
|
"className",
|
|
3332
3427
|
"count",
|
|
@@ -3625,15 +3720,15 @@ const iconConfig = {
|
|
|
3625
3720
|
}
|
|
3626
3721
|
};
|
|
3627
3722
|
const baseClass$a = "toast";
|
|
3628
|
-
const Toast = (
|
|
3629
|
-
var
|
|
3723
|
+
const Toast = (_Y) => {
|
|
3724
|
+
var _Z = _Y, {
|
|
3630
3725
|
action,
|
|
3631
3726
|
className,
|
|
3632
3727
|
children,
|
|
3633
3728
|
removable,
|
|
3634
3729
|
kind = "info",
|
|
3635
3730
|
onClose
|
|
3636
|
-
} =
|
|
3731
|
+
} = _Z, divProps = __objRest(_Z, [
|
|
3637
3732
|
"action",
|
|
3638
3733
|
"className",
|
|
3639
3734
|
"children",
|
|
@@ -4178,8 +4273,8 @@ var styles$3 = {
|
|
|
4178
4273
|
"textarea--error": "lc-Textarea-module__textarea--error___0EGuq"
|
|
4179
4274
|
};
|
|
4180
4275
|
const baseClass$3 = "textarea";
|
|
4181
|
-
const Textarea = React.forwardRef((
|
|
4182
|
-
var
|
|
4276
|
+
const Textarea = React.forwardRef((__, ref) => {
|
|
4277
|
+
var _$ = __, { className, error } = _$, textareaProps = __objRest(_$, ["className", "error"]);
|
|
4183
4278
|
const { disabled } = textareaProps;
|
|
4184
4279
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
4185
4280
|
const mergedClassNames = cx(className, styles$3[baseClass$3], {
|
|
@@ -4410,4 +4505,4 @@ const UploadBar = ({
|
|
|
4410
4505
|
className: styles[`${baseClass}__files__list`]
|
|
4411
4506
|
}, children))))));
|
|
4412
4507
|
};
|
|
4413
|
-
export { ANIMATION_TIME, Alert, Avatar, Badge, Button, Card, Checkbox, DatePicker, DesignToken, EmailTagInput, FieldDescription, FieldError, FieldGroup, FileUploadProgress, FileUploadProgressActions, Form, FormField, FormGroup, Heading, Icon, Info, Input, Interactive, Link, Loader, Modal, ModalBase, ModalCloseButton, ModalPortal, NumericInput, Picker, PickerList, Popover, ProgressBar, ProgressCircle, PromoBanner, RadioButton, RangeDatePicker, SearchInput, SegmentedControl, ShadowToken, Simple, SpacingToken, Switch, Tab, TabsList, TabsWrapper, Tag, TagInput, Text, Textarea, Toast, ToastWrapper, Tooltip, UploadBar, UserGuide };
|
|
4508
|
+
export { ANIMATION_TIME, ActionMenu, Alert, Avatar, Badge, Button, Card, Checkbox, DatePicker, DesignToken, EmailTagInput, FieldDescription, FieldError, FieldGroup, FileUploadProgress, FileUploadProgressActions, Form, FormField, FormGroup, Heading, Icon, Info, Input, Interactive, Link, Loader, Modal, ModalBase, ModalCloseButton, ModalPortal, NumericInput, Picker, PickerList, Popover, ProgressBar, ProgressCircle, PromoBanner, RadioButton, RangeDatePicker, SearchInput, SegmentedControl, ShadowToken, Simple, SpacingToken, Switch, Tab, TabsList, TabsWrapper, Tag, TagInput, Text, Textarea, Toast, ToastWrapper, Tooltip, UploadBar, UserGuide };
|