@livechat/design-system-react-components 1.0.0-alpha.41 → 1.0.0-alpha.43
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 +127 -130
- package/dist/dsrc.umd.js +9 -9
- package/dist/src/components/Alert/Alert.d.ts +2 -2
- package/dist/src/components/Avatar/Avatar.d.ts +2 -2
- package/dist/src/components/Badge/Badge.d.ts +3 -3
- package/dist/src/components/Button/Button.d.ts +4 -4
- package/dist/src/components/Card/Card.d.ts +4 -4
- package/dist/src/components/Checkbox/Checkbox.d.ts +3 -3
- package/dist/src/components/DatePicker/DatePicker.d.ts +1 -2
- package/dist/src/components/DatePicker/DatePickerNavbar.d.ts +2 -2
- package/dist/src/components/DatePicker/types.d.ts +3 -3
- package/dist/src/components/FieldDescription/FieldDescription.d.ts +3 -3
- package/dist/src/components/FieldError/FieldError.d.ts +3 -3
- package/dist/src/components/FieldGroup/FieldGroup.d.ts +4 -4
- package/dist/src/components/FileUploadProgress/FileUploadProgress.d.ts +3 -3
- package/dist/src/components/FileUploadProgress/FileUploadProgressActions.d.ts +2 -2
- package/dist/src/components/Form/Form.d.ts +4 -4
- package/dist/src/components/FormField/FormField.d.ts +6 -6
- package/dist/src/components/FormGroup/FormGroup.d.ts +3 -3
- package/dist/src/components/Icon/Icon.d.ts +3 -3
- package/dist/src/components/Input/Input.d.ts +4 -4
- package/dist/src/components/Link/Link.d.ts +3 -3
- package/dist/src/components/Loader/Loader.d.ts +3 -3
- package/dist/src/components/Modal/Modal.d.ts +5 -5
- package/dist/src/components/Modal/ModalBase.d.ts +3 -3
- package/dist/src/components/Modal/ModalCloseButton.d.ts +3 -3
- package/dist/src/components/Modal/ModalPortal.d.ts +4 -4
- package/dist/src/components/NumericInput/NumericInput.d.ts +3 -3
- package/dist/src/components/Picker/Picker.d.ts +2 -2
- package/dist/src/components/Picker/PickerList.d.ts +4 -4
- package/dist/src/components/Picker/Trigger.d.ts +3 -3
- package/dist/src/components/Picker/TriggerBody.d.ts +2 -2
- package/dist/src/components/Popover/Popover.d.ts +4 -4
- package/dist/src/components/Progress/ProgressBar.d.ts +2 -2
- package/dist/src/components/Progress/ProgressCircle.d.ts +2 -2
- package/dist/src/components/PromoBanner/PromoBanner.d.ts +2 -2
- package/dist/src/components/RadioButton/RadioButton.d.ts +3 -3
- package/dist/src/components/Search/Search.d.ts +2 -2
- package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +4 -4
- package/dist/src/components/Switch/Switch.d.ts +4 -4
- package/dist/src/components/Tab/Tab.d.ts +4 -4
- package/dist/src/components/Tab/TabsWrapper.d.ts +3 -3
- package/dist/src/components/Tag/Tag.d.ts +3 -3
- package/dist/src/components/TagInput/EditableTag.d.ts +4 -4
- package/dist/src/components/TagInput/EditableTagContent.d.ts +4 -4
- package/dist/src/components/TagInput/EmailTagInput.d.ts +2 -2
- package/dist/src/components/TagInput/TagInput.d.ts +2 -2
- package/dist/src/components/Textarea/Textarea.d.ts +3 -3
- package/dist/src/components/Toast/Toast.d.ts +3 -3
- package/dist/src/components/Toast/ToastWrapper.d.ts +3 -3
- package/dist/src/components/Tooltip/Info.d.ts +3 -3
- package/dist/src/components/Tooltip/Interactive.d.ts +12 -4
- package/dist/src/components/Tooltip/Simple.d.ts +2 -2
- package/dist/src/components/Tooltip/Tooltip.d.ts +4 -4
- package/dist/src/components/Tooltip/UserGuide.d.ts +2 -2
- package/dist/src/components/Typography/Heading.d.ts +2 -2
- package/dist/src/components/Typography/Text.d.ts +2 -2
- package/dist/src/components/UploadBar/UploadBar.d.ts +3 -3
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/dsrc.es.js
CHANGED
|
@@ -33,11 +33,10 @@ var __publicField = (obj, key, value) => {
|
|
|
33
33
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
34
|
return value;
|
|
35
35
|
};
|
|
36
|
-
import * as React from "react";
|
|
37
|
-
import { useReducer, useRef, useEffect, useCallback, useMemo } from "react";
|
|
38
36
|
import cx from "clsx";
|
|
39
37
|
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
38
|
import debounce from "lodash.debounce";
|
|
39
|
+
import { createElement, useRef, useState, useEffect, useCallback, forwardRef, cloneElement, useMemo, useReducer, Fragment, Children, isValidElement } from "react";
|
|
41
40
|
import { getContrast } from "polished";
|
|
42
41
|
import ReactDayPicker from "react-day-picker";
|
|
43
42
|
import { subMonths, differenceInCalendarMonths, addMonths, isSameMonth, isSameDay, isAfter, differenceInCalendarDays } from "date-fns";
|
|
@@ -331,7 +330,7 @@ const Heading = (_a) => {
|
|
|
331
330
|
"children",
|
|
332
331
|
"className"
|
|
333
332
|
]);
|
|
334
|
-
return
|
|
333
|
+
return createElement(as || SIZE_TO_ELEMENT_MAP[size], __spreadValues({ className: cx(styles$E[`heading-${size}`], className) }, props), children);
|
|
335
334
|
};
|
|
336
335
|
const Text = (_c) => {
|
|
337
336
|
var _d = _c, {
|
|
@@ -354,7 +353,7 @@ const Text = (_c) => {
|
|
|
354
353
|
"className"
|
|
355
354
|
]);
|
|
356
355
|
const baseClassPrefix = caps2 ? "caps" : `paragraph-${size}`;
|
|
357
|
-
return
|
|
356
|
+
return createElement(as, __spreadValues({
|
|
358
357
|
className: cx({
|
|
359
358
|
[styles$E[`${baseClassPrefix}`]]: true,
|
|
360
359
|
[styles$E[`${baseClassPrefix}--bold`]]: bold,
|
|
@@ -422,7 +421,7 @@ const Icon = (props) => {
|
|
|
422
421
|
"className",
|
|
423
422
|
"customColor"
|
|
424
423
|
]);
|
|
425
|
-
const GeneratedIcon =
|
|
424
|
+
const GeneratedIcon = createElement(source, __spreadProps(__spreadValues({}, IconSizeMap[size]), {
|
|
426
425
|
color: customColor
|
|
427
426
|
}));
|
|
428
427
|
const mergedClassNames = cx(className, styles$D[baseClass$M], kind && styles$D[`${baseClass$M}--${disabled ? "disabled--" : ""}${kind}`]);
|
|
@@ -478,10 +477,10 @@ const Alert = (_e) => {
|
|
|
478
477
|
"kind",
|
|
479
478
|
"onClose"
|
|
480
479
|
]);
|
|
481
|
-
const containerRef =
|
|
482
|
-
const [isSmallContainer, setIsSmallContainer] =
|
|
480
|
+
const containerRef = useRef(null);
|
|
481
|
+
const [isSmallContainer, setIsSmallContainer] = useState(false);
|
|
483
482
|
const mergedClassNames = cx(styles$C[baseClass$L], styles$C[`${baseClass$L}--${kind}`], isSmallContainer && styles$C[`${baseClass$L}--small`], className);
|
|
484
|
-
|
|
483
|
+
useEffect(() => {
|
|
485
484
|
const handleResize = debounce(() => {
|
|
486
485
|
if (containerRef.current && containerRef.current.offsetWidth <= 400) {
|
|
487
486
|
return setIsSmallContainer(true);
|
|
@@ -582,7 +581,7 @@ const Avatar = ({
|
|
|
582
581
|
withRim = false
|
|
583
582
|
}) => {
|
|
584
583
|
const isImproperImageSetup = type === "image" && !src;
|
|
585
|
-
const [shouldDisplayFallbackAvatar, setShouldDisplayFallbackAvatar] =
|
|
584
|
+
const [shouldDisplayFallbackAvatar, setShouldDisplayFallbackAvatar] = useState(isImproperImageSetup);
|
|
586
585
|
const shouldDisplayImage = type === "image" && !!src && !shouldDisplayFallbackAvatar;
|
|
587
586
|
const shouldDisplayInitials = type === "text";
|
|
588
587
|
const letterCount = ["xxxsmall", "xxsmall", "xsmall"].includes(size) ? 1 : 2;
|
|
@@ -598,8 +597,8 @@ const Avatar = ({
|
|
|
598
597
|
const mergedStatusClassNames = cx(styles$B[`${baseClass$K}__status`], styles$B[`${baseClass$K}__status--${shape}`], styles$B[`${baseClass$K}__status--${size}`], styles$B[`${baseClass$K}__status--${status}`]);
|
|
599
598
|
const mergedIconClassNames = cx(styles$B[`${baseClass$K}__icon`], styles$B[`${baseClass$K}__icon--${size}`]);
|
|
600
599
|
const mergedRimClassNames = cx(styles$B[`${baseClass$K}__rim`], styles$B[`${baseClass$K}__rim--${size}`]);
|
|
601
|
-
const handleError =
|
|
602
|
-
|
|
600
|
+
const handleError = useCallback(() => setShouldDisplayFallbackAvatar(true), []);
|
|
601
|
+
useEffect(() => {
|
|
603
602
|
setShouldDisplayFallbackAvatar(isImproperImageSetup);
|
|
604
603
|
}, [isImproperImageSetup]);
|
|
605
604
|
return /* @__PURE__ */ React.createElement("div", {
|
|
@@ -734,7 +733,7 @@ var styles$y = {
|
|
|
734
733
|
"btn--icon-only--bg": "lc-Button-module__btn--icon-only--bg___X-4V2"
|
|
735
734
|
};
|
|
736
735
|
const baseClass$H = "btn";
|
|
737
|
-
const Button = (_i) => {
|
|
736
|
+
const Button = forwardRef((_i, ref) => {
|
|
738
737
|
var _j = _i, {
|
|
739
738
|
loading = false,
|
|
740
739
|
disabled = false,
|
|
@@ -784,6 +783,7 @@ const Button = (_i) => {
|
|
|
784
783
|
[styles$y[`${baseClass$H}--disabled`]]: isDisabled
|
|
785
784
|
});
|
|
786
785
|
return /* @__PURE__ */ React.createElement(Component, __spreadValues({
|
|
786
|
+
ref,
|
|
787
787
|
className: mergedClassNames,
|
|
788
788
|
"aria-disabled": isDisabled,
|
|
789
789
|
type,
|
|
@@ -794,13 +794,13 @@ const Button = (_i) => {
|
|
|
794
794
|
size: "small",
|
|
795
795
|
label: loaderLabel,
|
|
796
796
|
className: styles$y[`${baseClass$H}__loader`]
|
|
797
|
-
}, getSpinnerColors())), icon2 &&
|
|
797
|
+
}, getSpinnerColors())), icon2 && cloneElement(icon2, {
|
|
798
798
|
className: cx(styles$y[`${baseClass$H}__icon`], styles$y[`${baseClass$H}__icon--${iconPosition}`]),
|
|
799
799
|
disabled
|
|
800
800
|
}), /* @__PURE__ */ React.createElement("div", {
|
|
801
801
|
className: styles$y[`${baseClass$H}__content`]
|
|
802
802
|
}, children));
|
|
803
|
-
};
|
|
803
|
+
});
|
|
804
804
|
const btn = "lc-SegmentedControl-module__btn___tfsvL";
|
|
805
805
|
var styles$x = {
|
|
806
806
|
"segmented-control": "lc-SegmentedControl-module__segmented-control___LHWSk",
|
|
@@ -823,9 +823,9 @@ const SegmentedControl = ({
|
|
|
823
823
|
onButtonClick = noop
|
|
824
824
|
}) => {
|
|
825
825
|
const mergedClassName = cx(styles$x[baseClass$G], className);
|
|
826
|
-
const [currentStateId, setCurrentStateId] =
|
|
826
|
+
const [currentStateId, setCurrentStateId] = useState(() => initialId);
|
|
827
827
|
const isControlled = typeof currentId === "string";
|
|
828
|
-
|
|
828
|
+
useEffect(() => {
|
|
829
829
|
isControlled && setCurrentStateId(currentId);
|
|
830
830
|
}, [currentId]);
|
|
831
831
|
const handleClick = (id, event) => {
|
|
@@ -907,7 +907,7 @@ const Card = (_k) => {
|
|
|
907
907
|
"src",
|
|
908
908
|
"title"
|
|
909
909
|
]);
|
|
910
|
-
const [isExpanded, setIsExpanded] =
|
|
910
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
911
911
|
const expandIcon = isExpanded ? ChevronUp : ChevronDown;
|
|
912
912
|
const expandButtonText = isExpanded ? "Hide" : "Show more";
|
|
913
913
|
const shouldShowActionButtons = (buttonsOptions == null ? void 0 : buttonsOptions.length) > 0;
|
|
@@ -999,7 +999,7 @@ var styles$u = {
|
|
|
999
999
|
checkbox__helper
|
|
1000
1000
|
};
|
|
1001
1001
|
const baseClass$D = "checkbox";
|
|
1002
|
-
const Checkbox =
|
|
1002
|
+
const Checkbox = forwardRef((_o, ref) => {
|
|
1003
1003
|
var _p = _o, { checked, disabled, children, description, className } = _p, restInputProps = __objRest(_p, ["checked", "disabled", "children", "description", "className"]);
|
|
1004
1004
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1005
1005
|
className: cx(styles$u[baseClass$D], className, {
|
|
@@ -1297,20 +1297,20 @@ const DatePickerComponent = (props) => {
|
|
|
1297
1297
|
"renderDay",
|
|
1298
1298
|
"innerRef"
|
|
1299
1299
|
]);
|
|
1300
|
-
const [currentMonth, setCurrentMonth] =
|
|
1301
|
-
|
|
1300
|
+
const [currentMonth, setCurrentMonth] = useState(month || new Date());
|
|
1301
|
+
useEffect(() => {
|
|
1302
1302
|
if (month && month !== currentMonth) {
|
|
1303
1303
|
setCurrentMonth(month);
|
|
1304
1304
|
}
|
|
1305
1305
|
}, [month, currentMonth]);
|
|
1306
|
-
|
|
1306
|
+
useEffect(() => {
|
|
1307
1307
|
if (toMonth) {
|
|
1308
1308
|
if (!isDateWithinRange(currentMonth, { from: fromMonth, to: toMonth })) {
|
|
1309
1309
|
setCurrentMonth(toMonth);
|
|
1310
1310
|
}
|
|
1311
1311
|
}
|
|
1312
1312
|
}, [currentMonth, props.toMonth, props.fromMonth]);
|
|
1313
|
-
const handleMonthChange =
|
|
1313
|
+
const handleMonthChange = useCallback((month2) => {
|
|
1314
1314
|
if (props.onMonthChange && month2) {
|
|
1315
1315
|
props.onMonthChange(month2);
|
|
1316
1316
|
return;
|
|
@@ -1321,7 +1321,7 @@ const DatePickerComponent = (props) => {
|
|
|
1321
1321
|
if (propsFirstDayOfWeek === 0 || propsFirstDayOfWeek && propsFirstDayOfWeek < 7) {
|
|
1322
1322
|
firstDayOfWeek = propsFirstDayOfWeek;
|
|
1323
1323
|
}
|
|
1324
|
-
const datePickerClassNames =
|
|
1324
|
+
const datePickerClassNames = useMemo(() => getDatePickerClassNames(range, classNames), [range, classNames]);
|
|
1325
1325
|
return /* @__PURE__ */ React.createElement(ReactDayPicker, __spreadValues({
|
|
1326
1326
|
navbarElement: navbarElement || /* @__PURE__ */ React.createElement(DatePickerNavbar, {
|
|
1327
1327
|
month: currentMonth,
|
|
@@ -1341,7 +1341,7 @@ const DatePickerComponent = (props) => {
|
|
|
1341
1341
|
renderDay: renderDay || defaultDayRenderer
|
|
1342
1342
|
}, restProps));
|
|
1343
1343
|
};
|
|
1344
|
-
const DatePicker =
|
|
1344
|
+
const DatePicker = forwardRef((props, ref) => /* @__PURE__ */ React.createElement(DatePickerComponent, __spreadValues({
|
|
1345
1345
|
innerRef: ref
|
|
1346
1346
|
}, props)));
|
|
1347
1347
|
DatePicker.displayName = "DatePicker";
|
|
@@ -1715,7 +1715,7 @@ const FormField = ({
|
|
|
1715
1715
|
}, className);
|
|
1716
1716
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1717
1717
|
className: mergedClassNames
|
|
1718
|
-
}, labelRightNode && inline && /* @__PURE__ */ React.createElement(
|
|
1718
|
+
}, labelRightNode && inline && /* @__PURE__ */ React.createElement(Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
1719
1719
|
className: cx(styles$p[`${baseClass$w}__label-right-node`], styles$p[`${baseClass$w}__label-right-node--inline`])
|
|
1720
1720
|
}, labelRightNode), /* @__PURE__ */ React.createElement("div", {
|
|
1721
1721
|
className: styles$p[`${baseClass$w}__row-break`]
|
|
@@ -1790,13 +1790,13 @@ var styles$n = {
|
|
|
1790
1790
|
"input__visibility-button": "lc-Input-module__input__visibility-button___eWrVe"
|
|
1791
1791
|
};
|
|
1792
1792
|
const baseClass$u = "input";
|
|
1793
|
-
const renderIcon = (icon2, disabled) =>
|
|
1793
|
+
const renderIcon = (icon2, disabled) => cloneElement(icon2.source, {
|
|
1794
1794
|
["data-testid"]: `input-icon-${icon2.place}`,
|
|
1795
1795
|
className: cx(styles$n[`${baseClass$u}__icon`], styles$n[`${baseClass$u}__icon--${icon2.place}`], {
|
|
1796
1796
|
[styles$n[`${baseClass$u}__icon--disabled`]]: disabled
|
|
1797
1797
|
})
|
|
1798
1798
|
});
|
|
1799
|
-
const Input =
|
|
1799
|
+
const Input = forwardRef((_y, ref) => {
|
|
1800
1800
|
var _z = _y, {
|
|
1801
1801
|
inputSize = "medium",
|
|
1802
1802
|
error = false,
|
|
@@ -1810,8 +1810,8 @@ const Input = React.forwardRef((_y, ref) => {
|
|
|
1810
1810
|
"icon",
|
|
1811
1811
|
"className"
|
|
1812
1812
|
]);
|
|
1813
|
-
const [isFocused, setIsFocused] =
|
|
1814
|
-
const [isPasswordVisible, setIsPasswordVisible] =
|
|
1813
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
1814
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
1815
1815
|
const { type, onFocus, onBlur } = inputProps;
|
|
1816
1816
|
const mergedClassNames = cx(className, styles$n[baseClass$u], styles$n[`${baseClass$u}--${inputSize}`], {
|
|
1817
1817
|
[styles$n[`${baseClass$u}--disabled`]]: disabled,
|
|
@@ -1915,7 +1915,7 @@ const ModalBase = (_C) => {
|
|
|
1915
1915
|
"closeOnOverlayPress"
|
|
1916
1916
|
]);
|
|
1917
1917
|
const mergedClassNames = cx(styles$l[baseClass$s], className);
|
|
1918
|
-
|
|
1918
|
+
useEffect(() => {
|
|
1919
1919
|
if (!closeOnEscPress) {
|
|
1920
1920
|
return;
|
|
1921
1921
|
}
|
|
@@ -2015,14 +2015,14 @@ const ModalPortal = ({
|
|
|
2015
2015
|
parentElementName = "body",
|
|
2016
2016
|
zIndex
|
|
2017
2017
|
}) => {
|
|
2018
|
-
const [container] =
|
|
2018
|
+
const [container] = useState(() => document.createElement("div"));
|
|
2019
2019
|
if (className) {
|
|
2020
2020
|
container.classList.add(className);
|
|
2021
2021
|
}
|
|
2022
2022
|
if (zIndex) {
|
|
2023
2023
|
container.style.zIndex = zIndex.toString();
|
|
2024
2024
|
}
|
|
2025
|
-
|
|
2025
|
+
useEffect(() => {
|
|
2026
2026
|
var _a;
|
|
2027
2027
|
(_a = document.querySelector(parentElementName)) == null ? void 0 : _a.appendChild(container);
|
|
2028
2028
|
return () => {
|
|
@@ -2063,7 +2063,7 @@ const NumericInput = (_G) => {
|
|
|
2063
2063
|
"style",
|
|
2064
2064
|
"onChange"
|
|
2065
2065
|
]);
|
|
2066
|
-
const inputRef =
|
|
2066
|
+
const inputRef = useRef(null);
|
|
2067
2067
|
const mergedClassNames = cx(styles$k[baseClass$q], {
|
|
2068
2068
|
[styles$k[`${baseClass$q}--error`]]: error,
|
|
2069
2069
|
[styles$k[`${baseClass$q}--no-controls`]]: noControls,
|
|
@@ -2182,9 +2182,9 @@ const Trigger = ({
|
|
|
2182
2182
|
onTrigger,
|
|
2183
2183
|
onClear
|
|
2184
2184
|
}) => {
|
|
2185
|
-
const triggerRef =
|
|
2185
|
+
const triggerRef = useRef(null);
|
|
2186
2186
|
const mergedClassNames = cx(styles$j[baseClass$p], styles$j[`${baseClass$p}--${size}`], isMultiSelect && styles$j[`${baseClass$p}--multi-select`], isMultiSelect && isItemSelected && styles$j[`${baseClass$p}--multi-select--with-items`], isDisabled && styles$j[`${baseClass$p}--disabled`], isOpen && styles$j[`${baseClass$p}--focused`], isError && styles$j[`${baseClass$p}--error`]);
|
|
2187
|
-
|
|
2187
|
+
useEffect(() => {
|
|
2188
2188
|
const onKeyDown = (e) => {
|
|
2189
2189
|
const isFocused = document.activeElement === triggerRef.current;
|
|
2190
2190
|
if (isFocused && e.key !== KeyCodes.tab) {
|
|
@@ -2257,10 +2257,10 @@ const PickerList = ({
|
|
|
2257
2257
|
const mergedClassNames = cx(styles$i[baseClass$o], {
|
|
2258
2258
|
[styles$i[`${baseClass$o}__no-results`]]: items.length === 0
|
|
2259
2259
|
});
|
|
2260
|
-
const [currentItemKey, setCurrentItemKey] =
|
|
2261
|
-
const indexRef =
|
|
2262
|
-
const lastIndexRef =
|
|
2263
|
-
const listRef =
|
|
2260
|
+
const [currentItemKey, setCurrentItemKey] = useState(null);
|
|
2261
|
+
const indexRef = useRef(-1);
|
|
2262
|
+
const lastIndexRef = useRef(0);
|
|
2263
|
+
const listRef = useRef(null);
|
|
2264
2264
|
const onKeyDown = (e) => {
|
|
2265
2265
|
if (e.key === KeyCodes.esc) {
|
|
2266
2266
|
e.preventDefault();
|
|
@@ -2284,7 +2284,7 @@ const PickerList = ({
|
|
|
2284
2284
|
onSelect(items[indexRef.current]);
|
|
2285
2285
|
}
|
|
2286
2286
|
};
|
|
2287
|
-
|
|
2287
|
+
useEffect(() => {
|
|
2288
2288
|
if (indexRef.current > -1 && items.length > 0) {
|
|
2289
2289
|
setCurrentItemKey(items[indexRef.current].key);
|
|
2290
2290
|
}
|
|
@@ -2617,11 +2617,11 @@ const Picker = (_K) => {
|
|
|
2617
2617
|
"searchDisabled",
|
|
2618
2618
|
"onSelect"
|
|
2619
2619
|
]);
|
|
2620
|
-
const [isListOpen, setIsListOpen] =
|
|
2621
|
-
const [searchPhrase, setSearchPhrase] =
|
|
2622
|
-
const triggerRef =
|
|
2620
|
+
const [isListOpen, setIsListOpen] = useState(false);
|
|
2621
|
+
const [searchPhrase, setSearchPhrase] = useState(null);
|
|
2622
|
+
const triggerRef = useRef(null);
|
|
2623
2623
|
const mergedClassNames = cx(styles$h[baseClass$l], className);
|
|
2624
|
-
|
|
2624
|
+
useEffect(() => {
|
|
2625
2625
|
if (isListOpen) {
|
|
2626
2626
|
const onDocumentClick = (e) => {
|
|
2627
2627
|
var _a;
|
|
@@ -2689,7 +2689,7 @@ const Picker = (_K) => {
|
|
|
2689
2689
|
}
|
|
2690
2690
|
onSelect(newSelectedItems);
|
|
2691
2691
|
};
|
|
2692
|
-
const items =
|
|
2692
|
+
const items = useMemo(() => {
|
|
2693
2693
|
if (!searchPhrase) {
|
|
2694
2694
|
return options;
|
|
2695
2695
|
}
|
|
@@ -2702,7 +2702,7 @@ const Picker = (_K) => {
|
|
|
2702
2702
|
return itemName.includes(search);
|
|
2703
2703
|
});
|
|
2704
2704
|
}, [searchPhrase]);
|
|
2705
|
-
const selectedItemsKeys =
|
|
2705
|
+
const selectedItemsKeys = useMemo(() => {
|
|
2706
2706
|
if (!selected) {
|
|
2707
2707
|
return null;
|
|
2708
2708
|
}
|
|
@@ -2761,8 +2761,8 @@ const Popover = (props) => {
|
|
|
2761
2761
|
flipOptions,
|
|
2762
2762
|
isVisible = false
|
|
2763
2763
|
} = props;
|
|
2764
|
-
const [visible, setVisibility] =
|
|
2765
|
-
const prevVisibleState =
|
|
2764
|
+
const [visible, setVisibility] = useState(false);
|
|
2765
|
+
const prevVisibleState = useRef(false);
|
|
2766
2766
|
const {
|
|
2767
2767
|
x,
|
|
2768
2768
|
y,
|
|
@@ -2776,16 +2776,16 @@ const Popover = (props) => {
|
|
|
2776
2776
|
middleware: [offset(4), flip(flipOptions)],
|
|
2777
2777
|
placement
|
|
2778
2778
|
});
|
|
2779
|
-
|
|
2779
|
+
useEffect(() => {
|
|
2780
2780
|
setVisibility(isVisible);
|
|
2781
2781
|
}, [isVisible]);
|
|
2782
|
-
|
|
2782
|
+
useEffect(() => {
|
|
2783
2783
|
if (onClose && prevVisibleState.current !== visible && !visible) {
|
|
2784
2784
|
onClose();
|
|
2785
2785
|
}
|
|
2786
2786
|
prevVisibleState.current = visible;
|
|
2787
2787
|
}, [visible]);
|
|
2788
|
-
|
|
2788
|
+
useEffect(() => {
|
|
2789
2789
|
if (!refs.reference.current || !refs.floating.current) {
|
|
2790
2790
|
return;
|
|
2791
2791
|
}
|
|
@@ -2805,7 +2805,7 @@ const Popover = (props) => {
|
|
|
2805
2805
|
setVisibility(false);
|
|
2806
2806
|
}
|
|
2807
2807
|
};
|
|
2808
|
-
|
|
2808
|
+
useEffect(() => {
|
|
2809
2809
|
document.addEventListener("keydown", handleHideOnEscape);
|
|
2810
2810
|
document.addEventListener("mousedown", handleDocumentClick);
|
|
2811
2811
|
return () => {
|
|
@@ -2874,7 +2874,7 @@ const SIZE_VALUE_FROM_SIZE = {
|
|
|
2874
2874
|
large: 56
|
|
2875
2875
|
};
|
|
2876
2876
|
const baseClass$k = "progress-circle";
|
|
2877
|
-
const ProgressCircle =
|
|
2877
|
+
const ProgressCircle = forwardRef((_M, ref) => {
|
|
2878
2878
|
var _N = _M, {
|
|
2879
2879
|
status = "normal",
|
|
2880
2880
|
progressValue,
|
|
@@ -2935,7 +2935,7 @@ var styles$d = {
|
|
|
2935
2935
|
"progress-bar__indicator--normal": "lc-ProgressBar-module__progress-bar__indicator--normal___0Uhle"
|
|
2936
2936
|
};
|
|
2937
2937
|
const baseClass$j = "progress-bar";
|
|
2938
|
-
const ProgressBar =
|
|
2938
|
+
const ProgressBar = forwardRef((_O, ref) => {
|
|
2939
2939
|
var _P = _O, {
|
|
2940
2940
|
status = "normal",
|
|
2941
2941
|
percent,
|
|
@@ -2991,14 +2991,14 @@ const PromoBanner = ({
|
|
|
2991
2991
|
onClose,
|
|
2992
2992
|
onLinkClick
|
|
2993
2993
|
}) => {
|
|
2994
|
-
const containerRef =
|
|
2995
|
-
const [containerSize, setContainerSize] =
|
|
2994
|
+
const containerRef = useRef(null);
|
|
2995
|
+
const [containerSize, setContainerSize] = useState("medium");
|
|
2996
2996
|
const mergedClassNames = cx(styles$c[baseClass$i], {
|
|
2997
2997
|
[styles$c[`${baseClass$i}--light`]]: light,
|
|
2998
2998
|
[styles$c[`${baseClass$i}--small`]]: containerSize === "small",
|
|
2999
2999
|
[styles$c[`${baseClass$i}--large`]]: containerSize === "large"
|
|
3000
3000
|
}, className);
|
|
3001
|
-
|
|
3001
|
+
useEffect(() => {
|
|
3002
3002
|
const handleResize = () => {
|
|
3003
3003
|
if (containerRef.current && containerRef.current.offsetWidth <= SMALL_CONTAINER_WIDTH_TRESHOLD) {
|
|
3004
3004
|
return setContainerSize("small");
|
|
@@ -3062,7 +3062,7 @@ var styles$b = {
|
|
|
3062
3062
|
"radio-button--disabled": "lc-RadioButton-module__radio-button--disabled___wHSA7"
|
|
3063
3063
|
};
|
|
3064
3064
|
const baseClass$h = "radio-button";
|
|
3065
|
-
const RadioButton =
|
|
3065
|
+
const RadioButton = forwardRef((_Q, ref) => {
|
|
3066
3066
|
var _R = _Q, { children, className = "", description, checked, disabled } = _R, props = __objRest(_R, ["children", "className", "description", "checked", "disabled"]);
|
|
3067
3067
|
const mergedClassNames = cx(styles$b[baseClass$h], className, {
|
|
3068
3068
|
[styles$b[`${baseClass$h}--selected`]]: checked,
|
|
@@ -3116,13 +3116,13 @@ const SearchInput = ({
|
|
|
3116
3116
|
className,
|
|
3117
3117
|
onChange
|
|
3118
3118
|
}) => {
|
|
3119
|
-
const [isCollapsed, setIsCollapsed] =
|
|
3120
|
-
const [isFocused, setIsFocused] =
|
|
3121
|
-
const inputRef =
|
|
3119
|
+
const [isCollapsed, setIsCollapsed] = useState(true);
|
|
3120
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
3121
|
+
const inputRef = useRef(null);
|
|
3122
3122
|
const isCloseIconVisible = !!value && !isDisabled && !isLoading;
|
|
3123
3123
|
const ariaExpandedValue = isCollapsable && !isCollapsed && "true";
|
|
3124
3124
|
const mergedClassNames = cx(className, styles$a[baseClass$g], styles$a[`${baseClass$g}--${size}`], isFocused && styles$a[`${baseClass$g}--focused`], isDisabled && styles$a[`${baseClass$g}--disabled`], isCollapsable && styles$a[`${baseClass$g}--collapsable`], !isCollapsed && styles$a[`${baseClass$g}--collapsable--open`]);
|
|
3125
|
-
|
|
3125
|
+
useEffect(() => {
|
|
3126
3126
|
if (isCollapsable && !!value) {
|
|
3127
3127
|
setIsCollapsed(false);
|
|
3128
3128
|
}
|
|
@@ -3253,8 +3253,8 @@ const Switch = (_S) => {
|
|
|
3253
3253
|
"innerRef",
|
|
3254
3254
|
"ariaLabel"
|
|
3255
3255
|
]);
|
|
3256
|
-
const [checked, setChecked] =
|
|
3257
|
-
|
|
3256
|
+
const [checked, setChecked] = useState(() => on !== void 0 ? on : defaultOn);
|
|
3257
|
+
useEffect(() => {
|
|
3258
3258
|
if (on !== void 0) {
|
|
3259
3259
|
setChecked(on);
|
|
3260
3260
|
}
|
|
@@ -3382,7 +3382,7 @@ const EditableTagContent = ({
|
|
|
3382
3382
|
remove,
|
|
3383
3383
|
value
|
|
3384
3384
|
}) => {
|
|
3385
|
-
const [removed, setRemoved] =
|
|
3385
|
+
const [removed, setRemoved] = useState(false);
|
|
3386
3386
|
const getRef = () => innerEditableRef.current;
|
|
3387
3387
|
const getValue = () => {
|
|
3388
3388
|
const ref = getRef();
|
|
@@ -3449,10 +3449,10 @@ const EditableTag = ({
|
|
|
3449
3449
|
update,
|
|
3450
3450
|
size
|
|
3451
3451
|
}) => {
|
|
3452
|
-
const isValid =
|
|
3452
|
+
const isValid = useMemo(() => {
|
|
3453
3453
|
return validator !== void 0 ? validator(children) : true;
|
|
3454
3454
|
}, [children, validator]);
|
|
3455
|
-
const innerEditableRef =
|
|
3455
|
+
const innerEditableRef = useRef(null);
|
|
3456
3456
|
const removeTag = () => remove(index2);
|
|
3457
3457
|
return /* @__PURE__ */ React.createElement(Tag, {
|
|
3458
3458
|
kind: isValid ? "default" : "error",
|
|
@@ -3491,8 +3491,8 @@ const TagInput = ({
|
|
|
3491
3491
|
[styles$6[`${baseClass$b}--error`]]: error
|
|
3492
3492
|
});
|
|
3493
3493
|
const inputClassNames = cx(styles$6[`${baseClass$b}__input`], styles$6[`${baseClass$b}__input--${size}`]);
|
|
3494
|
-
const [inputValue, setInputValue] =
|
|
3495
|
-
const inputRef =
|
|
3494
|
+
const [inputValue, setInputValue] = useState("");
|
|
3495
|
+
const inputRef = useRef(null);
|
|
3496
3496
|
const addTag = (value) => {
|
|
3497
3497
|
onChange([...tags || [], value]);
|
|
3498
3498
|
setInputValue("");
|
|
@@ -3720,6 +3720,7 @@ var styles$4 = {
|
|
|
3720
3720
|
"tooltip-text": "lc-Tooltip-module__tooltip-text___FB8OV",
|
|
3721
3721
|
"tooltip-close": "lc-Tooltip-module__tooltip-close___3r3h9",
|
|
3722
3722
|
"tooltip-step": "lc-Tooltip-module__tooltip-step___-j0n8",
|
|
3723
|
+
"tooltip-footer": "lc-Tooltip-module__tooltip-footer___9hxFq",
|
|
3723
3724
|
"guide-tooltip--slide": "lc-Tooltip-module__guide-tooltip--slide___Uawm2",
|
|
3724
3725
|
"guide-tooltip__overlay": "lc-Tooltip-module__guide-tooltip__overlay___IyrKK",
|
|
3725
3726
|
"guide-tooltip__overlay--slide": "lc-Tooltip-module__guide-tooltip__overlay--slide___VW8oq",
|
|
@@ -3750,9 +3751,9 @@ const Tooltip = (props) => {
|
|
|
3750
3751
|
onClose
|
|
3751
3752
|
} = props;
|
|
3752
3753
|
const isManaged = isVisible !== void 0;
|
|
3753
|
-
const arrowRef =
|
|
3754
|
-
const [visible, setVisibility] =
|
|
3755
|
-
const isHovered =
|
|
3754
|
+
const arrowRef = useRef(null);
|
|
3755
|
+
const [visible, setVisibility] = useState(isVisible);
|
|
3756
|
+
const isHovered = useRef(false);
|
|
3756
3757
|
const {
|
|
3757
3758
|
x,
|
|
3758
3759
|
y,
|
|
@@ -3771,19 +3772,19 @@ const Tooltip = (props) => {
|
|
|
3771
3772
|
],
|
|
3772
3773
|
placement
|
|
3773
3774
|
});
|
|
3774
|
-
|
|
3775
|
+
useEffect(() => {
|
|
3775
3776
|
referenceElement && reference(referenceElement);
|
|
3776
3777
|
}, [reference, referenceElement]);
|
|
3777
|
-
|
|
3778
|
+
useEffect(() => {
|
|
3778
3779
|
setVisibility(isVisible);
|
|
3779
3780
|
}, [isVisible]);
|
|
3780
|
-
|
|
3781
|
+
useEffect(() => {
|
|
3781
3782
|
document.addEventListener("keydown", handleCloseAction);
|
|
3782
3783
|
return () => {
|
|
3783
3784
|
document.removeEventListener("keydown", handleCloseAction);
|
|
3784
3785
|
};
|
|
3785
3786
|
}, []);
|
|
3786
|
-
|
|
3787
|
+
useEffect(() => {
|
|
3787
3788
|
if (!refs.reference.current || !refs.floating.current) {
|
|
3788
3789
|
return;
|
|
3789
3790
|
}
|
|
@@ -3852,9 +3853,9 @@ const Tooltip = (props) => {
|
|
|
3852
3853
|
className: mergedClassNames,
|
|
3853
3854
|
onMouseEnter: handleMouseEnter,
|
|
3854
3855
|
onMouseLeave: handleMouseLeave
|
|
3855
|
-
},
|
|
3856
|
-
if (
|
|
3857
|
-
return
|
|
3856
|
+
}, Children.map(children, (child) => {
|
|
3857
|
+
if (isValidElement(child)) {
|
|
3858
|
+
return cloneElement(child, __spreadValues({
|
|
3858
3859
|
handleCloseAction,
|
|
3859
3860
|
theme
|
|
3860
3861
|
}, child.props));
|
|
@@ -3962,46 +3963,38 @@ const Interactive = ({
|
|
|
3962
3963
|
closeWithX,
|
|
3963
3964
|
theme,
|
|
3964
3965
|
handleCloseAction,
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
}) => {
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
style: {
|
|
3998
|
-
cursor: "pointer",
|
|
3999
|
-
display: "inline-block",
|
|
4000
|
-
marginLeft: "16px",
|
|
4001
|
-
textDecoration: decoration
|
|
4002
|
-
}
|
|
4003
|
-
}, "Link")));
|
|
4004
|
-
};
|
|
3966
|
+
primaryButton,
|
|
3967
|
+
secondaryButton
|
|
3968
|
+
}) => /* @__PURE__ */ React.createElement("div", {
|
|
3969
|
+
style: { width: "270px" }
|
|
3970
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3971
|
+
style: { position: "relative", height: "25px", marginBottom: "10px" }
|
|
3972
|
+
}, closeWithX && /* @__PURE__ */ React.createElement("div", {
|
|
3973
|
+
className: styles$4[`${baseClass$6}-close`]
|
|
3974
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3975
|
+
onClick: handleCloseAction
|
|
3976
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
3977
|
+
source: Close,
|
|
3978
|
+
kind: theme ? getIconType(theme) : "primary"
|
|
3979
|
+
})))), image && /* @__PURE__ */ React.createElement("div", {
|
|
3980
|
+
style: { margin: "0 4px" }
|
|
3981
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
3982
|
+
className: styles$4[`${baseClass$6}-image`],
|
|
3983
|
+
src: image.src,
|
|
3984
|
+
alt: image.alt
|
|
3985
|
+
})), header && /* @__PURE__ */ React.createElement("div", {
|
|
3986
|
+
className: styles$4[`${baseClass$6}-header`]
|
|
3987
|
+
}, header), /* @__PURE__ */ React.createElement("div", {
|
|
3988
|
+
className: styles$4[`${baseClass$6}-text`]
|
|
3989
|
+
}, text), /* @__PURE__ */ React.createElement("div", {
|
|
3990
|
+
className: styles$4[`${baseClass$6}-footer`]
|
|
3991
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
3992
|
+
kind: primaryButton.kind || "primary",
|
|
3993
|
+
onClick: primaryButton.handleClick
|
|
3994
|
+
}, primaryButton.label), /* @__PURE__ */ React.createElement(Button, {
|
|
3995
|
+
kind: secondaryButton.kind || "secondary",
|
|
3996
|
+
onClick: secondaryButton.handleClick
|
|
3997
|
+
}, secondaryButton.label)));
|
|
4005
3998
|
const baseClass$5 = "guide-tooltip";
|
|
4006
3999
|
const SpotlightOverlay = ({
|
|
4007
4000
|
gap,
|
|
@@ -4126,16 +4119,16 @@ const UserGuide = (props) => {
|
|
|
4126
4119
|
isVisible = false,
|
|
4127
4120
|
shouldSlide = true
|
|
4128
4121
|
} = props;
|
|
4129
|
-
const [parentElement, setParentElement] =
|
|
4130
|
-
const [rect, setRect] =
|
|
4131
|
-
const [isSliding, setIsSliding] =
|
|
4122
|
+
const [parentElement, setParentElement] = useState(null);
|
|
4123
|
+
const [rect, setRect] = useState(null);
|
|
4124
|
+
const [isSliding, setIsSliding] = useState(shouldSlide);
|
|
4132
4125
|
const handleViewportChange = () => {
|
|
4133
4126
|
if (parentElement) {
|
|
4134
4127
|
setRect(virtualReference(parentElement, spotlightPadding).getBoundingClientRect());
|
|
4135
4128
|
setIsSliding(false);
|
|
4136
4129
|
}
|
|
4137
4130
|
};
|
|
4138
|
-
|
|
4131
|
+
useEffect(() => {
|
|
4139
4132
|
if (parentElement !== null) {
|
|
4140
4133
|
window.addEventListener("resize", handleViewportChange);
|
|
4141
4134
|
window.addEventListener("scroll", handleViewportChange);
|
|
@@ -4145,13 +4138,13 @@ const UserGuide = (props) => {
|
|
|
4145
4138
|
};
|
|
4146
4139
|
}
|
|
4147
4140
|
}, [parentElement, parentElementName]);
|
|
4148
|
-
|
|
4141
|
+
useEffect(() => {
|
|
4149
4142
|
if (parentElementName) {
|
|
4150
4143
|
const element = document.querySelector(parentElementName);
|
|
4151
4144
|
setParentElement(element);
|
|
4152
4145
|
}
|
|
4153
4146
|
}, [parentElementName]);
|
|
4154
|
-
|
|
4147
|
+
useEffect(() => {
|
|
4155
4148
|
parentElement && setRect(virtualReference(parentElement, spotlightPadding).getBoundingClientRect());
|
|
4156
4149
|
setIsSliding(true);
|
|
4157
4150
|
}, [parentElement]);
|
|
@@ -4183,10 +4176,10 @@ var styles$3 = {
|
|
|
4183
4176
|
"textarea--error": "lc-Textarea-module__textarea--error___0EGuq"
|
|
4184
4177
|
};
|
|
4185
4178
|
const baseClass$3 = "textarea";
|
|
4186
|
-
const Textarea =
|
|
4179
|
+
const Textarea = forwardRef((_Y, ref) => {
|
|
4187
4180
|
var _Z = _Y, { className, error } = _Z, textareaProps = __objRest(_Z, ["className", "error"]);
|
|
4188
4181
|
const { disabled } = textareaProps;
|
|
4189
|
-
const [isFocused, setIsFocused] =
|
|
4182
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
4190
4183
|
const mergedClassNames = cx(className, styles$3[baseClass$3], {
|
|
4191
4184
|
[styles$3[`${baseClass$3}--disabled`]]: disabled,
|
|
4192
4185
|
[styles$3[`${baseClass$3}--focused`]]: isFocused,
|
|
@@ -4218,7 +4211,11 @@ var styles$1 = {
|
|
|
4218
4211
|
"file-upload-progress-actions__retry-button": "lc-FileUploadProgressActions-module__file-upload-progress-actions__retry-button___DqFEo"
|
|
4219
4212
|
};
|
|
4220
4213
|
const baseClass$2 = "file-upload-progress-actions";
|
|
4221
|
-
const FileUploadProgressActions = ({
|
|
4214
|
+
const FileUploadProgressActions = ({
|
|
4215
|
+
status,
|
|
4216
|
+
onCloseButtonClick,
|
|
4217
|
+
onRetryButtonClick
|
|
4218
|
+
}) => {
|
|
4222
4219
|
return /* @__PURE__ */ React.createElement("div", {
|
|
4223
4220
|
className: styles$1[`${baseClass$2}`]
|
|
4224
4221
|
}, onRetryButtonClick && status === "error" && /* @__PURE__ */ React.createElement("button", {
|
|
@@ -4239,7 +4236,7 @@ const FileUploadProgressActions = ({ status, onCloseButtonClick, onRetryButtonCl
|
|
|
4239
4236
|
};
|
|
4240
4237
|
const baseClass$1 = "file-upload-progress";
|
|
4241
4238
|
const wrapperHeaderTitleClass = `${baseClass$1}__wrapper__header__title`;
|
|
4242
|
-
const FileUploadProgress =
|
|
4239
|
+
const FileUploadProgress = forwardRef(({
|
|
4243
4240
|
actionsVisibility = "hidden",
|
|
4244
4241
|
className,
|
|
4245
4242
|
icon: icon2,
|
|
@@ -4343,7 +4340,7 @@ const UploadBar = ({
|
|
|
4343
4340
|
onCloseButtonClick,
|
|
4344
4341
|
onRetryButtonClick
|
|
4345
4342
|
}) => {
|
|
4346
|
-
const [expanded, setExpanded] =
|
|
4343
|
+
const [expanded, setExpanded] = useState(isExpanded || false);
|
|
4347
4344
|
const withError = status === "error";
|
|
4348
4345
|
const withSuccess = status === "success";
|
|
4349
4346
|
const mergedClassNames = cx(styles[baseClass], className, {
|