@livechat/design-system-react-components 1.0.0-alpha.40 → 1.0.0-alpha.42
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 +124 -128
- 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, cloneElement, forwardRef, 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", {
|
|
@@ -794,7 +793,7 @@ const Button = (_i) => {
|
|
|
794
793
|
size: "small",
|
|
795
794
|
label: loaderLabel,
|
|
796
795
|
className: styles$y[`${baseClass$H}__loader`]
|
|
797
|
-
}, getSpinnerColors())), icon2 &&
|
|
796
|
+
}, getSpinnerColors())), icon2 && cloneElement(icon2, {
|
|
798
797
|
className: cx(styles$y[`${baseClass$H}__icon`], styles$y[`${baseClass$H}__icon--${iconPosition}`]),
|
|
799
798
|
disabled
|
|
800
799
|
}), /* @__PURE__ */ React.createElement("div", {
|
|
@@ -823,9 +822,9 @@ const SegmentedControl = ({
|
|
|
823
822
|
onButtonClick = noop
|
|
824
823
|
}) => {
|
|
825
824
|
const mergedClassName = cx(styles$x[baseClass$G], className);
|
|
826
|
-
const [currentStateId, setCurrentStateId] =
|
|
825
|
+
const [currentStateId, setCurrentStateId] = useState(() => initialId);
|
|
827
826
|
const isControlled = typeof currentId === "string";
|
|
828
|
-
|
|
827
|
+
useEffect(() => {
|
|
829
828
|
isControlled && setCurrentStateId(currentId);
|
|
830
829
|
}, [currentId]);
|
|
831
830
|
const handleClick = (id, event) => {
|
|
@@ -907,7 +906,7 @@ const Card = (_k) => {
|
|
|
907
906
|
"src",
|
|
908
907
|
"title"
|
|
909
908
|
]);
|
|
910
|
-
const [isExpanded, setIsExpanded] =
|
|
909
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
911
910
|
const expandIcon = isExpanded ? ChevronUp : ChevronDown;
|
|
912
911
|
const expandButtonText = isExpanded ? "Hide" : "Show more";
|
|
913
912
|
const shouldShowActionButtons = (buttonsOptions == null ? void 0 : buttonsOptions.length) > 0;
|
|
@@ -999,7 +998,7 @@ var styles$u = {
|
|
|
999
998
|
checkbox__helper
|
|
1000
999
|
};
|
|
1001
1000
|
const baseClass$D = "checkbox";
|
|
1002
|
-
const Checkbox =
|
|
1001
|
+
const Checkbox = forwardRef((_o, ref) => {
|
|
1003
1002
|
var _p = _o, { checked, disabled, children, description, className } = _p, restInputProps = __objRest(_p, ["checked", "disabled", "children", "description", "className"]);
|
|
1004
1003
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1005
1004
|
className: cx(styles$u[baseClass$D], className, {
|
|
@@ -1297,20 +1296,20 @@ const DatePickerComponent = (props) => {
|
|
|
1297
1296
|
"renderDay",
|
|
1298
1297
|
"innerRef"
|
|
1299
1298
|
]);
|
|
1300
|
-
const [currentMonth, setCurrentMonth] =
|
|
1301
|
-
|
|
1299
|
+
const [currentMonth, setCurrentMonth] = useState(month || new Date());
|
|
1300
|
+
useEffect(() => {
|
|
1302
1301
|
if (month && month !== currentMonth) {
|
|
1303
1302
|
setCurrentMonth(month);
|
|
1304
1303
|
}
|
|
1305
1304
|
}, [month, currentMonth]);
|
|
1306
|
-
|
|
1305
|
+
useEffect(() => {
|
|
1307
1306
|
if (toMonth) {
|
|
1308
1307
|
if (!isDateWithinRange(currentMonth, { from: fromMonth, to: toMonth })) {
|
|
1309
1308
|
setCurrentMonth(toMonth);
|
|
1310
1309
|
}
|
|
1311
1310
|
}
|
|
1312
1311
|
}, [currentMonth, props.toMonth, props.fromMonth]);
|
|
1313
|
-
const handleMonthChange =
|
|
1312
|
+
const handleMonthChange = useCallback((month2) => {
|
|
1314
1313
|
if (props.onMonthChange && month2) {
|
|
1315
1314
|
props.onMonthChange(month2);
|
|
1316
1315
|
return;
|
|
@@ -1321,7 +1320,7 @@ const DatePickerComponent = (props) => {
|
|
|
1321
1320
|
if (propsFirstDayOfWeek === 0 || propsFirstDayOfWeek && propsFirstDayOfWeek < 7) {
|
|
1322
1321
|
firstDayOfWeek = propsFirstDayOfWeek;
|
|
1323
1322
|
}
|
|
1324
|
-
const datePickerClassNames =
|
|
1323
|
+
const datePickerClassNames = useMemo(() => getDatePickerClassNames(range, classNames), [range, classNames]);
|
|
1325
1324
|
return /* @__PURE__ */ React.createElement(ReactDayPicker, __spreadValues({
|
|
1326
1325
|
navbarElement: navbarElement || /* @__PURE__ */ React.createElement(DatePickerNavbar, {
|
|
1327
1326
|
month: currentMonth,
|
|
@@ -1341,7 +1340,7 @@ const DatePickerComponent = (props) => {
|
|
|
1341
1340
|
renderDay: renderDay || defaultDayRenderer
|
|
1342
1341
|
}, restProps));
|
|
1343
1342
|
};
|
|
1344
|
-
const DatePicker =
|
|
1343
|
+
const DatePicker = forwardRef((props, ref) => /* @__PURE__ */ React.createElement(DatePickerComponent, __spreadValues({
|
|
1345
1344
|
innerRef: ref
|
|
1346
1345
|
}, props)));
|
|
1347
1346
|
DatePicker.displayName = "DatePicker";
|
|
@@ -1715,7 +1714,7 @@ const FormField = ({
|
|
|
1715
1714
|
}, className);
|
|
1716
1715
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1717
1716
|
className: mergedClassNames
|
|
1718
|
-
}, labelRightNode && inline && /* @__PURE__ */ React.createElement(
|
|
1717
|
+
}, labelRightNode && inline && /* @__PURE__ */ React.createElement(Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
1719
1718
|
className: cx(styles$p[`${baseClass$w}__label-right-node`], styles$p[`${baseClass$w}__label-right-node--inline`])
|
|
1720
1719
|
}, labelRightNode), /* @__PURE__ */ React.createElement("div", {
|
|
1721
1720
|
className: styles$p[`${baseClass$w}__row-break`]
|
|
@@ -1790,13 +1789,13 @@ var styles$n = {
|
|
|
1790
1789
|
"input__visibility-button": "lc-Input-module__input__visibility-button___eWrVe"
|
|
1791
1790
|
};
|
|
1792
1791
|
const baseClass$u = "input";
|
|
1793
|
-
const renderIcon = (icon2, disabled) =>
|
|
1792
|
+
const renderIcon = (icon2, disabled) => cloneElement(icon2.source, {
|
|
1794
1793
|
["data-testid"]: `input-icon-${icon2.place}`,
|
|
1795
1794
|
className: cx(styles$n[`${baseClass$u}__icon`], styles$n[`${baseClass$u}__icon--${icon2.place}`], {
|
|
1796
1795
|
[styles$n[`${baseClass$u}__icon--disabled`]]: disabled
|
|
1797
1796
|
})
|
|
1798
1797
|
});
|
|
1799
|
-
const Input =
|
|
1798
|
+
const Input = forwardRef((_y, ref) => {
|
|
1800
1799
|
var _z = _y, {
|
|
1801
1800
|
inputSize = "medium",
|
|
1802
1801
|
error = false,
|
|
@@ -1810,8 +1809,8 @@ const Input = React.forwardRef((_y, ref) => {
|
|
|
1810
1809
|
"icon",
|
|
1811
1810
|
"className"
|
|
1812
1811
|
]);
|
|
1813
|
-
const [isFocused, setIsFocused] =
|
|
1814
|
-
const [isPasswordVisible, setIsPasswordVisible] =
|
|
1812
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
1813
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
1815
1814
|
const { type, onFocus, onBlur } = inputProps;
|
|
1816
1815
|
const mergedClassNames = cx(className, styles$n[baseClass$u], styles$n[`${baseClass$u}--${inputSize}`], {
|
|
1817
1816
|
[styles$n[`${baseClass$u}--disabled`]]: disabled,
|
|
@@ -1915,7 +1914,7 @@ const ModalBase = (_C) => {
|
|
|
1915
1914
|
"closeOnOverlayPress"
|
|
1916
1915
|
]);
|
|
1917
1916
|
const mergedClassNames = cx(styles$l[baseClass$s], className);
|
|
1918
|
-
|
|
1917
|
+
useEffect(() => {
|
|
1919
1918
|
if (!closeOnEscPress) {
|
|
1920
1919
|
return;
|
|
1921
1920
|
}
|
|
@@ -2015,14 +2014,14 @@ const ModalPortal = ({
|
|
|
2015
2014
|
parentElementName = "body",
|
|
2016
2015
|
zIndex
|
|
2017
2016
|
}) => {
|
|
2018
|
-
const [container] =
|
|
2017
|
+
const [container] = useState(() => document.createElement("div"));
|
|
2019
2018
|
if (className) {
|
|
2020
2019
|
container.classList.add(className);
|
|
2021
2020
|
}
|
|
2022
2021
|
if (zIndex) {
|
|
2023
2022
|
container.style.zIndex = zIndex.toString();
|
|
2024
2023
|
}
|
|
2025
|
-
|
|
2024
|
+
useEffect(() => {
|
|
2026
2025
|
var _a;
|
|
2027
2026
|
(_a = document.querySelector(parentElementName)) == null ? void 0 : _a.appendChild(container);
|
|
2028
2027
|
return () => {
|
|
@@ -2063,7 +2062,7 @@ const NumericInput = (_G) => {
|
|
|
2063
2062
|
"style",
|
|
2064
2063
|
"onChange"
|
|
2065
2064
|
]);
|
|
2066
|
-
const inputRef =
|
|
2065
|
+
const inputRef = useRef(null);
|
|
2067
2066
|
const mergedClassNames = cx(styles$k[baseClass$q], {
|
|
2068
2067
|
[styles$k[`${baseClass$q}--error`]]: error,
|
|
2069
2068
|
[styles$k[`${baseClass$q}--no-controls`]]: noControls,
|
|
@@ -2182,9 +2181,9 @@ const Trigger = ({
|
|
|
2182
2181
|
onTrigger,
|
|
2183
2182
|
onClear
|
|
2184
2183
|
}) => {
|
|
2185
|
-
const triggerRef =
|
|
2184
|
+
const triggerRef = useRef(null);
|
|
2186
2185
|
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
|
-
|
|
2186
|
+
useEffect(() => {
|
|
2188
2187
|
const onKeyDown = (e) => {
|
|
2189
2188
|
const isFocused = document.activeElement === triggerRef.current;
|
|
2190
2189
|
if (isFocused && e.key !== KeyCodes.tab) {
|
|
@@ -2257,10 +2256,10 @@ const PickerList = ({
|
|
|
2257
2256
|
const mergedClassNames = cx(styles$i[baseClass$o], {
|
|
2258
2257
|
[styles$i[`${baseClass$o}__no-results`]]: items.length === 0
|
|
2259
2258
|
});
|
|
2260
|
-
const [currentItemKey, setCurrentItemKey] =
|
|
2261
|
-
const indexRef =
|
|
2262
|
-
const lastIndexRef =
|
|
2263
|
-
const listRef =
|
|
2259
|
+
const [currentItemKey, setCurrentItemKey] = useState(null);
|
|
2260
|
+
const indexRef = useRef(-1);
|
|
2261
|
+
const lastIndexRef = useRef(0);
|
|
2262
|
+
const listRef = useRef(null);
|
|
2264
2263
|
const onKeyDown = (e) => {
|
|
2265
2264
|
if (e.key === KeyCodes.esc) {
|
|
2266
2265
|
e.preventDefault();
|
|
@@ -2284,7 +2283,7 @@ const PickerList = ({
|
|
|
2284
2283
|
onSelect(items[indexRef.current]);
|
|
2285
2284
|
}
|
|
2286
2285
|
};
|
|
2287
|
-
|
|
2286
|
+
useEffect(() => {
|
|
2288
2287
|
if (indexRef.current > -1 && items.length > 0) {
|
|
2289
2288
|
setCurrentItemKey(items[indexRef.current].key);
|
|
2290
2289
|
}
|
|
@@ -2617,11 +2616,11 @@ const Picker = (_K) => {
|
|
|
2617
2616
|
"searchDisabled",
|
|
2618
2617
|
"onSelect"
|
|
2619
2618
|
]);
|
|
2620
|
-
const [isListOpen, setIsListOpen] =
|
|
2621
|
-
const [searchPhrase, setSearchPhrase] =
|
|
2622
|
-
const triggerRef =
|
|
2619
|
+
const [isListOpen, setIsListOpen] = useState(false);
|
|
2620
|
+
const [searchPhrase, setSearchPhrase] = useState(null);
|
|
2621
|
+
const triggerRef = useRef(null);
|
|
2623
2622
|
const mergedClassNames = cx(styles$h[baseClass$l], className);
|
|
2624
|
-
|
|
2623
|
+
useEffect(() => {
|
|
2625
2624
|
if (isListOpen) {
|
|
2626
2625
|
const onDocumentClick = (e) => {
|
|
2627
2626
|
var _a;
|
|
@@ -2689,7 +2688,7 @@ const Picker = (_K) => {
|
|
|
2689
2688
|
}
|
|
2690
2689
|
onSelect(newSelectedItems);
|
|
2691
2690
|
};
|
|
2692
|
-
const items =
|
|
2691
|
+
const items = useMemo(() => {
|
|
2693
2692
|
if (!searchPhrase) {
|
|
2694
2693
|
return options;
|
|
2695
2694
|
}
|
|
@@ -2702,7 +2701,7 @@ const Picker = (_K) => {
|
|
|
2702
2701
|
return itemName.includes(search);
|
|
2703
2702
|
});
|
|
2704
2703
|
}, [searchPhrase]);
|
|
2705
|
-
const selectedItemsKeys =
|
|
2704
|
+
const selectedItemsKeys = useMemo(() => {
|
|
2706
2705
|
if (!selected) {
|
|
2707
2706
|
return null;
|
|
2708
2707
|
}
|
|
@@ -2761,8 +2760,8 @@ const Popover = (props) => {
|
|
|
2761
2760
|
flipOptions,
|
|
2762
2761
|
isVisible = false
|
|
2763
2762
|
} = props;
|
|
2764
|
-
const [visible, setVisibility] =
|
|
2765
|
-
const prevVisibleState =
|
|
2763
|
+
const [visible, setVisibility] = useState(false);
|
|
2764
|
+
const prevVisibleState = useRef(false);
|
|
2766
2765
|
const {
|
|
2767
2766
|
x,
|
|
2768
2767
|
y,
|
|
@@ -2776,16 +2775,16 @@ const Popover = (props) => {
|
|
|
2776
2775
|
middleware: [offset(4), flip(flipOptions)],
|
|
2777
2776
|
placement
|
|
2778
2777
|
});
|
|
2779
|
-
|
|
2778
|
+
useEffect(() => {
|
|
2780
2779
|
setVisibility(isVisible);
|
|
2781
2780
|
}, [isVisible]);
|
|
2782
|
-
|
|
2781
|
+
useEffect(() => {
|
|
2783
2782
|
if (onClose && prevVisibleState.current !== visible && !visible) {
|
|
2784
2783
|
onClose();
|
|
2785
2784
|
}
|
|
2786
2785
|
prevVisibleState.current = visible;
|
|
2787
2786
|
}, [visible]);
|
|
2788
|
-
|
|
2787
|
+
useEffect(() => {
|
|
2789
2788
|
if (!refs.reference.current || !refs.floating.current) {
|
|
2790
2789
|
return;
|
|
2791
2790
|
}
|
|
@@ -2805,7 +2804,7 @@ const Popover = (props) => {
|
|
|
2805
2804
|
setVisibility(false);
|
|
2806
2805
|
}
|
|
2807
2806
|
};
|
|
2808
|
-
|
|
2807
|
+
useEffect(() => {
|
|
2809
2808
|
document.addEventListener("keydown", handleHideOnEscape);
|
|
2810
2809
|
document.addEventListener("mousedown", handleDocumentClick);
|
|
2811
2810
|
return () => {
|
|
@@ -2874,7 +2873,7 @@ const SIZE_VALUE_FROM_SIZE = {
|
|
|
2874
2873
|
large: 56
|
|
2875
2874
|
};
|
|
2876
2875
|
const baseClass$k = "progress-circle";
|
|
2877
|
-
const ProgressCircle =
|
|
2876
|
+
const ProgressCircle = forwardRef((_M, ref) => {
|
|
2878
2877
|
var _N = _M, {
|
|
2879
2878
|
status = "normal",
|
|
2880
2879
|
progressValue,
|
|
@@ -2935,7 +2934,7 @@ var styles$d = {
|
|
|
2935
2934
|
"progress-bar__indicator--normal": "lc-ProgressBar-module__progress-bar__indicator--normal___0Uhle"
|
|
2936
2935
|
};
|
|
2937
2936
|
const baseClass$j = "progress-bar";
|
|
2938
|
-
const ProgressBar =
|
|
2937
|
+
const ProgressBar = forwardRef((_O, ref) => {
|
|
2939
2938
|
var _P = _O, {
|
|
2940
2939
|
status = "normal",
|
|
2941
2940
|
percent,
|
|
@@ -2991,14 +2990,14 @@ const PromoBanner = ({
|
|
|
2991
2990
|
onClose,
|
|
2992
2991
|
onLinkClick
|
|
2993
2992
|
}) => {
|
|
2994
|
-
const containerRef =
|
|
2995
|
-
const [containerSize, setContainerSize] =
|
|
2993
|
+
const containerRef = useRef(null);
|
|
2994
|
+
const [containerSize, setContainerSize] = useState("medium");
|
|
2996
2995
|
const mergedClassNames = cx(styles$c[baseClass$i], {
|
|
2997
2996
|
[styles$c[`${baseClass$i}--light`]]: light,
|
|
2998
2997
|
[styles$c[`${baseClass$i}--small`]]: containerSize === "small",
|
|
2999
2998
|
[styles$c[`${baseClass$i}--large`]]: containerSize === "large"
|
|
3000
2999
|
}, className);
|
|
3001
|
-
|
|
3000
|
+
useEffect(() => {
|
|
3002
3001
|
const handleResize = () => {
|
|
3003
3002
|
if (containerRef.current && containerRef.current.offsetWidth <= SMALL_CONTAINER_WIDTH_TRESHOLD) {
|
|
3004
3003
|
return setContainerSize("small");
|
|
@@ -3062,7 +3061,7 @@ var styles$b = {
|
|
|
3062
3061
|
"radio-button--disabled": "lc-RadioButton-module__radio-button--disabled___wHSA7"
|
|
3063
3062
|
};
|
|
3064
3063
|
const baseClass$h = "radio-button";
|
|
3065
|
-
const RadioButton =
|
|
3064
|
+
const RadioButton = forwardRef((_Q, ref) => {
|
|
3066
3065
|
var _R = _Q, { children, className = "", description, checked, disabled } = _R, props = __objRest(_R, ["children", "className", "description", "checked", "disabled"]);
|
|
3067
3066
|
const mergedClassNames = cx(styles$b[baseClass$h], className, {
|
|
3068
3067
|
[styles$b[`${baseClass$h}--selected`]]: checked,
|
|
@@ -3116,13 +3115,13 @@ const SearchInput = ({
|
|
|
3116
3115
|
className,
|
|
3117
3116
|
onChange
|
|
3118
3117
|
}) => {
|
|
3119
|
-
const [isCollapsed, setIsCollapsed] =
|
|
3120
|
-
const [isFocused, setIsFocused] =
|
|
3121
|
-
const inputRef =
|
|
3118
|
+
const [isCollapsed, setIsCollapsed] = useState(true);
|
|
3119
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
3120
|
+
const inputRef = useRef(null);
|
|
3122
3121
|
const isCloseIconVisible = !!value && !isDisabled && !isLoading;
|
|
3123
3122
|
const ariaExpandedValue = isCollapsable && !isCollapsed && "true";
|
|
3124
3123
|
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
|
-
|
|
3124
|
+
useEffect(() => {
|
|
3126
3125
|
if (isCollapsable && !!value) {
|
|
3127
3126
|
setIsCollapsed(false);
|
|
3128
3127
|
}
|
|
@@ -3253,8 +3252,8 @@ const Switch = (_S) => {
|
|
|
3253
3252
|
"innerRef",
|
|
3254
3253
|
"ariaLabel"
|
|
3255
3254
|
]);
|
|
3256
|
-
const [checked, setChecked] =
|
|
3257
|
-
|
|
3255
|
+
const [checked, setChecked] = useState(() => on !== void 0 ? on : defaultOn);
|
|
3256
|
+
useEffect(() => {
|
|
3258
3257
|
if (on !== void 0) {
|
|
3259
3258
|
setChecked(on);
|
|
3260
3259
|
}
|
|
@@ -3382,7 +3381,7 @@ const EditableTagContent = ({
|
|
|
3382
3381
|
remove,
|
|
3383
3382
|
value
|
|
3384
3383
|
}) => {
|
|
3385
|
-
const [removed, setRemoved] =
|
|
3384
|
+
const [removed, setRemoved] = useState(false);
|
|
3386
3385
|
const getRef = () => innerEditableRef.current;
|
|
3387
3386
|
const getValue = () => {
|
|
3388
3387
|
const ref = getRef();
|
|
@@ -3449,10 +3448,10 @@ const EditableTag = ({
|
|
|
3449
3448
|
update,
|
|
3450
3449
|
size
|
|
3451
3450
|
}) => {
|
|
3452
|
-
const isValid =
|
|
3451
|
+
const isValid = useMemo(() => {
|
|
3453
3452
|
return validator !== void 0 ? validator(children) : true;
|
|
3454
3453
|
}, [children, validator]);
|
|
3455
|
-
const innerEditableRef =
|
|
3454
|
+
const innerEditableRef = useRef(null);
|
|
3456
3455
|
const removeTag = () => remove(index2);
|
|
3457
3456
|
return /* @__PURE__ */ React.createElement(Tag, {
|
|
3458
3457
|
kind: isValid ? "default" : "error",
|
|
@@ -3491,8 +3490,8 @@ const TagInput = ({
|
|
|
3491
3490
|
[styles$6[`${baseClass$b}--error`]]: error
|
|
3492
3491
|
});
|
|
3493
3492
|
const inputClassNames = cx(styles$6[`${baseClass$b}__input`], styles$6[`${baseClass$b}__input--${size}`]);
|
|
3494
|
-
const [inputValue, setInputValue] =
|
|
3495
|
-
const inputRef =
|
|
3493
|
+
const [inputValue, setInputValue] = useState("");
|
|
3494
|
+
const inputRef = useRef(null);
|
|
3496
3495
|
const addTag = (value) => {
|
|
3497
3496
|
onChange([...tags || [], value]);
|
|
3498
3497
|
setInputValue("");
|
|
@@ -3720,6 +3719,7 @@ var styles$4 = {
|
|
|
3720
3719
|
"tooltip-text": "lc-Tooltip-module__tooltip-text___FB8OV",
|
|
3721
3720
|
"tooltip-close": "lc-Tooltip-module__tooltip-close___3r3h9",
|
|
3722
3721
|
"tooltip-step": "lc-Tooltip-module__tooltip-step___-j0n8",
|
|
3722
|
+
"tooltip-footer": "lc-Tooltip-module__tooltip-footer___9hxFq",
|
|
3723
3723
|
"guide-tooltip--slide": "lc-Tooltip-module__guide-tooltip--slide___Uawm2",
|
|
3724
3724
|
"guide-tooltip__overlay": "lc-Tooltip-module__guide-tooltip__overlay___IyrKK",
|
|
3725
3725
|
"guide-tooltip__overlay--slide": "lc-Tooltip-module__guide-tooltip__overlay--slide___VW8oq",
|
|
@@ -3750,9 +3750,9 @@ const Tooltip = (props) => {
|
|
|
3750
3750
|
onClose
|
|
3751
3751
|
} = props;
|
|
3752
3752
|
const isManaged = isVisible !== void 0;
|
|
3753
|
-
const arrowRef =
|
|
3754
|
-
const [visible, setVisibility] =
|
|
3755
|
-
const isHovered =
|
|
3753
|
+
const arrowRef = useRef(null);
|
|
3754
|
+
const [visible, setVisibility] = useState(isVisible);
|
|
3755
|
+
const isHovered = useRef(false);
|
|
3756
3756
|
const {
|
|
3757
3757
|
x,
|
|
3758
3758
|
y,
|
|
@@ -3771,19 +3771,19 @@ const Tooltip = (props) => {
|
|
|
3771
3771
|
],
|
|
3772
3772
|
placement
|
|
3773
3773
|
});
|
|
3774
|
-
|
|
3774
|
+
useEffect(() => {
|
|
3775
3775
|
referenceElement && reference(referenceElement);
|
|
3776
3776
|
}, [reference, referenceElement]);
|
|
3777
|
-
|
|
3777
|
+
useEffect(() => {
|
|
3778
3778
|
setVisibility(isVisible);
|
|
3779
3779
|
}, [isVisible]);
|
|
3780
|
-
|
|
3780
|
+
useEffect(() => {
|
|
3781
3781
|
document.addEventListener("keydown", handleCloseAction);
|
|
3782
3782
|
return () => {
|
|
3783
3783
|
document.removeEventListener("keydown", handleCloseAction);
|
|
3784
3784
|
};
|
|
3785
3785
|
}, []);
|
|
3786
|
-
|
|
3786
|
+
useEffect(() => {
|
|
3787
3787
|
if (!refs.reference.current || !refs.floating.current) {
|
|
3788
3788
|
return;
|
|
3789
3789
|
}
|
|
@@ -3852,9 +3852,9 @@ const Tooltip = (props) => {
|
|
|
3852
3852
|
className: mergedClassNames,
|
|
3853
3853
|
onMouseEnter: handleMouseEnter,
|
|
3854
3854
|
onMouseLeave: handleMouseLeave
|
|
3855
|
-
},
|
|
3856
|
-
if (
|
|
3857
|
-
return
|
|
3855
|
+
}, Children.map(children, (child) => {
|
|
3856
|
+
if (isValidElement(child)) {
|
|
3857
|
+
return cloneElement(child, __spreadValues({
|
|
3858
3858
|
handleCloseAction,
|
|
3859
3859
|
theme
|
|
3860
3860
|
}, child.props));
|
|
@@ -3962,46 +3962,38 @@ const Interactive = ({
|
|
|
3962
3962
|
closeWithX,
|
|
3963
3963
|
theme,
|
|
3964
3964
|
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
|
-
};
|
|
3965
|
+
primaryButton,
|
|
3966
|
+
secondaryButton
|
|
3967
|
+
}) => /* @__PURE__ */ React.createElement("div", {
|
|
3968
|
+
style: { width: "270px" }
|
|
3969
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3970
|
+
style: { position: "relative", height: "25px", marginBottom: "10px" }
|
|
3971
|
+
}, closeWithX && /* @__PURE__ */ React.createElement("div", {
|
|
3972
|
+
className: styles$4[`${baseClass$6}-close`]
|
|
3973
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3974
|
+
onClick: handleCloseAction
|
|
3975
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
3976
|
+
source: Close,
|
|
3977
|
+
kind: theme ? getIconType(theme) : "primary"
|
|
3978
|
+
})))), image && /* @__PURE__ */ React.createElement("div", {
|
|
3979
|
+
style: { margin: "0 4px" }
|
|
3980
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
3981
|
+
className: styles$4[`${baseClass$6}-image`],
|
|
3982
|
+
src: image.src,
|
|
3983
|
+
alt: image.alt
|
|
3984
|
+
})), header && /* @__PURE__ */ React.createElement("div", {
|
|
3985
|
+
className: styles$4[`${baseClass$6}-header`]
|
|
3986
|
+
}, header), /* @__PURE__ */ React.createElement("div", {
|
|
3987
|
+
className: styles$4[`${baseClass$6}-text`]
|
|
3988
|
+
}, text), /* @__PURE__ */ React.createElement("div", {
|
|
3989
|
+
className: styles$4[`${baseClass$6}-footer`]
|
|
3990
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
3991
|
+
kind: primaryButton.kind || "primary",
|
|
3992
|
+
onClick: primaryButton.handleClick
|
|
3993
|
+
}, primaryButton.label), /* @__PURE__ */ React.createElement(Button, {
|
|
3994
|
+
kind: secondaryButton.kind || "secondary",
|
|
3995
|
+
onClick: secondaryButton.handleClick
|
|
3996
|
+
}, secondaryButton.label)));
|
|
4005
3997
|
const baseClass$5 = "guide-tooltip";
|
|
4006
3998
|
const SpotlightOverlay = ({
|
|
4007
3999
|
gap,
|
|
@@ -4126,16 +4118,16 @@ const UserGuide = (props) => {
|
|
|
4126
4118
|
isVisible = false,
|
|
4127
4119
|
shouldSlide = true
|
|
4128
4120
|
} = props;
|
|
4129
|
-
const [parentElement, setParentElement] =
|
|
4130
|
-
const [rect, setRect] =
|
|
4131
|
-
const [isSliding, setIsSliding] =
|
|
4121
|
+
const [parentElement, setParentElement] = useState(null);
|
|
4122
|
+
const [rect, setRect] = useState(null);
|
|
4123
|
+
const [isSliding, setIsSliding] = useState(shouldSlide);
|
|
4132
4124
|
const handleViewportChange = () => {
|
|
4133
4125
|
if (parentElement) {
|
|
4134
4126
|
setRect(virtualReference(parentElement, spotlightPadding).getBoundingClientRect());
|
|
4135
4127
|
setIsSliding(false);
|
|
4136
4128
|
}
|
|
4137
4129
|
};
|
|
4138
|
-
|
|
4130
|
+
useEffect(() => {
|
|
4139
4131
|
if (parentElement !== null) {
|
|
4140
4132
|
window.addEventListener("resize", handleViewportChange);
|
|
4141
4133
|
window.addEventListener("scroll", handleViewportChange);
|
|
@@ -4145,13 +4137,13 @@ const UserGuide = (props) => {
|
|
|
4145
4137
|
};
|
|
4146
4138
|
}
|
|
4147
4139
|
}, [parentElement, parentElementName]);
|
|
4148
|
-
|
|
4140
|
+
useEffect(() => {
|
|
4149
4141
|
if (parentElementName) {
|
|
4150
4142
|
const element = document.querySelector(parentElementName);
|
|
4151
4143
|
setParentElement(element);
|
|
4152
4144
|
}
|
|
4153
4145
|
}, [parentElementName]);
|
|
4154
|
-
|
|
4146
|
+
useEffect(() => {
|
|
4155
4147
|
parentElement && setRect(virtualReference(parentElement, spotlightPadding).getBoundingClientRect());
|
|
4156
4148
|
setIsSliding(true);
|
|
4157
4149
|
}, [parentElement]);
|
|
@@ -4183,10 +4175,10 @@ var styles$3 = {
|
|
|
4183
4175
|
"textarea--error": "lc-Textarea-module__textarea--error___0EGuq"
|
|
4184
4176
|
};
|
|
4185
4177
|
const baseClass$3 = "textarea";
|
|
4186
|
-
const Textarea =
|
|
4178
|
+
const Textarea = forwardRef((_Y, ref) => {
|
|
4187
4179
|
var _Z = _Y, { className, error } = _Z, textareaProps = __objRest(_Z, ["className", "error"]);
|
|
4188
4180
|
const { disabled } = textareaProps;
|
|
4189
|
-
const [isFocused, setIsFocused] =
|
|
4181
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
4190
4182
|
const mergedClassNames = cx(className, styles$3[baseClass$3], {
|
|
4191
4183
|
[styles$3[`${baseClass$3}--disabled`]]: disabled,
|
|
4192
4184
|
[styles$3[`${baseClass$3}--focused`]]: isFocused,
|
|
@@ -4218,7 +4210,11 @@ var styles$1 = {
|
|
|
4218
4210
|
"file-upload-progress-actions__retry-button": "lc-FileUploadProgressActions-module__file-upload-progress-actions__retry-button___DqFEo"
|
|
4219
4211
|
};
|
|
4220
4212
|
const baseClass$2 = "file-upload-progress-actions";
|
|
4221
|
-
const FileUploadProgressActions = ({
|
|
4213
|
+
const FileUploadProgressActions = ({
|
|
4214
|
+
status,
|
|
4215
|
+
onCloseButtonClick,
|
|
4216
|
+
onRetryButtonClick
|
|
4217
|
+
}) => {
|
|
4222
4218
|
return /* @__PURE__ */ React.createElement("div", {
|
|
4223
4219
|
className: styles$1[`${baseClass$2}`]
|
|
4224
4220
|
}, onRetryButtonClick && status === "error" && /* @__PURE__ */ React.createElement("button", {
|
|
@@ -4239,7 +4235,7 @@ const FileUploadProgressActions = ({ status, onCloseButtonClick, onRetryButtonCl
|
|
|
4239
4235
|
};
|
|
4240
4236
|
const baseClass$1 = "file-upload-progress";
|
|
4241
4237
|
const wrapperHeaderTitleClass = `${baseClass$1}__wrapper__header__title`;
|
|
4242
|
-
const FileUploadProgress =
|
|
4238
|
+
const FileUploadProgress = forwardRef(({
|
|
4243
4239
|
actionsVisibility = "hidden",
|
|
4244
4240
|
className,
|
|
4245
4241
|
icon: icon2,
|
|
@@ -4343,7 +4339,7 @@ const UploadBar = ({
|
|
|
4343
4339
|
onCloseButtonClick,
|
|
4344
4340
|
onRetryButtonClick
|
|
4345
4341
|
}) => {
|
|
4346
|
-
const [expanded, setExpanded] =
|
|
4342
|
+
const [expanded, setExpanded] = useState(isExpanded || false);
|
|
4347
4343
|
const withError = status === "error";
|
|
4348
4344
|
const withSuccess = status === "success";
|
|
4349
4345
|
const mergedClassNames = cx(styles[baseClass], className, {
|