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