@livechat/design-system-react-components 1.0.0-alpha.55 → 1.0.0-alpha.57
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 +6 -6
- package/dist/dsrc.es.js +58 -50
- package/dist/dsrc.umd.js +6 -6
- package/dist/src/components/TagInput/TagInput.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/dsrc.es.js
CHANGED
|
@@ -37,7 +37,7 @@ import * as React from "react";
|
|
|
37
37
|
import { useReducer, useRef, useEffect, useCallback, useMemo } from "react";
|
|
38
38
|
import cx from "clsx";
|
|
39
39
|
import { useFloating, offset, flip, autoUpdate, arrow } from "@floating-ui/react-dom";
|
|
40
|
-
import { Close, Info as Info$1, Warning, CheckCircleSolid, Block, Person, ChevronUp, ChevronDown,
|
|
40
|
+
import { Close, Info as Info$1, Warning, CheckCircleSolid, Block, Person, ChevronUp, ChevronDown, DoubleArrowLeft, ChevronLeft, ChevronRight, DoubleArrowRight, VisibilityOn, VisibilityOff, Check, Search, LockBlack, Refresh, Error as Error2 } from "@livechat/design-system-icons/react/material";
|
|
41
41
|
import debounce from "lodash.debounce";
|
|
42
42
|
import { getContrast } from "polished";
|
|
43
43
|
import ReactDayPicker from "react-day-picker";
|
|
@@ -334,6 +334,17 @@ const Popover = ({
|
|
|
334
334
|
}
|
|
335
335
|
prevVisibleState.current = visible;
|
|
336
336
|
}, [visible]);
|
|
337
|
+
React.useEffect(() => {
|
|
338
|
+
const handleHideOnEscape = (event) => {
|
|
339
|
+
if (closeOnEsc && event.key === "Escape") {
|
|
340
|
+
setVisibility(false);
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
document.addEventListener("keydown", handleHideOnEscape);
|
|
344
|
+
return () => {
|
|
345
|
+
document.removeEventListener("keydown", handleHideOnEscape);
|
|
346
|
+
};
|
|
347
|
+
}, [closeOnEsc]);
|
|
337
348
|
React.useEffect(() => {
|
|
338
349
|
if (!refs.reference.current || !refs.floating.current) {
|
|
339
350
|
return;
|
|
@@ -349,17 +360,10 @@ const Popover = ({
|
|
|
349
360
|
setVisibility(false);
|
|
350
361
|
}
|
|
351
362
|
}
|
|
352
|
-
const handleHideOnEscape = (event) => {
|
|
353
|
-
if (closeOnEsc && event.key === "Escape") {
|
|
354
|
-
setVisibility(false);
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
363
|
React.useEffect(() => {
|
|
358
364
|
document.addEventListener("mousedown", handleDocumentClick);
|
|
359
|
-
document.addEventListener("keydown", handleHideOnEscape);
|
|
360
365
|
return () => {
|
|
361
366
|
document.removeEventListener("mousedown", handleDocumentClick);
|
|
362
|
-
document.removeEventListener("keydown", handleHideOnEscape);
|
|
363
367
|
};
|
|
364
368
|
}, []);
|
|
365
369
|
const mergedClassNames = cx(cssStyles["popover"], className, {
|
|
@@ -1190,19 +1194,19 @@ const FieldDescription = (_o) => {
|
|
|
1190
1194
|
};
|
|
1191
1195
|
const checkbox = "lc-Checkbox-module__checkbox___G7nTf";
|
|
1192
1196
|
const checkbox__label = "lc-Checkbox-module__checkbox__label___-o01x";
|
|
1193
|
-
const checkbox__square = "lc-Checkbox-module__checkbox__square___MHUyd";
|
|
1194
|
-
const checkbox__checkmark = "lc-Checkbox-module__checkbox__checkmark___16pfY";
|
|
1195
|
-
const checkbox__input = "lc-Checkbox-module__checkbox__input___YLbVF";
|
|
1196
1197
|
const checkbox__text = "lc-Checkbox-module__checkbox__text___P2SIq";
|
|
1198
|
+
const checkbox__input = "lc-Checkbox-module__checkbox__input___YLbVF";
|
|
1199
|
+
const checkbox__checkmark = "lc-Checkbox-module__checkbox__checkmark___16pfY";
|
|
1200
|
+
const checkbox__square = "lc-Checkbox-module__checkbox__square___MHUyd";
|
|
1197
1201
|
const checkbox__helper = "lc-Checkbox-module__checkbox__helper___YSJ-n";
|
|
1198
1202
|
var styles$u = {
|
|
1199
1203
|
checkbox,
|
|
1200
1204
|
checkbox__label,
|
|
1201
|
-
|
|
1205
|
+
checkbox__text,
|
|
1206
|
+
checkbox__input,
|
|
1202
1207
|
checkbox__checkmark,
|
|
1203
1208
|
"checkbox--selected": "lc-Checkbox-module__checkbox--selected___S2vqY",
|
|
1204
|
-
|
|
1205
|
-
checkbox__text,
|
|
1209
|
+
checkbox__square,
|
|
1206
1210
|
"checkbox--disabled": "lc-Checkbox-module__checkbox--disabled___-lAqW",
|
|
1207
1211
|
checkbox__helper
|
|
1208
1212
|
};
|
|
@@ -1216,20 +1220,13 @@ const Checkbox = React.forwardRef((_q, ref) => {
|
|
|
1216
1220
|
})
|
|
1217
1221
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
1218
1222
|
className: styles$u[`${baseClass$D}__label`]
|
|
1219
|
-
}, /* @__PURE__ */ React.createElement("
|
|
1223
|
+
}, /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, restInputProps), {
|
|
1220
1224
|
ref,
|
|
1221
1225
|
checked,
|
|
1222
1226
|
disabled,
|
|
1223
1227
|
className: styles$u[`${baseClass$D}__input`],
|
|
1224
1228
|
type: "checkbox"
|
|
1225
|
-
})), /* @__PURE__ */ React.createElement(
|
|
1226
|
-
className: styles$u[`${baseClass$D}__square`]
|
|
1227
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
1228
|
-
source: Check,
|
|
1229
|
-
kind: "inverted",
|
|
1230
|
-
size: "xsmall",
|
|
1231
|
-
className: styles$u[`${baseClass$D}__checkmark`]
|
|
1232
|
-
}))), children && /* @__PURE__ */ React.createElement(Text, {
|
|
1229
|
+
})), children && /* @__PURE__ */ React.createElement(Text, {
|
|
1233
1230
|
as: "div",
|
|
1234
1231
|
size: "md",
|
|
1235
1232
|
className: styles$u[`${baseClass$D}__text`]
|
|
@@ -2035,9 +2032,7 @@ const Input = React.forwardRef((_A, ref) => {
|
|
|
2035
2032
|
className: mergedClassNames,
|
|
2036
2033
|
"aria-disabled": disabled,
|
|
2037
2034
|
"tab-index": "0"
|
|
2038
|
-
}, shouldRenderLeftIcon && renderIcon(icon2, disabled), /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({
|
|
2039
|
-
"data-testid": "input"
|
|
2040
|
-
}, inputProps), {
|
|
2035
|
+
}, shouldRenderLeftIcon && renderIcon(icon2, disabled), /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, inputProps), {
|
|
2041
2036
|
ref,
|
|
2042
2037
|
onFocus: (e) => {
|
|
2043
2038
|
setIsFocused(true);
|
|
@@ -3605,15 +3600,24 @@ const tagSeparatorKeys = [
|
|
|
3605
3600
|
KeyCodes.comma
|
|
3606
3601
|
];
|
|
3607
3602
|
const tagRemoveKeys = [KeyCodes.backspace, KeyCodes.delete];
|
|
3608
|
-
const TagInput = ({
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3603
|
+
const TagInput = (_Y) => {
|
|
3604
|
+
var _Z = _Y, {
|
|
3605
|
+
id,
|
|
3606
|
+
tags,
|
|
3607
|
+
onChange,
|
|
3608
|
+
validator,
|
|
3609
|
+
error,
|
|
3610
|
+
placeholder,
|
|
3611
|
+
size = "medium"
|
|
3612
|
+
} = _Z, props = __objRest(_Z, [
|
|
3613
|
+
"id",
|
|
3614
|
+
"tags",
|
|
3615
|
+
"onChange",
|
|
3616
|
+
"validator",
|
|
3617
|
+
"error",
|
|
3618
|
+
"placeholder",
|
|
3619
|
+
"size"
|
|
3620
|
+
]);
|
|
3617
3621
|
const mergedClassNames = cx(styles$6[baseClass$b], {
|
|
3618
3622
|
[styles$6[`${baseClass$b}--error`]]: error
|
|
3619
3623
|
});
|
|
@@ -3670,7 +3674,7 @@ const TagInput = ({
|
|
|
3670
3674
|
inputRef,
|
|
3671
3675
|
validator,
|
|
3672
3676
|
size
|
|
3673
|
-
}, tag2)), /* @__PURE__ */ React.createElement("input", {
|
|
3677
|
+
}, tag2)), /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, props), {
|
|
3674
3678
|
id,
|
|
3675
3679
|
ref: inputRef,
|
|
3676
3680
|
className: inputClassNames,
|
|
@@ -3679,7 +3683,7 @@ const TagInput = ({
|
|
|
3679
3683
|
onChange: onInputChange,
|
|
3680
3684
|
onKeyDown: onInputKeyDown,
|
|
3681
3685
|
onPaste
|
|
3682
|
-
})), error && /* @__PURE__ */ React.createElement(FieldError, null, error));
|
|
3686
|
+
}))), error && /* @__PURE__ */ React.createElement(FieldError, null, error));
|
|
3683
3687
|
};
|
|
3684
3688
|
const emailRegex = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)])$/i;
|
|
3685
3689
|
const defaultPlaceholder = "name@company.com";
|
|
@@ -3750,15 +3754,15 @@ const iconConfig = {
|
|
|
3750
3754
|
}
|
|
3751
3755
|
};
|
|
3752
3756
|
const baseClass$a = "toast";
|
|
3753
|
-
const Toast = (
|
|
3754
|
-
var
|
|
3757
|
+
const Toast = (__) => {
|
|
3758
|
+
var _$ = __, {
|
|
3755
3759
|
action,
|
|
3756
3760
|
className,
|
|
3757
3761
|
children,
|
|
3758
3762
|
removable,
|
|
3759
3763
|
kind = "info",
|
|
3760
3764
|
onClose
|
|
3761
|
-
} =
|
|
3765
|
+
} = _$, divProps = __objRest(_$, [
|
|
3762
3766
|
"action",
|
|
3763
3767
|
"className",
|
|
3764
3768
|
"children",
|
|
@@ -3899,6 +3903,14 @@ const Tooltip = (props) => {
|
|
|
3899
3903
|
],
|
|
3900
3904
|
placement
|
|
3901
3905
|
});
|
|
3906
|
+
const handleVisibilityChange = (newVisibility) => {
|
|
3907
|
+
if (newVisibility) {
|
|
3908
|
+
onOpen == null ? void 0 : onOpen();
|
|
3909
|
+
} else {
|
|
3910
|
+
onClose == null ? void 0 : onClose();
|
|
3911
|
+
}
|
|
3912
|
+
setVisibility(newVisibility);
|
|
3913
|
+
};
|
|
3902
3914
|
React.useEffect(() => {
|
|
3903
3915
|
referenceElement && reference(referenceElement);
|
|
3904
3916
|
}, [reference, referenceElement]);
|
|
@@ -3923,29 +3935,25 @@ const Tooltip = (props) => {
|
|
|
3923
3935
|
isHovered.current = false;
|
|
3924
3936
|
void sleep(hoverOutDelayTimeout).then(() => {
|
|
3925
3937
|
if (!isHovered.current) {
|
|
3926
|
-
|
|
3938
|
+
handleVisibilityChange(false);
|
|
3927
3939
|
}
|
|
3928
3940
|
});
|
|
3929
3941
|
};
|
|
3930
3942
|
const handleOpen = () => {
|
|
3931
|
-
if (onOpen)
|
|
3932
|
-
onOpen();
|
|
3933
3943
|
if (!isManaged) {
|
|
3934
|
-
|
|
3944
|
+
handleVisibilityChange(true);
|
|
3935
3945
|
}
|
|
3936
3946
|
};
|
|
3937
3947
|
const handleClose = () => {
|
|
3938
|
-
if (onClose)
|
|
3939
|
-
onClose();
|
|
3940
3948
|
if (!isManaged) {
|
|
3941
|
-
|
|
3949
|
+
handleVisibilityChange(false);
|
|
3942
3950
|
}
|
|
3943
3951
|
};
|
|
3944
3952
|
const handleMouseEnter = () => {
|
|
3945
3953
|
if (triggerOnClick || isManaged)
|
|
3946
3954
|
return;
|
|
3947
3955
|
isHovered.current = true;
|
|
3948
|
-
|
|
3956
|
+
handleVisibilityChange(true);
|
|
3949
3957
|
};
|
|
3950
3958
|
const handleCloseAction = (event) => {
|
|
3951
3959
|
if (event instanceof KeyboardEvent && event.key === "Escape") {
|
|
@@ -4308,8 +4316,8 @@ var styles$3 = {
|
|
|
4308
4316
|
"textarea--error": "lc-Textarea-module__textarea--error___0EGuq"
|
|
4309
4317
|
};
|
|
4310
4318
|
const baseClass$3 = "textarea";
|
|
4311
|
-
const Textarea = React.forwardRef((
|
|
4312
|
-
var
|
|
4319
|
+
const Textarea = React.forwardRef((_aa, ref) => {
|
|
4320
|
+
var _ba = _aa, { className, error } = _ba, textareaProps = __objRest(_ba, ["className", "error"]);
|
|
4313
4321
|
const { disabled, onBlur, onFocus } = textareaProps;
|
|
4314
4322
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
4315
4323
|
const mergedClassNames = cx(className, styles$3[baseClass$3], {
|