@lunit/oui 2.2.14 → 2.2.16
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.
|
@@ -23,6 +23,7 @@ interface NormalTextInputProps extends InputWithHelperMsgProps {
|
|
|
23
23
|
interface FileInputProps extends NormalTextInputProps {
|
|
24
24
|
type: 'file';
|
|
25
25
|
accept: string;
|
|
26
|
+
onClick: () => void;
|
|
26
27
|
}
|
|
27
28
|
interface PasswordTextInputProps extends PasswordInputWithHelperMsgProps {
|
|
28
29
|
}
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
3
|
import { InputMsg, BaseTextFieldContainer, BaseTextFieldBox, } from '../../BaseTextField/BaseTextField.styled';
|
|
4
4
|
import { BaseTextInput, LeftIconContainer, RightIconContainer } from '../TextInput.styled';
|
|
5
5
|
import { FileInputWrapperButton } from './Buttons';
|
|
6
6
|
import { Project } from '../../../icons';
|
|
7
7
|
import { uniqueId } from 'lodash';
|
|
8
8
|
const FileInput = forwardRef((props, ref) => {
|
|
9
|
-
const { error, helperMsg, leftIcon, rightIcon,
|
|
9
|
+
const { error, helperMsg, leftIcon, rightIcon, inputSX, type: inputType, value, onChange, onClick, ...inputProps } = props;
|
|
10
10
|
// Unique ID used to select hidden file input and click on it
|
|
11
11
|
const uID = uniqueId('hidden-file-input-');
|
|
12
|
-
const [fileName, setFileName] = useState('');
|
|
13
12
|
const baseSX = inputSX ?? {
|
|
14
13
|
paddingRight: '44px',
|
|
15
14
|
pointerEvents: 'none',
|
|
16
15
|
width: '100%',
|
|
17
16
|
};
|
|
18
|
-
|
|
19
|
-
const fileInput = document.getElementsByName(uID);
|
|
20
|
-
if (!fileInput.length)
|
|
21
|
-
return;
|
|
22
|
-
fileInput[0].click();
|
|
23
|
-
};
|
|
24
|
-
return (_jsxs(BaseTextFieldBox, { ...props.OuterBoxProps, width: props.width, children: [_jsxs(BaseTextFieldContainer, { ...props.InputContainerProps, width: props.width, children: [leftIcon && (_jsx(LeftIconContainer, { sx: inputProps.disabled ? { opacity: '0.8' } : undefined, children: leftIcon })), _jsx("input", { ref: ref, type: "file", name: uID, accept: props.accept, style: { display: 'none' }, disabled: inputProps.disabled, onChange: (e) => {
|
|
25
|
-
setFileName(e.target.value.split('\\').pop());
|
|
26
|
-
} }), _jsxs(FileInputWrapperButton, { onClick: () => handleButtonClicksFile(), width: props.width, children: [_jsx(BaseTextInput, { ...inputProps, type: "text", error: !!error, value: fileName,
|
|
17
|
+
return (_jsxs(BaseTextFieldBox, { ...props.OuterBoxProps, width: props.width, children: [_jsxs(BaseTextFieldContainer, { ...props.InputContainerProps, width: props.width, children: [leftIcon && (_jsx(LeftIconContainer, { sx: inputProps.disabled ? { opacity: '0.8' } : undefined, children: leftIcon })), _jsx("input", { ref: ref, type: "file", name: uID, accept: props.accept, style: { display: 'none' }, disabled: inputProps.disabled, onChange: onChange }), _jsxs(FileInputWrapperButton, { onClick: onClick, width: props.width, children: [_jsx(BaseTextInput, { ...inputProps, type: "text", error: !!error, value: value,
|
|
27
18
|
// @Tobio89: this dummy onchange clears an error without triggering unwanted style changes
|
|
28
|
-
onChange: () => { }, leftIcon: leftIcon, sx:
|
|
19
|
+
onChange: () => { }, leftIcon: leftIcon, sx: {
|
|
20
|
+
...baseSX,
|
|
21
|
+
cursor: 'pointer',
|
|
22
|
+
} }), _jsx(RightIconContainer, { sx: { pointerEvents: 'none' }, children: _jsx(Project, {}) })] })] }), error ? (_jsx(InputMsg, { variant: "body5", error: true, children: error })) : (helperMsg && _jsx(InputMsg, { variant: "body5", children: helperMsg }))] }));
|
|
29
23
|
});
|
|
30
24
|
export default FileInput;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { v4 as uuidV4 } from 'uuid';
|
|
3
4
|
import { Box } from '@mui/material';
|
|
4
5
|
import theme from '../../theme';
|
|
@@ -16,7 +17,12 @@ const Accordion = ({ componentType = 'accordion', MuiAccordionProps, AccordionDe
|
|
|
16
17
|
throw new Error("The 'title' prop is required.");
|
|
17
18
|
if (!items.length)
|
|
18
19
|
throw new Error("The 'items' prop must contain at least one item.");
|
|
19
|
-
|
|
20
|
+
const [isOpened, setIsOpened] = useState(isOpen);
|
|
21
|
+
const handleOnChange = (event) => {
|
|
22
|
+
setIsOpened(!isOpened);
|
|
23
|
+
onChange?.(event, !isOpened);
|
|
24
|
+
};
|
|
25
|
+
return (_jsxs(BaseAccordion, { ...MuiAccordionProps, expanded: isOpened, onChange: handleOnChange, sx: { alignItems: 'center' }, children: [_jsxs(BaseAccordionSummary, { expandIcon: _jsx(ArrowDown, { sx: { fill: theme.palette.neutralGrey[40] } }), ...AccordionSummaryProps, children: [!!tooltip.length && (_jsx(Tooltip, { arrow: true, size: "large", onClick: (event) => event.stopPropagation(), title: _jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: '8px' }, onClick: (event) => event.stopPropagation(), children: tooltip.map((item) => (_jsxs(Box, { children: [item.componentType === 'freeText' && (_jsx(FreeText, { componentType: item.componentType, size: item.size, content: item.content })), item.componentType === 'statistic' && (_jsx(Statistic, { componentType: item.componentType, title: item.title, size: item.size, layout: item.layout, symbol: item.symbol, color: item.color }))] }, uuidV4()))) }), children: _jsx(Box, { sx: {
|
|
20
26
|
marginRight: size.includes('small') ? '4px' : '6px',
|
|
21
27
|
display: 'flex',
|
|
22
28
|
alignItems: 'center',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunit/oui",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.16",
|
|
4
4
|
"validate-branch-name": {
|
|
5
5
|
"pattern": "^(main|develop)|(feature|fix|release|hotfix|qe)/.+$",
|
|
6
6
|
"errorMsg": "The branch name is not correct. Please check the pattern. (ex. feature/add-something)"
|