@livechat/design-system-react-components 1.0.0-alpha.50 → 1.0.0-alpha.52

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
@@ -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,188 @@ 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 = (props) => {
303
+ const {
304
+ triggerRenderer,
305
+ onClose,
306
+ children,
307
+ className,
308
+ placement,
309
+ flipOptions,
310
+ isVisible = false
311
+ } = props;
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("keydown", handleHideOnEscape);
358
+ document.addEventListener("mousedown", handleDocumentClick);
359
+ return () => {
360
+ document.removeEventListener("keydown", handleHideOnEscape);
361
+ document.removeEventListener("mousedown", handleDocumentClick);
362
+ };
363
+ }, []);
364
+ const mergedClassNames = cx(cssStyles["popover"], className, {
365
+ [cssStyles["popover--visible"]]: visible
366
+ });
367
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
368
+ style: { width: "fit-content" },
369
+ ref: reference
370
+ }, triggerRenderer()), /* @__PURE__ */ React.createElement("div", {
371
+ ref: floating,
372
+ className: mergedClassNames,
373
+ style: {
374
+ position: strategy,
375
+ top: y != null ? y : "",
376
+ left: x != null ? x : ""
377
+ }
378
+ }, children));
379
+ };
380
+ var styles$F = {
381
+ "action-menu__trigger-button": "lc-ActionMenu-module__action-menu__trigger-button___tBrz5",
382
+ "action-menu__list": "lc-ActionMenu-module__action-menu__list___9pNUX",
383
+ "action-menu__list__item": "lc-ActionMenu-module__action-menu__list__item___n-OgH",
384
+ "action-menu__list__item--with-divider": "lc-ActionMenu-module__action-menu__list__item--with-divider___2H3Vm",
385
+ "action-menu__list__item--disabled": "lc-ActionMenu-module__action-menu__list__item--disabled___MgaX8"
386
+ };
387
+ const KeyCodes = {
388
+ esc: "Escape",
389
+ enter: "Enter",
390
+ backspace: "Backspace",
391
+ delete: "Delete",
392
+ spacebar: " ",
393
+ tab: "Tab",
394
+ semicolon: ";",
395
+ comma: ",",
396
+ arrowUp: "ArrowUp",
397
+ arrowDown: "ArrowDown"
398
+ };
399
+ const baseClass$N = "action-menu";
400
+ const ActionMenu = (_a) => {
401
+ var _b = _a, {
402
+ className,
403
+ options,
404
+ triggerRenderer,
405
+ placement = "bottom-end"
406
+ } = _b, props = __objRest(_b, [
407
+ "className",
408
+ "options",
409
+ "triggerRenderer",
410
+ "placement"
411
+ ]);
412
+ const [isVisible, setIsVisible] = React.useState(false);
413
+ const indexRef = React.useRef(-1);
414
+ const getIndex = (val) => {
415
+ indexRef.current = indexRef.current + val;
416
+ while (options[indexRef.current].disabled) {
417
+ indexRef.current = indexRef.current + val;
418
+ }
419
+ return indexRef.current;
420
+ };
421
+ const onKeyDown = (e) => {
422
+ var _a2, _b2;
423
+ if (e.key === KeyCodes.arrowUp && indexRef.current > 0) {
424
+ e.preventDefault();
425
+ indexRef.current = getIndex(-1);
426
+ (_a2 = document.getElementById(`list-item-${indexRef.current}`)) == null ? void 0 : _a2.focus();
427
+ }
428
+ if (e.key === KeyCodes.arrowDown && indexRef.current + 1 < options.length) {
429
+ e.preventDefault();
430
+ indexRef.current = getIndex(1);
431
+ (_b2 = document.getElementById(`list-item-${indexRef.current}`)) == null ? void 0 : _b2.focus();
432
+ }
433
+ };
434
+ React.useEffect(() => {
435
+ if (isVisible) {
436
+ document.addEventListener("keydown", onKeyDown);
437
+ return () => document.removeEventListener("keydown", onKeyDown);
438
+ } else {
439
+ indexRef.current = -1;
440
+ }
441
+ }, [isVisible, onKeyDown]);
442
+ const handleTriggerClick = () => {
443
+ setIsVisible(true);
444
+ };
445
+ const handleItemClick = (itemOnClick) => {
446
+ itemOnClick();
447
+ setIsVisible(false);
448
+ };
449
+ return /* @__PURE__ */ React.createElement(Popover, {
450
+ isVisible,
451
+ placement,
452
+ onClose: () => setIsVisible(false),
453
+ triggerRenderer: () => /* @__PURE__ */ React.createElement("button", {
454
+ "data-testid": "action-menu-trigger-button",
455
+ className: styles$F[`${baseClass$N}__trigger-button`],
456
+ onClick: handleTriggerClick
457
+ }, triggerRenderer)
458
+ }, /* @__PURE__ */ React.createElement("ul", __spreadProps(__spreadValues({}, props), {
459
+ className: cx(styles$F[`${baseClass$N}__list`], className),
460
+ role: "menu",
461
+ "aria-hidden": !isVisible
462
+ }), options.map((o, i) => /* @__PURE__ */ React.createElement("li", {
463
+ key: o.key,
464
+ role: "none"
465
+ }, /* @__PURE__ */ React.createElement("button", {
466
+ id: `list-item-${i}`,
467
+ "data-testid": o.key,
468
+ tabIndex: -1,
469
+ key: o.key,
470
+ disabled: o.disabled,
471
+ onClick: () => handleItemClick(o.onClick),
472
+ role: "menuitem",
473
+ className: cx(styles$F[`${baseClass$N}__list__item`], {
474
+ [styles$F[`${baseClass$N}__list__item--disabled`]]: o.disabled,
475
+ [styles$F[`${baseClass$N}__list__item--with-divider`]]: o.withDivider
476
+ })
477
+ }, o.element)))));
478
+ };
297
479
  const caps = "lc-Typography-module__caps___c3eNJ";
298
480
  var styles$E = {
299
481
  "heading-xl": "lc-Typography-module__heading-xl___nhr-6",
@@ -319,13 +501,13 @@ const SIZE_TO_ELEMENT_MAP = {
319
501
  sm: "h4",
320
502
  xs: "h5"
321
503
  };
322
- const Heading = (_a) => {
323
- var _b = _a, {
504
+ const Heading = (_c) => {
505
+ var _d = _c, {
324
506
  as,
325
507
  size = "md",
326
508
  children,
327
509
  className
328
- } = _b, props = __objRest(_b, [
510
+ } = _d, props = __objRest(_d, [
329
511
  "as",
330
512
  "size",
331
513
  "children",
@@ -333,8 +515,8 @@ const Heading = (_a) => {
333
515
  ]);
334
516
  return React.createElement(as || SIZE_TO_ELEMENT_MAP[size], __spreadValues({ className: cx(styles$E[`heading-${size}`], className) }, props), children);
335
517
  };
336
- const Text = (_c) => {
337
- var _d = _c, {
518
+ const Text = (_e) => {
519
+ var _f = _e, {
338
520
  as = "p",
339
521
  size = "md",
340
522
  caps: caps2 = false,
@@ -343,7 +525,7 @@ const Text = (_c) => {
343
525
  strike = false,
344
526
  children,
345
527
  className
346
- } = _d, props = __objRest(_d, [
528
+ } = _f, props = __objRest(_f, [
347
529
  "as",
348
530
  "size",
349
531
  "caps",
@@ -466,13 +648,13 @@ const IconConfig = {
466
648
  }
467
649
  };
468
650
  const baseClass$L = "alert";
469
- const Alert = (_e) => {
470
- var _f = _e, {
651
+ const Alert = (_g) => {
652
+ var _h = _g, {
471
653
  children,
472
654
  className,
473
655
  kind = "info",
474
656
  onClose
475
- } = _f, props = __objRest(_f, [
657
+ } = _h, props = __objRest(_h, [
476
658
  "children",
477
659
  "className",
478
660
  "kind",
@@ -640,15 +822,15 @@ function formatCount(count, max) {
640
822
  return count > max ? `${max}+` : `${count}`;
641
823
  }
642
824
  const baseClass$J = "badge";
643
- const Badge = (_g) => {
644
- var _h = _g, {
825
+ const Badge = (_i) => {
826
+ var _j = _i, {
645
827
  className,
646
828
  count = 0,
647
829
  max = 99,
648
830
  kind = "primary",
649
831
  size = "medium",
650
832
  type = "counter"
651
- } = _h, spanProps = __objRest(_h, [
833
+ } = _j, spanProps = __objRest(_j, [
652
834
  "className",
653
835
  "count",
654
836
  "max",
@@ -735,8 +917,8 @@ var styles$y = {
735
917
  "btn--icon-only--bg": "lc-Button-module__btn--icon-only--bg___X-4V2"
736
918
  };
737
919
  const baseClass$H = "btn";
738
- const Button = React.forwardRef((_i, ref) => {
739
- var _j = _i, {
920
+ const Button = React.forwardRef((_k, ref) => {
921
+ var _l = _k, {
740
922
  loading = false,
741
923
  disabled = false,
742
924
  type = "button",
@@ -750,7 +932,7 @@ const Button = React.forwardRef((_i, ref) => {
750
932
  children,
751
933
  href,
752
934
  onClick
753
- } = _j, props = __objRest(_j, [
935
+ } = _l, props = __objRest(_l, [
754
936
  "loading",
755
937
  "disabled",
756
938
  "type",
@@ -889,8 +1071,8 @@ const headerClass = `${baseClass$F}__header`;
889
1071
  const headingClass = `${headerClass}__heading`;
890
1072
  const actionsClass = `${baseClass$F}__actions`;
891
1073
  const noImageClass = `${headerClass}__no-image`;
892
- const Card = (_k) => {
893
- var _l = _k, {
1074
+ const Card = (_m) => {
1075
+ var _n = _m, {
894
1076
  alt,
895
1077
  buttonsOptions = [],
896
1078
  children,
@@ -899,7 +1081,7 @@ const Card = (_k) => {
899
1081
  expandableContent,
900
1082
  src,
901
1083
  title
902
- } = _l, divProps = __objRest(_l, [
1084
+ } = _n, divProps = __objRest(_n, [
903
1085
  "alt",
904
1086
  "buttonsOptions",
905
1087
  "children",
@@ -966,11 +1148,11 @@ var styles$v = {
966
1148
  "field-description": "lc-FieldDescription-module__field-description___IcRDH"
967
1149
  };
968
1150
  const baseClass$E = "field-description";
969
- const FieldDescription = (_m) => {
970
- var _n = _m, {
1151
+ const FieldDescription = (_o) => {
1152
+ var _p = _o, {
971
1153
  children,
972
1154
  className = ""
973
- } = _n, props = __objRest(_n, [
1155
+ } = _p, props = __objRest(_p, [
974
1156
  "children",
975
1157
  "className"
976
1158
  ]);
@@ -1001,8 +1183,8 @@ var styles$u = {
1001
1183
  checkbox__helper
1002
1184
  };
1003
1185
  const baseClass$D = "checkbox";
1004
- const Checkbox = React.forwardRef((_o, ref) => {
1005
- var _p = _o, { checked, disabled, children, description, className } = _p, restInputProps = __objRest(_p, ["checked", "disabled", "children", "description", "className"]);
1186
+ const Checkbox = React.forwardRef((_q, ref) => {
1187
+ var _r = _q, { checked, disabled, children, description, className } = _r, restInputProps = __objRest(_r, ["checked", "disabled", "children", "description", "className"]);
1006
1188
  return /* @__PURE__ */ React.createElement("div", {
1007
1189
  className: cx(styles$u[baseClass$D], className, {
1008
1190
  [styles$u[`${baseClass$D}--selected`]]: checked,
@@ -1597,11 +1779,11 @@ var styles$s = {
1597
1779
  "field-error": "lc-FieldError-module__field-error___IDkPT"
1598
1780
  };
1599
1781
  const baseClass$z = "field-error";
1600
- const FieldError = (_q) => {
1601
- var _r = _q, {
1782
+ const FieldError = (_s) => {
1783
+ var _t = _s, {
1602
1784
  children,
1603
1785
  className = ""
1604
- } = _r, props = __objRest(_r, [
1786
+ } = _t, props = __objRest(_t, [
1605
1787
  "children",
1606
1788
  "className"
1607
1789
  ]);
@@ -1619,15 +1801,15 @@ var styles$r = {
1619
1801
  "field-group--stretched": "lc-FieldGroup-module__field-group--stretched___6rkuO"
1620
1802
  };
1621
1803
  const baseClass$y = "field-group";
1622
- const FieldGroup = (_s) => {
1623
- var _t = _s, {
1804
+ const FieldGroup = (_u) => {
1805
+ var _v = _u, {
1624
1806
  className = "",
1625
1807
  children,
1626
1808
  description,
1627
1809
  error,
1628
1810
  inline,
1629
1811
  stretch
1630
- } = _t, props = __objRest(_t, [
1812
+ } = _v, props = __objRest(_v, [
1631
1813
  "className",
1632
1814
  "children",
1633
1815
  "description",
@@ -1656,14 +1838,14 @@ var styles$q = {
1656
1838
  form__helper
1657
1839
  };
1658
1840
  const baseClass$x = "form";
1659
- const Form = (_u) => {
1660
- var _v = _u, {
1841
+ const Form = (_w) => {
1842
+ var _x = _w, {
1661
1843
  className,
1662
1844
  children,
1663
1845
  labelText,
1664
1846
  helperText,
1665
1847
  formFooter
1666
- } = _v, restProps = __objRest(_v, [
1848
+ } = _x, restProps = __objRest(_x, [
1667
1849
  "className",
1668
1850
  "children",
1669
1851
  "labelText",
@@ -1748,13 +1930,13 @@ var styles$o = {
1748
1930
  "form-group__helper": "lc-FormGroup-module__form-group__helper___SRuxe"
1749
1931
  };
1750
1932
  const baseClass$v = "form-group";
1751
- const FormGroup = (_w) => {
1752
- var _x = _w, {
1933
+ const FormGroup = (_y) => {
1934
+ var _z = _y, {
1753
1935
  className = "",
1754
1936
  children,
1755
1937
  labelText,
1756
1938
  helperText
1757
- } = _x, props = __objRest(_x, [
1939
+ } = _z, props = __objRest(_z, [
1758
1940
  "className",
1759
1941
  "children",
1760
1942
  "labelText",
@@ -1798,14 +1980,14 @@ const renderIcon = (icon2, disabled) => React.cloneElement(icon2.source, {
1798
1980
  [styles$n[`${baseClass$u}__icon--disabled`]]: disabled
1799
1981
  })
1800
1982
  });
1801
- const Input = React.forwardRef((_y, ref) => {
1802
- var _z = _y, {
1983
+ const Input = React.forwardRef((_A, ref) => {
1984
+ var _B = _A, {
1803
1985
  inputSize = "medium",
1804
1986
  error = false,
1805
1987
  disabled,
1806
1988
  icon: icon2 = null,
1807
1989
  className
1808
- } = _z, inputProps = __objRest(_z, [
1990
+ } = _B, inputProps = __objRest(_B, [
1809
1991
  "inputSize",
1810
1992
  "error",
1811
1993
  "disabled",
@@ -1859,11 +2041,11 @@ var styles$m = {
1859
2041
  "link--bold": "lc-Link-module__link--bold___1rGdO"
1860
2042
  };
1861
2043
  const baseClass$t = "link";
1862
- const Link = (_A) => {
1863
- var _B = _A, {
2044
+ const Link = (_C) => {
2045
+ var _D = _C, {
1864
2046
  bold = false,
1865
2047
  className = ""
1866
- } = _B, rest = __objRest(_B, [
2048
+ } = _D, rest = __objRest(_D, [
1867
2049
  "bold",
1868
2050
  "className"
1869
2051
  ]);
@@ -1871,18 +2053,6 @@ const Link = (_A) => {
1871
2053
  className: cx(styles$m[baseClass$t], bold && styles$m[`${baseClass$t}--bold`], className)
1872
2054
  }, rest));
1873
2055
  };
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
2056
  const modal__header = "lc-Modal-module__modal__header___Fp5VE";
1887
2057
  const modal__heading = "lc-Modal-module__modal__heading___G9KVK";
1888
2058
  const modal__body = "lc-Modal-module__modal__body___M-jmN";
@@ -1902,14 +2072,14 @@ var styles$l = {
1902
2072
  modal__footer
1903
2073
  };
1904
2074
  const baseClass$s = "modal-base";
1905
- const ModalBase = (_C) => {
1906
- var _D = _C, {
2075
+ const ModalBase = (_E) => {
2076
+ var _F = _E, {
1907
2077
  children,
1908
2078
  className = "",
1909
2079
  onClose,
1910
2080
  closeOnEscPress = true,
1911
2081
  closeOnOverlayPress = true
1912
- } = _D, props = __objRest(_D, [
2082
+ } = _F, props = __objRest(_F, [
1913
2083
  "children",
1914
2084
  "className",
1915
2085
  "onClose",
@@ -1959,8 +2129,8 @@ const ModalCloseButton = ({
1959
2129
  customColor
1960
2130
  }));
1961
2131
  const baseClass$r = "modal";
1962
- const Modal = (_E) => {
1963
- var _F = _E, {
2132
+ const Modal = (_G) => {
2133
+ var _H = _G, {
1964
2134
  children,
1965
2135
  className = "",
1966
2136
  heading,
@@ -1968,7 +2138,7 @@ const Modal = (_E) => {
1968
2138
  fullSpaceContent,
1969
2139
  footer,
1970
2140
  onClose
1971
- } = _F, props = __objRest(_F, [
2141
+ } = _H, props = __objRest(_H, [
1972
2142
  "children",
1973
2143
  "className",
1974
2144
  "heading",
@@ -2043,8 +2213,8 @@ var styles$k = {
2043
2213
  "numeric-input--error": "lc-NumericInput-module__numeric-input--error___TMxRx"
2044
2214
  };
2045
2215
  const baseClass$q = "numeric-input";
2046
- const NumericInput = (_G) => {
2047
- var _H = _G, {
2216
+ const NumericInput = (_I) => {
2217
+ var _J = _I, {
2048
2218
  className,
2049
2219
  error,
2050
2220
  value,
@@ -2054,7 +2224,7 @@ const NumericInput = (_G) => {
2054
2224
  noControls,
2055
2225
  style,
2056
2226
  onChange
2057
- } = _H, restProps = __objRest(_H, [
2227
+ } = _J, restProps = __objRest(_J, [
2058
2228
  "className",
2059
2229
  "error",
2060
2230
  "value",
@@ -2447,8 +2617,8 @@ const getCustomTextClass = (customColor) => {
2447
2617
  }
2448
2618
  return getContrast(customColor, "#FFFFFF") > 4.5 ? "text-white" : "text-black";
2449
2619
  };
2450
- const Tag = (_I) => {
2451
- var _J = _I, {
2620
+ const Tag = (_K) => {
2621
+ var _L = _K, {
2452
2622
  className = "",
2453
2623
  children,
2454
2624
  dismissible = false,
@@ -2460,7 +2630,7 @@ const Tag = (_I) => {
2460
2630
  icon: icon2,
2461
2631
  avatar: avatar2,
2462
2632
  customColor
2463
- } = _J, restProps = __objRest(_J, [
2633
+ } = _L, restProps = __objRest(_L, [
2464
2634
  "className",
2465
2635
  "children",
2466
2636
  "dismissible",
@@ -2587,8 +2757,8 @@ const TriggerBody = ({
2587
2757
  }), shouldDisplaySearch && getSearch());
2588
2758
  };
2589
2759
  const baseClass$l = "picker";
2590
- const Picker = (_K) => {
2591
- var _L = _K, {
2760
+ const Picker = (_M) => {
2761
+ var _N = _M, {
2592
2762
  className,
2593
2763
  disabled,
2594
2764
  error,
@@ -2603,7 +2773,7 @@ const Picker = (_K) => {
2603
2773
  type = "single",
2604
2774
  searchDisabled = false,
2605
2775
  onSelect
2606
- } = _L, props = __objRest(_L, [
2776
+ } = _N, props = __objRest(_N, [
2607
2777
  "className",
2608
2778
  "disabled",
2609
2779
  "error",
@@ -2748,89 +2918,6 @@ const Picker = (_K) => {
2748
2918
  onSelectAll: handleSelectAll
2749
2919
  })));
2750
2920
  };
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
2921
  const PROGRESS_STATUSES = [
2835
2922
  "normal",
2836
2923
  "error",
@@ -2876,13 +2963,13 @@ const SIZE_VALUE_FROM_SIZE = {
2876
2963
  large: 56
2877
2964
  };
2878
2965
  const baseClass$k = "progress-circle";
2879
- const ProgressCircle = React.forwardRef((_M, ref) => {
2880
- var _N = _M, {
2966
+ const ProgressCircle = React.forwardRef((_O, ref) => {
2967
+ var _P = _O, {
2881
2968
  status = "normal",
2882
2969
  progressValue,
2883
2970
  className,
2884
2971
  size = "medium"
2885
- } = _N, restProps = __objRest(_N, [
2972
+ } = _P, restProps = __objRest(_P, [
2886
2973
  "status",
2887
2974
  "progressValue",
2888
2975
  "className",
@@ -2937,13 +3024,13 @@ var styles$d = {
2937
3024
  "progress-bar__indicator--normal": "lc-ProgressBar-module__progress-bar__indicator--normal___0Uhle"
2938
3025
  };
2939
3026
  const baseClass$j = "progress-bar";
2940
- const ProgressBar = React.forwardRef((_O, ref) => {
2941
- var _P = _O, {
3027
+ const ProgressBar = React.forwardRef((_Q, ref) => {
3028
+ var _R = _Q, {
2942
3029
  status = "normal",
2943
3030
  percent,
2944
3031
  size = "medium",
2945
3032
  className = ""
2946
- } = _P, restProps = __objRest(_P, [
3033
+ } = _R, restProps = __objRest(_R, [
2947
3034
  "status",
2948
3035
  "percent",
2949
3036
  "size",
@@ -3064,8 +3151,8 @@ var styles$b = {
3064
3151
  "radio-button--disabled": "lc-RadioButton-module__radio-button--disabled___wHSA7"
3065
3152
  };
3066
3153
  const baseClass$h = "radio-button";
3067
- const RadioButton = React.forwardRef((_Q, ref) => {
3068
- var _R = _Q, { children, className = "", description, checked, disabled } = _R, props = __objRest(_R, ["children", "className", "description", "checked", "disabled"]);
3154
+ const RadioButton = React.forwardRef((_S, ref) => {
3155
+ var _T = _S, { children, className = "", description, checked, disabled } = _T, props = __objRest(_T, ["children", "className", "description", "checked", "disabled"]);
3069
3156
  const mergedClassNames = cx(styles$b[baseClass$h], className, {
3070
3157
  [styles$b[`${baseClass$h}--selected`]]: checked,
3071
3158
  [styles$b[`${baseClass$h}--disabled`]]: disabled
@@ -3231,8 +3318,8 @@ var styles$9 = {
3231
3318
  switch__icon
3232
3319
  };
3233
3320
  const baseClass$f = "switch";
3234
- const Switch = (_S) => {
3235
- var _T = _S, {
3321
+ const Switch = (_U) => {
3322
+ var _V = _U, {
3236
3323
  className = "",
3237
3324
  defaultOn = false,
3238
3325
  disabled = false,
@@ -3243,7 +3330,7 @@ const Switch = (_S) => {
3243
3330
  state = "regular",
3244
3331
  innerRef,
3245
3332
  ariaLabel
3246
- } = _T, props = __objRest(_T, [
3333
+ } = _V, props = __objRest(_V, [
3247
3334
  "className",
3248
3335
  "defaultOn",
3249
3336
  "disabled",
@@ -3318,15 +3405,15 @@ var styles$8 = {
3318
3405
  "tab--disabled": "lc-Tab-module__tab--disabled___URdTh"
3319
3406
  };
3320
3407
  const baseClass$e = "tab";
3321
- const Tab = (_U) => {
3322
- var _V = _U, {
3408
+ const Tab = (_W) => {
3409
+ var _X = _W, {
3323
3410
  children,
3324
3411
  className,
3325
3412
  count,
3326
3413
  isSelected,
3327
3414
  asBadge,
3328
3415
  size = "medium"
3329
- } = _V, restProps = __objRest(_V, [
3416
+ } = _X, restProps = __objRest(_X, [
3330
3417
  "children",
3331
3418
  "className",
3332
3419
  "count",
@@ -3625,15 +3712,15 @@ const iconConfig = {
3625
3712
  }
3626
3713
  };
3627
3714
  const baseClass$a = "toast";
3628
- const Toast = (_W) => {
3629
- var _X = _W, {
3715
+ const Toast = (_Y) => {
3716
+ var _Z = _Y, {
3630
3717
  action,
3631
3718
  className,
3632
3719
  children,
3633
3720
  removable,
3634
3721
  kind = "info",
3635
3722
  onClose
3636
- } = _X, divProps = __objRest(_X, [
3723
+ } = _Z, divProps = __objRest(_Z, [
3637
3724
  "action",
3638
3725
  "className",
3639
3726
  "children",
@@ -4178,8 +4265,8 @@ var styles$3 = {
4178
4265
  "textarea--error": "lc-Textarea-module__textarea--error___0EGuq"
4179
4266
  };
4180
4267
  const baseClass$3 = "textarea";
4181
- const Textarea = React.forwardRef((_Y, ref) => {
4182
- var _Z = _Y, { className, error } = _Z, textareaProps = __objRest(_Z, ["className", "error"]);
4268
+ const Textarea = React.forwardRef((__, ref) => {
4269
+ var _$ = __, { className, error } = _$, textareaProps = __objRest(_$, ["className", "error"]);
4183
4270
  const { disabled } = textareaProps;
4184
4271
  const [isFocused, setIsFocused] = React.useState(false);
4185
4272
  const mergedClassNames = cx(className, styles$3[baseClass$3], {
@@ -4410,4 +4497,4 @@ const UploadBar = ({
4410
4497
  className: styles[`${baseClass}__files__list`]
4411
4498
  }, children))))));
4412
4499
  };
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 };
4500
+ 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 };