@lunit/oui 2.4.0 → 2.4.1
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.
|
@@ -2,20 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { CloseSmall, HideSmall, ShowSmall } from '../../../icons';
|
|
3
3
|
import { ButtonWrapper } from '../TextInput.styled';
|
|
4
4
|
function ClearButton({ onClick }) {
|
|
5
|
-
return (_jsx(ButtonWrapper, { onClick: onClick,
|
|
6
|
-
if (event.key === 'Enter') {
|
|
7
|
-
event.preventDefault();
|
|
8
|
-
event.stopPropagation();
|
|
9
|
-
}
|
|
10
|
-
}, children: _jsx(CloseSmall, { fontSize: "small" }) }));
|
|
5
|
+
return (_jsx(ButtonWrapper, { onClick: onClick, children: _jsx(CloseSmall, { fontSize: "small" }) }));
|
|
11
6
|
}
|
|
12
7
|
function ShowHidePasswordButton({ onClick, isHidden, }) {
|
|
13
|
-
return (_jsx(ButtonWrapper, { onClick: onClick,
|
|
14
|
-
if (event.key === 'Enter') {
|
|
15
|
-
event.preventDefault();
|
|
16
|
-
event.stopPropagation();
|
|
17
|
-
}
|
|
18
|
-
}, children: isHidden ? _jsx(HideSmall, {}) : _jsx(ShowSmall, {}) }));
|
|
8
|
+
return (_jsx(ButtonWrapper, { onClick: onClick, children: isHidden ? _jsx(HideSmall, {}) : _jsx(ShowSmall, {}) }));
|
|
19
9
|
}
|
|
20
10
|
function FileInputWrapperButton({ children, onClick, width, }) {
|
|
21
11
|
return (_jsx("button", { onClick: onClick, style: {
|
|
@@ -5,7 +5,7 @@ import { BaseTextInput, LeftIconContainer, RightIconContainer } from '../TextInp
|
|
|
5
5
|
import { ClearButton } from './Buttons';
|
|
6
6
|
const NormalTextInput = forwardRef((props, ref) => {
|
|
7
7
|
const { error, helperMsg, leftIcon, rightIcon, onClearButtonClick, inputSX, ...inputProps } = props;
|
|
8
|
-
const [showClear, setShowClear] = useState(!!props.defaultValue
|
|
8
|
+
const [showClear, setShowClear] = useState(!!props.defaultValue);
|
|
9
9
|
const showRightIcon = useMemo(() => {
|
|
10
10
|
return (rightIcon ?? // if rightIcon is passed, use it, else use clear button
|
|
11
11
|
(!props.disabled && // hide if disabled
|
|
@@ -11,11 +11,22 @@ function PasswordInputContainer(props) {
|
|
|
11
11
|
}, isHidden: hidePassword })) }), error ? (_jsx(InputMsg, { variant: "body5", error: true, children: error })) : (helperMsg && _jsx(InputMsg, { variant: "body5", children: helperMsg }))] }));
|
|
12
12
|
}
|
|
13
13
|
const PasswordInput = forwardRef((props, ref) => {
|
|
14
|
-
const { error, helperMsg, leftIcon, type, inputSX, ...otherInputProps } = props;
|
|
14
|
+
const { error, helperMsg, leftIcon, type, inputSX, onKeyDown, ...otherInputProps } = props;
|
|
15
15
|
const [hidePassword, setHidePassword] = useState(true);
|
|
16
16
|
function handlePasswordShowHide() {
|
|
17
17
|
setHidePassword(!hidePassword);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const handleKeyDown = (event) => {
|
|
20
|
+
// Call the original onKeyDown if provided
|
|
21
|
+
if (onKeyDown) {
|
|
22
|
+
onKeyDown(event);
|
|
23
|
+
}
|
|
24
|
+
// Prevent Enter key from changing password visibility
|
|
25
|
+
if (event.key === 'Enter') {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
event.stopPropagation();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return (_jsx(PasswordInputContainer, { ...props, hidePassword: hidePassword, handlePasswordShowHide: () => handlePasswordShowHide(), children: _jsx(BaseTextInput, { type: hidePassword ? 'password' : 'text', ref: ref, ...otherInputProps, onKeyDown: handleKeyDown, leftIcon: leftIcon, sx: inputSX }) }));
|
|
20
31
|
});
|
|
21
32
|
export default PasswordInput;
|
|
@@ -19,7 +19,7 @@ export const AnalysisBarSegmentContainer = styled(Box)(() => ({
|
|
|
19
19
|
width: '100%',
|
|
20
20
|
gap: '1px',
|
|
21
21
|
}));
|
|
22
|
-
const GraphScoreIndicatorContainer = styled(
|
|
22
|
+
const GraphScoreIndicatorContainer = styled(Box, {
|
|
23
23
|
shouldForwardProp: (prop) => prop !== 'isJet',
|
|
24
24
|
})(({ isJet }) => {
|
|
25
25
|
return {
|
package/package.json
CHANGED