@lunit/oui 3.0.0 → 3.1.0
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/components/Autocomplete/Autocomplete.js +22 -0
- package/dist/components/Autocomplete/Autocomplete.styled.js +36 -0
- package/dist/components/Autocomplete/Autocomplete.types.js +1 -0
- package/dist/components/Autocomplete/index.js +2 -0
- package/dist/components/Chip/Chip.utils.js +0 -1
- package/dist/components/Collapse/Collapse.js +6 -0
- package/dist/components/Collapse/Collapse.types.js +1 -0
- package/dist/components/Collapse/index.js +2 -0
- package/dist/components/DataTable/DataTable.js +6 -4
- package/dist/components/DataTable/DataTable.types.js +1 -0
- package/dist/components/Drawer/Drawer.js +6 -0
- package/dist/components/Drawer/Drawer.styled.js +29 -0
- package/dist/components/Drawer/Drawer.types.js +1 -0
- package/dist/components/Drawer/index.js +2 -0
- package/dist/components/Dropdown/Dropdown.js +1 -3
- package/dist/components/Dropdown/IconDropdown.js +1 -3
- package/dist/components/EllipsisTypography/EllipsisTypography.js +51 -15
- package/dist/components/List/ListItemCaption.styled.js +0 -1
- package/dist/components/LoadingIndicator/LoadingIndicator.js +0 -1
- package/dist/components/NoMatchContainer/NoMatchContainer.js +3 -3
- package/dist/components/Popover/Popover.js +6 -0
- package/dist/components/Popover/Popover.styled.js +10 -0
- package/dist/components/Popover/Popover.types.js +1 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/Radio/RadioGroup.styled.js +0 -1
- package/dist/components/TextField/TextInput.styled.js +2 -6
- package/dist/components/Toggle/Toggle.js +12 -7
- package/dist/components/UploadManager/UploadManager.js +9 -5
- package/dist/components/index.js +4 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.styled.js +12 -7
- package/dist/presentations/FreeText/FreeText.js +50 -28
- package/dist/presentations/HorizonDivider/HorizonDivider.js +1 -1
- package/dist/presentations/Threshold/Threshold.js +11 -9
- package/dist/presentations/Threshold/Threshold.styled.js +56 -58
- package/dist/presentations/Threshold/Threshold.utils.js +27 -18
- package/dist/types/components/Autocomplete/Autocomplete.d.ts +3 -0
- package/dist/types/components/Autocomplete/Autocomplete.styled.d.ts +6 -0
- package/dist/types/components/Autocomplete/Autocomplete.types.d.ts +20 -0
- package/dist/types/components/Autocomplete/index.d.ts +4 -0
- package/dist/types/components/Collapse/Collapse.d.ts +3 -0
- package/dist/types/components/Collapse/Collapse.types.d.ts +4 -0
- package/dist/types/components/Collapse/index.d.ts +4 -0
- package/dist/types/components/DataTable/DataTable.d.ts +2 -2
- package/dist/types/components/DataTable/DataTable.types.d.ts +8 -0
- package/dist/types/components/DataTable/index.d.ts +1 -0
- package/dist/types/components/Drawer/Drawer.d.ts +3 -0
- package/dist/types/components/Drawer/Drawer.styled.d.ts +3 -0
- package/dist/types/components/Drawer/Drawer.types.d.ts +14 -0
- package/dist/types/components/Drawer/index.d.ts +4 -0
- package/dist/types/components/EllipsisTypography/EllipsisTypography.d.ts +2 -1
- package/dist/types/components/Popover/Popover.d.ts +3 -0
- package/dist/types/components/Popover/Popover.styled.d.ts +2 -0
- package/dist/types/components/Popover/Popover.types.d.ts +4 -0
- package/dist/types/components/Popover/index.d.ts +4 -0
- package/dist/types/components/Tooltip/Tooltip.types.d.ts +2 -2
- package/dist/types/components/index.d.ts +4 -0
- package/dist/types/presentations/Threshold/Threshold.d.ts +1 -1
- package/dist/types/presentations/Threshold/Threshold.types.d.ts +16 -4
- package/dist/types/presentations/Threshold/Threshold.utils.d.ts +18 -16
- package/docs/COMPONENTS.md +42 -38
- package/package.json +21 -6
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Autocomplete as MuiAutocomplete, TextField, useTheme } from '@mui/material';
|
|
3
|
+
import { Chip } from '../Chip';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { CircularProgress } from '../Progress';
|
|
6
|
+
import { CloseSmall } from '../../icons';
|
|
7
|
+
import { autocompleteSx, paperSx } from './Autocomplete.styled';
|
|
8
|
+
const LOADING_SPINNER_SIZE = 20;
|
|
9
|
+
function Autocomplete({ placeholder = '', error, helperText, loading = false, noOptionsText, onDelete, onClearButtonClick, disabled, inputValue, sx, ...otherProps }) {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
return (_jsx(MuiAutocomplete, { multiple: true, freeSolo: true, disableClearable: true, disabled: disabled, loading: loading, loadingText: noOptionsText, inputValue: inputValue, sx: [autocompleteSx(theme, disabled), ...(Array.isArray(sx) ? sx : [sx])], slotProps: {
|
|
12
|
+
listbox: { style: { maxHeight: '180px', overflow: 'auto' } },
|
|
13
|
+
paper: { sx: paperSx(theme) },
|
|
14
|
+
}, renderValue: (values) => values.map((option) => (_jsx(Chip, { disabled: disabled, label: option, onDelete: onDelete ? () => onDelete(option) : undefined }, option))), renderInput: (params) => (_jsx(TextField, { ...params, variant: "outlined", placeholder: placeholder, error: error, helperText: helperText, slotProps: {
|
|
15
|
+
...params.slotProps,
|
|
16
|
+
input: {
|
|
17
|
+
...params.slotProps?.input,
|
|
18
|
+
endAdornment: (_jsxs(_Fragment, { children: [loading ? (_jsx(CircularProgress, { size: LOADING_SPINNER_SIZE, sx: { color: theme.palette.neutralGrey[45] } })) : null, onClearButtonClick ? (_jsx(Button, { icon: _jsx(CloseSmall, { style: { color: theme.palette.neutralGrey[45] } }), size: "small", variant: "ghost", onClick: onClearButtonClick })) : null] })),
|
|
19
|
+
},
|
|
20
|
+
} })), ...otherProps }));
|
|
21
|
+
}
|
|
22
|
+
export default Autocomplete;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const MIN_INPUT_HEIGHT = '44px';
|
|
2
|
+
/** Tokenized styling for the underlying MUI Autocomplete. */
|
|
3
|
+
export const autocompleteSx = (theme, disabled) => ({
|
|
4
|
+
'.MuiAutocomplete-inputRoot': {
|
|
5
|
+
padding: `${theme.spacing(1.5, 3.5)} !important`,
|
|
6
|
+
gap: theme.spacing(1),
|
|
7
|
+
'& .MuiInputBase-input::placeholder': {
|
|
8
|
+
opacity: disabled ? 0.42 : 1,
|
|
9
|
+
},
|
|
10
|
+
'& .MuiAutocomplete-input': {
|
|
11
|
+
height: '100%',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
'.MuiOutlinedInput-root': {
|
|
15
|
+
minHeight: MIN_INPUT_HEIGHT,
|
|
16
|
+
},
|
|
17
|
+
'.MuiInputBase-root.Mui-disabled': {
|
|
18
|
+
border: `1px solid ${theme.palette.neutralGrey[70]}`,
|
|
19
|
+
color: theme.palette.neutralGrey[45],
|
|
20
|
+
backgroundColor: theme.palette.neutralGrey[75],
|
|
21
|
+
pointerEvents: 'none',
|
|
22
|
+
opacity: 0.8,
|
|
23
|
+
},
|
|
24
|
+
'.MuiFormHelperText-root.Mui-error': {
|
|
25
|
+
...theme.typography.body5,
|
|
26
|
+
color: theme.palette.error.main,
|
|
27
|
+
margin: 0,
|
|
28
|
+
paddingLeft: theme.spacing(1),
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
/** Tokenized styling for the listbox paper. */
|
|
32
|
+
export const paperSx = (theme) => ({
|
|
33
|
+
backgroundColor: theme.palette.neutralGrey[70],
|
|
34
|
+
borderRadius: theme.spacing(2),
|
|
35
|
+
backgroundImage: 'none',
|
|
36
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,10 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { DataGridPro } from '@mui/x-data-grid-pro';
|
|
3
3
|
import DataGridContainer from './DataTable.styled';
|
|
4
4
|
import { Checkbox } from '../Checkbox';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const EmptyOverlay = () => _jsx("div", {});
|
|
6
|
+
function DataTable({ rows, columns, slots, ...otherProps }) {
|
|
7
|
+
return (_jsx(DataGridContainer, { children: _jsx(DataGridPro, { rows: rows, columns: columns, columnHeaderHeight: 40, rowHeight: 40, showColumnVerticalBorder: true, showCellVerticalBorder: true, disableColumnMenu: true, hideFooter: true, ...otherProps, slots: {
|
|
8
|
+
noRowsOverlay: EmptyOverlay,
|
|
8
9
|
baseCheckbox: Checkbox,
|
|
9
|
-
|
|
10
|
+
...slots,
|
|
11
|
+
} }) }));
|
|
10
12
|
}
|
|
11
13
|
export default DataTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import BaseDrawer from './Drawer.styled';
|
|
3
|
+
function Drawer({ children, open = true, wide, variant = 'permanent', ...otherProps }) {
|
|
4
|
+
return (_jsx(BaseDrawer, { variant: variant, open: open, wide: wide, ...otherProps, children: children }));
|
|
5
|
+
}
|
|
6
|
+
export default Drawer;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Drawer as MuiDrawer, paperClasses } from '@mui/material';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
const DEFAULT_CLOSED_WIDTH = '52px';
|
|
4
|
+
const DEFAULT_OPEN_WIDTH = '240px';
|
|
5
|
+
const DEFAULT_WIDE_WIDTH = '280px';
|
|
6
|
+
const WIDTH_TRANSITION = 'width 0.2s';
|
|
7
|
+
const FORWARDED_EXCLUDES = ['wide', 'closedWidth', 'openWidth', 'wideWidth'];
|
|
8
|
+
const BaseDrawer = styled(MuiDrawer, {
|
|
9
|
+
shouldForwardProp: (prop) => !FORWARDED_EXCLUDES.includes(prop.toString()),
|
|
10
|
+
})(({ theme, open, wide, closedWidth, openWidth, wideWidth }) => {
|
|
11
|
+
const resolvedClosed = closedWidth ?? DEFAULT_CLOSED_WIDTH;
|
|
12
|
+
const resolvedOpen = openWidth ?? DEFAULT_OPEN_WIDTH;
|
|
13
|
+
const resolvedWide = wideWidth ?? DEFAULT_WIDE_WIDTH;
|
|
14
|
+
const width = !open ? resolvedClosed : wide ? resolvedWide : resolvedOpen;
|
|
15
|
+
return {
|
|
16
|
+
width,
|
|
17
|
+
background: theme.palette.neutralGrey[90],
|
|
18
|
+
boxSizing: 'border-box',
|
|
19
|
+
transition: WIDTH_TRANSITION,
|
|
20
|
+
[`& .${paperClasses.root}`]: {
|
|
21
|
+
width,
|
|
22
|
+
background: theme.palette.neutralGrey[90],
|
|
23
|
+
boxSizing: 'border-box',
|
|
24
|
+
transition: WIDTH_TRANSITION,
|
|
25
|
+
overflowY: 'hidden',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
export default BaseDrawer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -31,9 +31,7 @@ const Dropdown = (({ children, placeholder, value, error, helperMsg, onChange, s
|
|
|
31
31
|
setTimeout(() => {
|
|
32
32
|
document.activeElement.blur();
|
|
33
33
|
}, 0);
|
|
34
|
-
}, onChange: handleChange, error: !!error, open:
|
|
35
|
-
// eslint-disable-next-line no-nested-ternary
|
|
36
|
-
typeof otherProps.open !== 'undefined'
|
|
34
|
+
}, onChange: handleChange, error: !!error, open: typeof otherProps.open !== 'undefined'
|
|
37
35
|
? otherProps.open
|
|
38
36
|
: otherProps.disabled
|
|
39
37
|
? false
|
|
@@ -13,9 +13,7 @@ const IconDropdown = ({ open, disabled, children, ...otherProps }) => {
|
|
|
13
13
|
cursor: 'pointer',
|
|
14
14
|
transform: 'scaleY(-1)',
|
|
15
15
|
}
|
|
16
|
-
: undefined })), open:
|
|
17
|
-
// eslint-disable-next-line no-nested-ternary
|
|
18
|
-
typeof open !== 'undefined' ? open : disabled ? false : isOpen, disabled: disabled, multiple: false, onClick: () => {
|
|
16
|
+
: undefined })), open: typeof open !== 'undefined' ? open : disabled ? false : isOpen, disabled: disabled, multiple: false, onClick: () => {
|
|
19
17
|
if (!disabled)
|
|
20
18
|
setOpen(!isOpen);
|
|
21
19
|
}, MenuProps: {
|
|
@@ -1,33 +1,69 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { forwardRef, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import StyledTypography from './EllipsisTypography.styled';
|
|
4
4
|
import { Tooltip } from '../Tooltip';
|
|
5
5
|
import { ResizeObserverContext } from '../ResizeObserver/ResizeObserverContext';
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const MAX_RETRY_COUNT = 10;
|
|
7
|
+
const RETRY_DELAY_MS = 50;
|
|
8
|
+
const DEFAULT_HEIGHT_THRESHOLD = 1;
|
|
9
|
+
const EllipsisTypography = forwardRef(({ children, heightThreshold: heightThresholdProp, tooltipPlacement = 'bottom', maxLines = 1, ...otherProps }, forwardedRef) => {
|
|
10
|
+
const internalRef = useRef(null);
|
|
11
|
+
const retryCountRef = useRef(0);
|
|
12
|
+
const timeoutRef = useRef(null);
|
|
8
13
|
const direction = otherProps.direction || 'row';
|
|
9
|
-
const heightThreshold = heightThresholdProp
|
|
14
|
+
const heightThreshold = heightThresholdProp ?? DEFAULT_HEIGHT_THRESHOLD;
|
|
10
15
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
11
16
|
const { addResizeHandler, removeResizeHandler } = useContext(ResizeObserverContext);
|
|
17
|
+
const heightThresholdRef = useRef(heightThreshold);
|
|
18
|
+
heightThresholdRef.current = heightThreshold;
|
|
19
|
+
const checkOverflow = useCallback((target) => {
|
|
20
|
+
if (!target)
|
|
21
|
+
return;
|
|
22
|
+
const { scrollHeight, clientHeight, scrollWidth, clientWidth } = target;
|
|
23
|
+
// The element may not be laid out yet (all metrics 0); retry until it is.
|
|
24
|
+
if (scrollHeight === 0 && clientHeight === 0 && scrollWidth === 0 && clientWidth === 0) {
|
|
25
|
+
if (retryCountRef.current < MAX_RETRY_COUNT) {
|
|
26
|
+
retryCountRef.current += 1;
|
|
27
|
+
timeoutRef.current = setTimeout(() => checkOverflow(target), RETRY_DELAY_MS);
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
retryCountRef.current = 0;
|
|
32
|
+
const threshold = heightThresholdRef.current;
|
|
33
|
+
// Single-line ellipsis truncates horizontally (scrollHeight === clientHeight), so width must
|
|
34
|
+
// also be compared. Multi-line clamp still overflows vertically.
|
|
35
|
+
const isOverflowing = scrollWidth > clientWidth + threshold || scrollHeight > clientHeight + threshold;
|
|
36
|
+
setShowTooltip(isOverflowing);
|
|
37
|
+
}, []);
|
|
38
|
+
const setRefs = useCallback((node) => {
|
|
39
|
+
internalRef.current = node;
|
|
40
|
+
if (typeof forwardedRef === 'function') {
|
|
41
|
+
forwardedRef(node);
|
|
42
|
+
}
|
|
43
|
+
else if (forwardedRef) {
|
|
44
|
+
forwardedRef.current = node;
|
|
45
|
+
}
|
|
46
|
+
}, [forwardedRef]);
|
|
12
47
|
useEffect(() => {
|
|
13
|
-
|
|
48
|
+
const target = internalRef.current;
|
|
49
|
+
if (!target)
|
|
14
50
|
return;
|
|
15
|
-
const
|
|
16
|
-
const checkOverflow = () => {
|
|
17
|
-
const isOverflowing = target.scrollHeight - target.clientHeight > heightThreshold;
|
|
18
|
-
setShowTooltip(isOverflowing);
|
|
19
|
-
};
|
|
51
|
+
const run = () => checkOverflow(target);
|
|
20
52
|
if (addResizeHandler) {
|
|
21
|
-
addResizeHandler(target,
|
|
53
|
+
addResizeHandler(target, run);
|
|
22
54
|
}
|
|
23
|
-
|
|
55
|
+
run();
|
|
24
56
|
return () => {
|
|
57
|
+
if (timeoutRef.current) {
|
|
58
|
+
clearTimeout(timeoutRef.current);
|
|
59
|
+
}
|
|
25
60
|
if (removeResizeHandler) {
|
|
26
61
|
removeResizeHandler(target);
|
|
27
62
|
}
|
|
28
63
|
};
|
|
29
|
-
}, [
|
|
30
|
-
const TypographyComponent = (_jsx(StyledTypography, { ...otherProps, ref:
|
|
64
|
+
}, [children, maxLines, checkOverflow, addResizeHandler, removeResizeHandler]);
|
|
65
|
+
const TypographyComponent = (_jsx(StyledTypography, { ...otherProps, ref: setRefs, direction: direction, maxLines: maxLines, children: children }));
|
|
31
66
|
return showTooltip ? (_jsx(Tooltip, { title: children, placement: tooltipPlacement, size: "small", children: TypographyComponent })) : (TypographyComponent);
|
|
32
|
-
}
|
|
67
|
+
});
|
|
68
|
+
EllipsisTypography.displayName = 'EllipsisTypography';
|
|
33
69
|
export default EllipsisTypography;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
2
|
import { Player } from '@lottiefiles/react-lottie-player';
|
|
4
3
|
import { LoadingOverlay, LoadingIndicatorBox, LoadingMessage, LoadingDetails, } from './LoadingIndicator.styled';
|
|
5
4
|
const DotLoadingAnimation = require('./assets/DotLoadingAnimation.json');
|
|
@@ -12,11 +12,11 @@ const NoMatchContainer = () => {
|
|
|
12
12
|
flexDirection: 'column',
|
|
13
13
|
alignItems: 'center',
|
|
14
14
|
}, children: [_jsx(Typography, { variant: "h7", sx: {
|
|
15
|
-
color:
|
|
15
|
+
color: 'neutralGrey.25',
|
|
16
16
|
mt: '100px',
|
|
17
|
-
mb: '16px'
|
|
17
|
+
mb: '16px',
|
|
18
18
|
}, children: "Nothing matches your search" }), _jsx(Typography, { variant: "h9", sx: {
|
|
19
|
-
color:
|
|
19
|
+
color: 'neutralGrey.25',
|
|
20
20
|
}, children: "Please try again!" })] }) }));
|
|
21
21
|
};
|
|
22
22
|
export default NoMatchContainer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Popover as MuiPopover } from '@mui/material';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
const StyledPopover = styled(MuiPopover)(({ theme }) => ({
|
|
4
|
+
'& .MuiPopover-paper': {
|
|
5
|
+
backgroundColor: theme.palette.neutralGrey[70],
|
|
6
|
+
borderRadius: theme.spacing(2),
|
|
7
|
+
backgroundImage: 'none',
|
|
8
|
+
},
|
|
9
|
+
}));
|
|
10
|
+
export default StyledPopover;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -26,9 +26,7 @@ const BaseTextInput = styled('input', {
|
|
|
26
26
|
})(({ theme, large, error, leftIcon, width, type }) => {
|
|
27
27
|
let resultStyle = {
|
|
28
28
|
...baseTextInputStyle(theme),
|
|
29
|
-
width:
|
|
30
|
-
// eslint-disable-next-line no-nested-ternary
|
|
31
|
-
typeof width !== 'undefined' ? (typeof width === 'number' ? `${width}px` : width) : width,
|
|
29
|
+
width: typeof width !== 'undefined' ? (typeof width === 'number' ? `${width}px` : width) : width,
|
|
32
30
|
};
|
|
33
31
|
if (error) {
|
|
34
32
|
resultStyle = {
|
|
@@ -64,9 +62,7 @@ const FileInputLabel = styled('label', {
|
|
|
64
62
|
})(({ theme, large, error, leftIcon, width, disabled, readOnly }) => {
|
|
65
63
|
let resultStyle = {
|
|
66
64
|
...baseTextInputStyle(theme),
|
|
67
|
-
width:
|
|
68
|
-
// eslint-disable-next-line no-nested-ternary
|
|
69
|
-
typeof width !== 'undefined' ? (typeof width === 'number' ? `${width}px` : width) : width,
|
|
65
|
+
width: typeof width !== 'undefined' ? (typeof width === 'number' ? `${width}px` : width) : width,
|
|
70
66
|
};
|
|
71
67
|
if (error) {
|
|
72
68
|
resultStyle = {
|
|
@@ -7,13 +7,18 @@ const Toggle = ({ value, name, checked, defaultChecked, disabled, required, onCh
|
|
|
7
7
|
return (_jsxs(Container, { ...rootProps, className: clsx('toggle', { 'is-disabled': disabled }, rootProps.className), component: label != null ? 'label' : 'span', children: [_jsx(ToggleComponent, { disableRipple: true, value: true, name: name,
|
|
8
8
|
// indeterminate가 true인 Toggle을 클릭했을 때
|
|
9
9
|
// 발생하는 change event target의 checked property의 일관성을 보장함
|
|
10
|
-
checked: indeterminate ? true : checked, defaultChecked: defaultChecked, disabled: disabled, required: required, onChange: onChange, onChangeCapture: onChangeCapture, slotProps: { input: { ...inputProps, ref: inputRef } }, focusRipple: false, toggleColor: toggleColor }), label && (_jsx(Typography, { variant: "body_m1", sx: [
|
|
10
|
+
checked: indeterminate ? true : checked, defaultChecked: defaultChecked, disabled: disabled, required: required, onChange: onChange, onChangeCapture: onChangeCapture, slotProps: { input: { ...inputProps, ref: inputRef } }, focusRipple: false, toggleColor: toggleColor }), label && (_jsx(Typography, { variant: "body_m1", sx: [
|
|
11
|
+
{
|
|
11
12
|
display: 'flex',
|
|
12
|
-
alignItems: 'center'
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
},
|
|
15
|
+
labelPlacement === 'left'
|
|
16
|
+
? {
|
|
17
|
+
order: -1,
|
|
18
|
+
}
|
|
19
|
+
: {
|
|
20
|
+
order: 1,
|
|
21
|
+
},
|
|
22
|
+
], children: label }))] }));
|
|
18
23
|
};
|
|
19
24
|
export default Toggle;
|
|
@@ -83,10 +83,14 @@ const UploadManager = ({ title, subTitle, files, onClose, onCancel, onRetry, })
|
|
|
83
83
|
bottom: '20px',
|
|
84
84
|
right: '20px',
|
|
85
85
|
zIndex: 10,
|
|
86
|
-
}, children: _jsxs(StyledPaper, { elevation: 1, children: [_jsxs(StyledToolbar, { children: [_jsx(Typography, { variant: "h9", children: title }), _jsx(Typography, { variant: "body1", sx: { marginLeft: '8px' }, children: subTitle }), _jsxs(StyledToolbarButtonContainer, { children: [_jsx(Tooltip, { title: expanded ? 'Minimize' : 'Maximize', children: _jsx(Box, { children: _jsx(Button, { onClick: handleExpandClick, variant: "ghost", color: "secondary", icon: _jsx(ArrowUp, { style: { color: theme.palette.neutralGrey[40] } }), size: "small", sx: [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
}, children: _jsxs(StyledPaper, { elevation: 1, children: [_jsxs(StyledToolbar, { children: [_jsx(Typography, { variant: "h9", children: title }), _jsx(Typography, { variant: "body1", sx: { marginLeft: '8px' }, children: subTitle }), _jsxs(StyledToolbarButtonContainer, { children: [_jsx(Tooltip, { title: expanded ? 'Minimize' : 'Maximize', children: _jsx(Box, { children: _jsx(Button, { onClick: handleExpandClick, variant: "ghost", color: "secondary", icon: _jsx(ArrowUp, { style: { color: theme.palette.neutralGrey[40] } }), size: "small", sx: [
|
|
87
|
+
expanded
|
|
88
|
+
? {
|
|
89
|
+
transform: 'rotate(0deg)',
|
|
90
|
+
}
|
|
91
|
+
: {
|
|
92
|
+
transform: 'rotate(180deg)',
|
|
93
|
+
},
|
|
94
|
+
] }) }) }), _jsx(Tooltip, { title: "Close", children: _jsx(Box, { children: _jsx(Button, { onClick: onClose, variant: "ghost", color: "secondary", icon: _jsx(Close, { style: { color: theme.palette.neutralGrey[40] } }), size: "small" }) }) })] })] }), expanded && _jsx(Divider, { orientation: "horizontal" }), _jsx(StyledCollapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: files.map((download, index) => (_jsxs(Fragment, { children: [_jsx(UploadFile, { file: download, onCancel: onCancel, onRetry: onRetry }), index !== files.length - 1 && _jsx(Divider, { orientation: "horizontal" })] }, download.id))) })] }) }));
|
|
91
95
|
};
|
|
92
96
|
export default UploadManager;
|
package/dist/components/index.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
export * from './Alert';
|
|
2
|
+
export * from './Autocomplete';
|
|
2
3
|
export * from './Button';
|
|
3
4
|
export * from './Card';
|
|
4
5
|
export * from './Checkbox';
|
|
5
6
|
export * from './Chip';
|
|
7
|
+
export * from './Collapse';
|
|
6
8
|
export * from './DataTable';
|
|
7
9
|
export * from './DatePicker';
|
|
8
10
|
export * from './Dialog';
|
|
9
11
|
export * from './Divider';
|
|
12
|
+
export * from './Drawer';
|
|
10
13
|
export * from './Dropdown';
|
|
11
14
|
export * from './EllipsisTypography';
|
|
12
15
|
export * from './FileDnDZone';
|
|
13
16
|
export * from './List';
|
|
17
|
+
export * from './Popover';
|
|
14
18
|
export * from './LoadingIndicator';
|
|
15
19
|
export * from './Menu';
|
|
16
20
|
export * from './Pagination';
|
|
@@ -52,13 +52,18 @@ export const GraphScoreIndicator = ({ value, isCutoff, isJet, }) => {
|
|
|
52
52
|
leftPos = '20px';
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
return (_jsxs(GraphScoreIndicatorContainer, { className: "analysis-bar-score-indicator", sx: [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
return (_jsxs(GraphScoreIndicatorContainer, { className: "analysis-bar-score-indicator", sx: [
|
|
56
|
+
{
|
|
57
|
+
left: leftPos,
|
|
58
|
+
},
|
|
59
|
+
isJet
|
|
60
|
+
? {
|
|
61
|
+
transform: 'translateX(-50%) translateY(8px)',
|
|
62
|
+
}
|
|
63
|
+
: {
|
|
64
|
+
transform: 'translateX(-50%)',
|
|
65
|
+
},
|
|
66
|
+
], isJet: isJet, children: [_jsx(Typography, { variant: "small_body_sb1", sx: { textAlign: 'center' }, children: value }), _jsx(GraphScoreIndicatorPip, {})] }));
|
|
62
67
|
};
|
|
63
68
|
const GraphAxisLabelContainer = styled('span')(() => {
|
|
64
69
|
return {
|
|
@@ -7,26 +7,41 @@ const FreeText = ({ componentType = 'freeText', size = 'medium', content, height
|
|
|
7
7
|
throw new Error("The 'componentType' prop is required.");
|
|
8
8
|
if (!content)
|
|
9
9
|
throw new Error("The 'content' prop is required.");
|
|
10
|
-
return (_jsx(Box, { sx: [
|
|
10
|
+
return (_jsx(Box, { sx: [
|
|
11
|
+
{
|
|
11
12
|
display: 'flex',
|
|
12
|
-
overflowY: 'auto'
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
overflowY: 'auto',
|
|
14
|
+
},
|
|
15
|
+
background
|
|
16
|
+
? {
|
|
17
|
+
padding: '8px 6px 8px 16px',
|
|
18
|
+
}
|
|
19
|
+
: {
|
|
20
|
+
padding: 0,
|
|
21
|
+
},
|
|
22
|
+
background
|
|
23
|
+
? {
|
|
24
|
+
borderRadius: '8px',
|
|
25
|
+
}
|
|
26
|
+
: {
|
|
27
|
+
borderRadius: 0,
|
|
28
|
+
},
|
|
29
|
+
background
|
|
30
|
+
? {
|
|
31
|
+
backgroundColor: theme.palette.neutralGrey[75],
|
|
32
|
+
}
|
|
33
|
+
: {
|
|
34
|
+
backgroundColor: 'transparent',
|
|
35
|
+
},
|
|
36
|
+
height
|
|
37
|
+
? {
|
|
38
|
+
height: height,
|
|
39
|
+
}
|
|
40
|
+
: {
|
|
41
|
+
height: 'auto',
|
|
42
|
+
},
|
|
43
|
+
], children: _jsx(PresentationTypography, { size: size, sx: [
|
|
44
|
+
{
|
|
30
45
|
display: 'block',
|
|
31
46
|
whiteSpace: 'pre-wrap',
|
|
32
47
|
overflow: 'auto',
|
|
@@ -37,15 +52,22 @@ const FreeText = ({ componentType = 'freeText', size = 'medium', content, height
|
|
|
37
52
|
width: '6px',
|
|
38
53
|
backgroundColor: theme.palette.neutralGrey[65],
|
|
39
54
|
borderRadius: '6px',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
background
|
|
58
|
+
? {
|
|
59
|
+
color: '#FFFFFF',
|
|
60
|
+
}
|
|
61
|
+
: {
|
|
62
|
+
color: 'inherit',
|
|
63
|
+
},
|
|
64
|
+
height
|
|
65
|
+
? {
|
|
66
|
+
height: '100%',
|
|
40
67
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, height ? {
|
|
46
|
-
height: '100%'
|
|
47
|
-
} : {
|
|
48
|
-
height: 'auto'
|
|
49
|
-
}], children: content }) }));
|
|
68
|
+
: {
|
|
69
|
+
height: 'auto',
|
|
70
|
+
},
|
|
71
|
+
], children: content }) }));
|
|
50
72
|
};
|
|
51
73
|
export default FreeText;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Divider } from '../../components';
|
|
2
|
+
import { Divider } from '../../components/Divider';
|
|
3
3
|
const HorizonDivider = ({ componentType = 'divider' }) => {
|
|
4
4
|
if (!componentType)
|
|
5
5
|
throw new Error("The 'componentType' prop is required.");
|
|
@@ -6,25 +6,27 @@ import { BaseSlider, Container } from './Threshold.styled';
|
|
|
6
6
|
import { Score } from '../Score';
|
|
7
7
|
import { Statistic } from '../Statistic';
|
|
8
8
|
import { PresentationTypography } from '../presentations.styled';
|
|
9
|
-
import { Button
|
|
9
|
+
import { Button } from '../../components/Button';
|
|
10
|
+
import { Dropdown, DropdownItem } from '../../components/Dropdown';
|
|
10
11
|
import { HorizonDivider } from '../HorizonDivider';
|
|
11
12
|
import { FreeText } from '../FreeText';
|
|
12
|
-
import { baseSliderMarks,
|
|
13
|
-
const Threshold = ({ componentType = 'threshold', title, totalScore, totalCells, statisticItems, options, description, controlStep = 1, isLoading = false, thresholdState, onChangeDropdown, onChangeSlider, onSliderChangeCommitted, onClickUpdateConfiguration, }) => {
|
|
13
|
+
import { NO_LABEL_ONLY_MARK, baseSliderMarks, getLabelOnlyMarkIndex, getSliderMarks, } from './Threshold.utils';
|
|
14
|
+
const Threshold = ({ componentType = 'threshold', title, totalScore, totalCells, statisticItems, options, description, controlStep = 1, showDefaultMark = false, isLoading = false, thresholdState, onChangeDropdown, onChangeSlider, onSliderChangeCommitted, onClickUpdateConfiguration, }) => {
|
|
14
15
|
if (!componentType)
|
|
15
16
|
throw new Error("The 'componentType' prop is required.");
|
|
16
|
-
if (!totalScore)
|
|
17
|
-
throw new Error("The 'totalScore' prop is required.");
|
|
18
17
|
if (!statisticItems.length)
|
|
19
18
|
throw new Error("The 'statisticItems' prop must contain at least one item.");
|
|
20
19
|
if (!options.length)
|
|
21
20
|
throw new Error("The 'options' prop must contain at least one item.");
|
|
22
21
|
const [isThresholdChanged, setIsThresholdChanged] = useState(false);
|
|
23
22
|
const selectedOptionValue = useMemo(() => {
|
|
24
|
-
return (options.find((option) => option.title === thresholdState?.selectedItem)?.value
|
|
23
|
+
return (options.find((option) => option.title === thresholdState?.selectedItem)?.value ??
|
|
25
24
|
options[0].value);
|
|
26
25
|
}, [options, thresholdState?.selectedItem]);
|
|
27
|
-
const
|
|
26
|
+
const sliderMarks = useMemo(() => (showDefaultMark ? getSliderMarks(selectedOptionValue) : baseSliderMarks), [showDefaultMark, selectedOptionValue]);
|
|
27
|
+
const labelOnlyMarkIndex = useMemo(() => showDefaultMark
|
|
28
|
+
? getLabelOnlyMarkIndex(sliderMarks, selectedOptionValue)
|
|
29
|
+
: NO_LABEL_ONLY_MARK, [showDefaultMark, sliderMarks, selectedOptionValue]);
|
|
28
30
|
const handleDropdownChange = useCallback((event) => {
|
|
29
31
|
onChangeDropdown(event);
|
|
30
32
|
setIsThresholdChanged(false);
|
|
@@ -37,11 +39,11 @@ const Threshold = ({ componentType = 'threshold', title, totalScore, totalCells,
|
|
|
37
39
|
onClickUpdateConfiguration();
|
|
38
40
|
setIsThresholdChanged(false);
|
|
39
41
|
}, [onClickUpdateConfiguration]);
|
|
40
|
-
return (_jsxs(Container, { children: [_jsx(Score, { ...totalScore }), _jsx(Statistic, { ...totalCells }), statisticItems.map((item) => {
|
|
42
|
+
return (_jsxs(Container, { children: [totalScore && _jsx(Score, { ...totalScore }), _jsx(Statistic, { ...totalCells }), statisticItems.map((item) => {
|
|
41
43
|
return (_jsx(Statistic, { ...item }, uuidV4()));
|
|
42
44
|
}), _jsx(HorizonDivider, { componentType: "divider" }), _jsx(PresentationTypography, { size: "medium", children: title }), _jsx(Dropdown, { value: thresholdState?.selectedItem, onChange: handleDropdownChange, sx: { width: '258px' }, children: options.map((option) => {
|
|
43
45
|
return (_jsx(DropdownItem, { value: option.title, children: option.title }, option.title));
|
|
44
|
-
}) }), _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', paddingTop: '36px', gap: '6px' }, children: [_jsx(BaseSlider, { disabled: thresholdState?.isPresetSelected, step: controlStep, value: thresholdState?.sliderValue, valueLabelDisplay: "on",
|
|
46
|
+
}) }), _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', paddingTop: '36px', gap: '6px' }, children: [_jsx(BaseSlider, { disabled: thresholdState?.isPresetSelected, step: controlStep, value: thresholdState?.sliderValue, valueLabelDisplay: "on", marks: sliderMarks, labelOnlyMarkIndex: labelOnlyMarkIndex, onChange: handleSliderChange, onChangeCommitted: onSliderChangeCommitted }), !thresholdState?.isPresetSelected && (_jsx(Button, { id: "update-threshold-config-btn", label: "Update Configuration", sx: {
|
|
45
47
|
width: '100%',
|
|
46
48
|
}, disabled: !isThresholdChanged || isLoading, onClick: handleUpdateConfiguration, loading: isLoading })), thresholdState?.isPresetSelected && description?.preset && (_jsx(FreeText, { componentType: "freeText", size: "small-dimmed", content: description.preset })), !thresholdState?.isPresetSelected && description?.user && (_jsx(FreeText, { componentType: "freeText", size: "small-dimmed", content: description.user }))] })] }));
|
|
47
49
|
};
|