@livechat/design-system-react-components 1.0.0-alpha.56 → 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 +49 -34
- 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
|
@@ -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, {
|
|
@@ -2028,9 +2032,7 @@ const Input = React.forwardRef((_A, ref) => {
|
|
|
2028
2032
|
className: mergedClassNames,
|
|
2029
2033
|
"aria-disabled": disabled,
|
|
2030
2034
|
"tab-index": "0"
|
|
2031
|
-
}, shouldRenderLeftIcon && renderIcon(icon2, disabled), /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({
|
|
2032
|
-
"data-testid": "input"
|
|
2033
|
-
}, inputProps), {
|
|
2035
|
+
}, shouldRenderLeftIcon && renderIcon(icon2, disabled), /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, inputProps), {
|
|
2034
2036
|
ref,
|
|
2035
2037
|
onFocus: (e) => {
|
|
2036
2038
|
setIsFocused(true);
|
|
@@ -3598,15 +3600,24 @@ const tagSeparatorKeys = [
|
|
|
3598
3600
|
KeyCodes.comma
|
|
3599
3601
|
];
|
|
3600
3602
|
const tagRemoveKeys = [KeyCodes.backspace, KeyCodes.delete];
|
|
3601
|
-
const TagInput = ({
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
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
|
+
]);
|
|
3610
3621
|
const mergedClassNames = cx(styles$6[baseClass$b], {
|
|
3611
3622
|
[styles$6[`${baseClass$b}--error`]]: error
|
|
3612
3623
|
});
|
|
@@ -3663,7 +3674,7 @@ const TagInput = ({
|
|
|
3663
3674
|
inputRef,
|
|
3664
3675
|
validator,
|
|
3665
3676
|
size
|
|
3666
|
-
}, tag2)), /* @__PURE__ */ React.createElement("input", {
|
|
3677
|
+
}, tag2)), /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, props), {
|
|
3667
3678
|
id,
|
|
3668
3679
|
ref: inputRef,
|
|
3669
3680
|
className: inputClassNames,
|
|
@@ -3672,7 +3683,7 @@ const TagInput = ({
|
|
|
3672
3683
|
onChange: onInputChange,
|
|
3673
3684
|
onKeyDown: onInputKeyDown,
|
|
3674
3685
|
onPaste
|
|
3675
|
-
})), error && /* @__PURE__ */ React.createElement(FieldError, null, error));
|
|
3686
|
+
}))), error && /* @__PURE__ */ React.createElement(FieldError, null, error));
|
|
3676
3687
|
};
|
|
3677
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;
|
|
3678
3689
|
const defaultPlaceholder = "name@company.com";
|
|
@@ -3743,15 +3754,15 @@ const iconConfig = {
|
|
|
3743
3754
|
}
|
|
3744
3755
|
};
|
|
3745
3756
|
const baseClass$a = "toast";
|
|
3746
|
-
const Toast = (
|
|
3747
|
-
var
|
|
3757
|
+
const Toast = (__) => {
|
|
3758
|
+
var _$ = __, {
|
|
3748
3759
|
action,
|
|
3749
3760
|
className,
|
|
3750
3761
|
children,
|
|
3751
3762
|
removable,
|
|
3752
3763
|
kind = "info",
|
|
3753
3764
|
onClose
|
|
3754
|
-
} =
|
|
3765
|
+
} = _$, divProps = __objRest(_$, [
|
|
3755
3766
|
"action",
|
|
3756
3767
|
"className",
|
|
3757
3768
|
"children",
|
|
@@ -3892,6 +3903,14 @@ const Tooltip = (props) => {
|
|
|
3892
3903
|
],
|
|
3893
3904
|
placement
|
|
3894
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
|
+
};
|
|
3895
3914
|
React.useEffect(() => {
|
|
3896
3915
|
referenceElement && reference(referenceElement);
|
|
3897
3916
|
}, [reference, referenceElement]);
|
|
@@ -3916,29 +3935,25 @@ const Tooltip = (props) => {
|
|
|
3916
3935
|
isHovered.current = false;
|
|
3917
3936
|
void sleep(hoverOutDelayTimeout).then(() => {
|
|
3918
3937
|
if (!isHovered.current) {
|
|
3919
|
-
|
|
3938
|
+
handleVisibilityChange(false);
|
|
3920
3939
|
}
|
|
3921
3940
|
});
|
|
3922
3941
|
};
|
|
3923
3942
|
const handleOpen = () => {
|
|
3924
|
-
if (onOpen)
|
|
3925
|
-
onOpen();
|
|
3926
3943
|
if (!isManaged) {
|
|
3927
|
-
|
|
3944
|
+
handleVisibilityChange(true);
|
|
3928
3945
|
}
|
|
3929
3946
|
};
|
|
3930
3947
|
const handleClose = () => {
|
|
3931
|
-
if (onClose)
|
|
3932
|
-
onClose();
|
|
3933
3948
|
if (!isManaged) {
|
|
3934
|
-
|
|
3949
|
+
handleVisibilityChange(false);
|
|
3935
3950
|
}
|
|
3936
3951
|
};
|
|
3937
3952
|
const handleMouseEnter = () => {
|
|
3938
3953
|
if (triggerOnClick || isManaged)
|
|
3939
3954
|
return;
|
|
3940
3955
|
isHovered.current = true;
|
|
3941
|
-
|
|
3956
|
+
handleVisibilityChange(true);
|
|
3942
3957
|
};
|
|
3943
3958
|
const handleCloseAction = (event) => {
|
|
3944
3959
|
if (event instanceof KeyboardEvent && event.key === "Escape") {
|
|
@@ -4301,8 +4316,8 @@ var styles$3 = {
|
|
|
4301
4316
|
"textarea--error": "lc-Textarea-module__textarea--error___0EGuq"
|
|
4302
4317
|
};
|
|
4303
4318
|
const baseClass$3 = "textarea";
|
|
4304
|
-
const Textarea = React.forwardRef((
|
|
4305
|
-
var
|
|
4319
|
+
const Textarea = React.forwardRef((_aa, ref) => {
|
|
4320
|
+
var _ba = _aa, { className, error } = _ba, textareaProps = __objRest(_ba, ["className", "error"]);
|
|
4306
4321
|
const { disabled, onBlur, onFocus } = textareaProps;
|
|
4307
4322
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
4308
4323
|
const mergedClassNames = cx(className, styles$3[baseClass$3], {
|