@wistia/ui 0.5.4-beta.f71b82a7.da0eee9 → 0.5.4
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/index.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +7 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -3
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.5.4
|
|
3
|
+
* @license @wistia/ui v0.5.4
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -7605,7 +7605,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
7605
7605
|
// src/components/Input/Input.tsx
|
|
7606
7606
|
import { forwardRef as forwardRef9, cloneElement as cloneElement3, useRef as useRef3 } from "react";
|
|
7607
7607
|
import styled26, { css as css22 } from "styled-components";
|
|
7608
|
-
import { isNil as isNil12, isNotNil as isNotNil9
|
|
7608
|
+
import { isNil as isNil12, isNotNil as isNotNil9 } from "@wistia/type-guards";
|
|
7609
7609
|
import { jsx as jsx183, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
7610
7610
|
var inputStyles = css22`
|
|
7611
7611
|
--wui-input-color-bg: var(--wui-color-bg-surface);
|
|
@@ -7692,6 +7692,9 @@ var StyledInputContainer = styled26.div`
|
|
|
7692
7692
|
padding-right: 32px;
|
|
7693
7693
|
}
|
|
7694
7694
|
`;
|
|
7695
|
+
var isValidRef2 = (ref) => {
|
|
7696
|
+
return typeof ref === "object" && ref !== null && "current" in ref && isNotNil9(ref.current);
|
|
7697
|
+
};
|
|
7695
7698
|
var Input = forwardRef9(
|
|
7696
7699
|
({
|
|
7697
7700
|
fullWidth = false,
|
|
@@ -7703,7 +7706,7 @@ var Input = forwardRef9(
|
|
|
7703
7706
|
...props
|
|
7704
7707
|
}, externalRef) => {
|
|
7705
7708
|
const internalRef = useRef3();
|
|
7706
|
-
const ref =
|
|
7709
|
+
const ref = isValidRef2(externalRef) ? externalRef : internalRef;
|
|
7707
7710
|
let leftIconToDisplay = leftIcon;
|
|
7708
7711
|
if (isNil12(leftIcon) && type === "search") {
|
|
7709
7712
|
leftIconToDisplay = /* @__PURE__ */ jsx183(Icon, { type: "search" });
|
|
@@ -7725,7 +7728,7 @@ var Input = forwardRef9(
|
|
|
7725
7728
|
if (isNotNil9(props.onFocus)) {
|
|
7726
7729
|
props.onFocus(event);
|
|
7727
7730
|
}
|
|
7728
|
-
if (autoSelect &&
|
|
7731
|
+
if (autoSelect && ref && "current" in ref) {
|
|
7729
7732
|
requestAnimationFrame(() => {
|
|
7730
7733
|
ref.current?.select();
|
|
7731
7734
|
});
|