@lunit/oui 1.3.0 → 2.0.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/assets/ic-copy-coordinates-outlined-20px.js +1 -1
- package/dist/components/Alert/Alert.utils.js +3 -3
- package/dist/components/Chip/Chip.utils.js +3 -3
- package/dist/components/TextField/TextArea.types.d.ts +2 -1
- package/dist/components/TextField/TextInput.js +5 -1
- package/dist/components/TextField/TextInput.styled.js +2 -1
- package/dist/components/TextField/TextInput.types.d.ts +6 -2
- package/dist/components/TextField/TextInput.utils.d.ts +3 -3
- package/dist/components/TextField/TextInput.utils.js +4 -2
- package/dist/components/TextField/components/Buttons.d.ts +7 -1
- package/dist/components/TextField/components/Buttons.js +15 -1
- package/dist/components/TextField/components/FileInput.d.ts +4 -0
- package/dist/components/TextField/components/FileInput.js +21 -0
- package/dist/components/Toggle/Toggle.d.ts +3 -0
- package/dist/components/Toggle/Toggle.js +16 -0
- package/dist/components/Toggle/Toggle.styled.d.ts +7 -0
- package/dist/components/Toggle/Toggle.styled.js +90 -0
- package/dist/components/Toggle/Toggle.types.d.ts +18 -0
- package/dist/components/Toggle/Toggle.types.js +1 -0
- package/dist/components/Toggle/index.d.ts +4 -0
- package/dist/components/Toggle/index.js +2 -0
- package/dist/components/UploadManager/UploadManager.js +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/presentations/Accordion/Accordion.d.ts +3 -0
- package/dist/presentations/Accordion/Accordion.js +21 -0
- package/dist/presentations/Accordion/Accordion.styled.d.ts +22 -0
- package/dist/presentations/Accordion/Accordion.styled.js +39 -0
- package/dist/presentations/Accordion/Accordion.types.d.ts +22 -0
- package/dist/presentations/Accordion/Accordion.types.js +1 -0
- package/dist/presentations/Accordion/index.d.ts +2 -0
- package/dist/presentations/Accordion/index.js +2 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.d.ts +3 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.js +26 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.styled.d.ts +31 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.styled.js +103 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.types.d.ts +11 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.types.js +1 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.utils.d.ts +5 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.utils.js +34 -0
- package/dist/presentations/AnalysisBar/HeatmapGraphIcon/HeatmapGraphSVG.d.ts +3 -0
- package/dist/presentations/AnalysisBar/HeatmapGraphIcon/HeatmapGraphSVG.js +3 -0
- package/dist/presentations/AnalysisBar/HeatmapGraphIcon/index.d.ts +7 -0
- package/dist/presentations/AnalysisBar/HeatmapGraphIcon/index.js +8 -0
- package/dist/presentations/AnalysisBar/index.d.ts +4 -0
- package/dist/presentations/AnalysisBar/index.js +2 -0
- package/dist/presentations/FreeText/FreeText.d.ts +3 -0
- package/dist/presentations/FreeText/FreeText.js +27 -0
- package/dist/presentations/FreeText/FreeText.types.d.ts +9 -0
- package/dist/presentations/FreeText/FreeText.types.js +1 -0
- package/dist/presentations/FreeText/index.d.ts +4 -0
- package/dist/presentations/FreeText/index.js +2 -0
- package/dist/presentations/Histogram/Histogram.d.ts +3 -0
- package/dist/presentations/Histogram/Histogram.js +15 -0
- package/dist/presentations/Histogram/Histogram.styled.d.ts +23 -0
- package/dist/presentations/Histogram/Histogram.styled.js +47 -0
- package/dist/presentations/Histogram/Histogram.types.d.ts +27 -0
- package/dist/presentations/Histogram/Histogram.types.js +1 -0
- package/dist/presentations/Histogram/Histogram.utils.d.ts +23 -0
- package/dist/presentations/Histogram/Histogram.utils.js +45 -0
- package/dist/presentations/Histogram/HistogramCharts.d.ts +3 -0
- package/dist/presentations/Histogram/HistogramCharts.js +20 -0
- package/dist/presentations/Histogram/HistogramTabs.d.ts +3 -0
- package/dist/presentations/Histogram/HistogramTabs.js +27 -0
- package/dist/presentations/Histogram/index.d.ts +4 -0
- package/dist/presentations/Histogram/index.js +2 -0
- package/dist/presentations/HorizonDivider/HorizonDivider.d.ts +3 -0
- package/dist/presentations/HorizonDivider/HorizonDivider.js +6 -0
- package/dist/presentations/HorizonDivider/HorizonDivider.types.d.ts +4 -0
- package/dist/presentations/HorizonDivider/HorizonDivider.types.js +1 -0
- package/dist/presentations/HorizonDivider/index.d.ts +4 -0
- package/dist/presentations/HorizonDivider/index.js +2 -0
- package/dist/presentations/Score/Score.d.ts +3 -0
- package/dist/presentations/Score/Score.js +9 -0
- package/dist/presentations/Score/Score.types.d.ts +13 -0
- package/dist/presentations/Score/Score.types.js +1 -0
- package/dist/presentations/Score/index.d.ts +4 -0
- package/dist/presentations/Score/index.js +2 -0
- package/dist/presentations/Statistic/Statistic.d.ts +3 -0
- package/dist/presentations/Statistic/Statistic.js +12 -0
- package/dist/presentations/Statistic/Statistic.styled.d.ts +11 -0
- package/dist/presentations/Statistic/Statistic.styled.js +17 -0
- package/dist/presentations/Statistic/Statistic.types.d.ts +11 -0
- package/dist/presentations/Statistic/Statistic.types.js +1 -0
- package/dist/presentations/Statistic/index.d.ts +4 -0
- package/dist/presentations/Statistic/index.js +2 -0
- package/dist/presentations/ToggleControl/ToggleControl.d.ts +3 -0
- package/dist/presentations/ToggleControl/ToggleControl.js +22 -0
- package/dist/presentations/ToggleControl/ToggleControl.styled.d.ts +15 -0
- package/dist/presentations/ToggleControl/ToggleControl.styled.js +27 -0
- package/dist/presentations/ToggleControl/ToggleControl.types.d.ts +21 -0
- package/dist/presentations/ToggleControl/ToggleControl.types.js +1 -0
- package/dist/presentations/ToggleControl/index.d.ts +4 -0
- package/dist/presentations/ToggleControl/index.js +2 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.d.ts +3 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.js +32 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.styled.d.ts +4 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.styled.js +9 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.types.d.ts +21 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.types.js +1 -0
- package/dist/presentations/ToggleControlGroup/index.d.ts +2 -0
- package/dist/presentations/ToggleControlGroup/index.js +2 -0
- package/dist/presentations/index.d.ts +9 -0
- package/dist/presentations/index.js +9 -0
- package/dist/presentations/presentations.styled.d.ts +3 -0
- package/dist/presentations/presentations.styled.js +91 -0
- package/dist/presentations/presentations.types.d.ts +12 -0
- package/dist/presentations/presentations.types.js +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import { Container, HorizontalStatisticContainer, VerticalStatisticContainer, } from './Statistic.styled';
|
|
4
|
+
import { PresentationSymbolIcon, PresentationTypography } from '../presentations.styled';
|
|
5
|
+
const Statistic = ({ componentType = 'statistic', title, layout = 'vertical', metrics = '', size = 'medium', symbol, color, ...rest }) => {
|
|
6
|
+
return (_jsx(Container, { ...rest, sx: { width: '100%' }, children: layout === 'horizontal' ? (_jsxs(HorizontalStatisticContainer, { children: [_jsxs(Box, { sx: {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
gap: '6px',
|
|
10
|
+
}, children: [symbol && (_jsx(PresentationSymbolIcon, { symbol: symbol, color: color })), _jsx(PresentationTypography, { size: size, children: title })] }), _jsx(PresentationTypography, { size: size, children: metrics })] })) : (_jsx(VerticalStatisticContainer, { title: title, metrics: metrics })) }));
|
|
11
|
+
};
|
|
12
|
+
export default Statistic;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
5
|
+
export declare const HorizontalStatisticContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
8
|
+
export declare const VerticalStatisticContainer: ({ title, metrics, }: {
|
|
9
|
+
title: string;
|
|
10
|
+
metrics: string;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, styled, Typography } from '@mui/material';
|
|
3
|
+
import theme from '../../theme';
|
|
4
|
+
export const Container = styled(Box)(({ theme }) => ({
|
|
5
|
+
display: 'flex',
|
|
6
|
+
}));
|
|
7
|
+
export const HorizontalStatisticContainer = styled(Box)({
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexDirection: 'row',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'space-between',
|
|
12
|
+
gap: '6px',
|
|
13
|
+
width: '100%',
|
|
14
|
+
});
|
|
15
|
+
export const VerticalStatisticContainer = ({ title, metrics, }) => {
|
|
16
|
+
return (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: '6px' }, children: [_jsx(Typography, { variant: "body8", color: theme.palette.neutralGrey[40], children: title }), _jsx(Typography, { variant: "body5", color: theme.palette.neutralGrey[0], children: metrics })] }));
|
|
17
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BoxProps } from '@mui/material';
|
|
2
|
+
import { PresentationSymbolProps } from '../presentations.types';
|
|
3
|
+
export interface StatisticProps extends BoxProps {
|
|
4
|
+
componentType: 'statistic';
|
|
5
|
+
title: string;
|
|
6
|
+
layout?: 'horizontal' | 'vertical';
|
|
7
|
+
metrics?: string;
|
|
8
|
+
size?: 'small-dimmed' | 'small' | 'small-bold' | 'medium' | 'medium-bold' | 'large-bold';
|
|
9
|
+
symbol?: PresentationSymbolProps['symbol'];
|
|
10
|
+
color?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ToggleControlProps } from './ToggleControl.types';
|
|
2
|
+
declare const ToggleControl: ({ componentType, title, size, symbol, tooltip, color, isParent, disabled, bar, checked, isDimmed, onChange, }: ToggleControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default ToggleControl;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { v4 as uuidV4 } from 'uuid';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { ToggleControlContainer, ToggleControlOuter } from './ToggleControl.styled';
|
|
5
|
+
import { AnalysisBar } from '../AnalysisBar';
|
|
6
|
+
import { StyledToggle } from '../../components/Toggle/Toggle.styled';
|
|
7
|
+
import { PresentationSymbolIcon, PresentationTypography } from '../presentations.styled';
|
|
8
|
+
import { FreeText } from '../FreeText';
|
|
9
|
+
import { Statistic } from '../Statistic';
|
|
10
|
+
import { Tooltip } from '../../components';
|
|
11
|
+
import { Information } from '../../icons';
|
|
12
|
+
import theme from '../../theme';
|
|
13
|
+
const ToggleControl = ({ componentType = 'toggle', title, size = 'medium', symbol, tooltip = [], color, isParent = false, disabled = false, bar, checked, isDimmed = false, onChange, }) => {
|
|
14
|
+
const handleChange = (event) => {
|
|
15
|
+
onChange && onChange(event);
|
|
16
|
+
};
|
|
17
|
+
return (_jsxs(ToggleControlOuter, { "data-toggle-name": `toggle-control-${title?.replace(/\s/g, '-')}`, hasBar: !!bar, style: { marginBottom: isParent ? '4px' : '0' }, children: [_jsxs(ToggleControlContainer, { className: "toggle-inner-container", size: size, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: '6px' }, className: "toggle-label", children: [!!tooltip.length && (_jsx(Tooltip, { arrow: true, size: "large", title: _jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: '8px' }, 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: {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
}, children: _jsx(Information, {}) }) })), symbol && (_jsx(PresentationSymbolIcon, { symbol: symbol, color: color, isDimmed: isDimmed || !checked })), _jsx(PresentationTypography, { size: size, sx: { color: checked && !isDimmed ? 'inherit' : theme.palette.neutralGrey[65] }, children: title })] }), _jsx(StyledToggle, { disabled: disabled, checked: checked, onChange: handleChange })] }), bar && (_jsx(Box, { sx: { paddingRight: '16px' }, children: _jsx(AnalysisBar, { isDimmed: isDimmed || !checked, componentType: bar.componentType, expressionValue: bar.expressionValue, expressionLevels: bar.expressionLevels, caption: bar.caption, segments: bar.segments }) }))] }));
|
|
21
|
+
};
|
|
22
|
+
export default ToggleControl;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PresentationElementSize } from '../presentations.types';
|
|
3
|
+
interface ToggleControlContainerProps {
|
|
4
|
+
size?: PresentationElementSize;
|
|
5
|
+
isGrouped?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const ToggleControlOuter: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
8
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
9
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
10
|
+
hasBar: boolean;
|
|
11
|
+
}, {}, {}>;
|
|
12
|
+
export declare const ToggleControlContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
13
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
14
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & ToggleControlContainerProps, {}, {}>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Box, styled } from '@mui/material';
|
|
2
|
+
const getPadding = (size) => {
|
|
3
|
+
if (size === 'large-bold') {
|
|
4
|
+
return '14px 16px 14px 0';
|
|
5
|
+
}
|
|
6
|
+
return '0 16px 0 0';
|
|
7
|
+
};
|
|
8
|
+
export const ToggleControlOuter = styled(Box, { shouldForwardProp: (prop) => prop !== 'hasBar' })(({ hasBar }) => ({
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
alignItems: 'flex-start',
|
|
12
|
+
gap: hasBar ? '10px' : '8px',
|
|
13
|
+
width: '100%',
|
|
14
|
+
height: hasBar ? 'auto' : '20px',
|
|
15
|
+
}));
|
|
16
|
+
export const ToggleControlContainer = styled(Box, {
|
|
17
|
+
shouldForwardProp: (prop) => !['size'].includes(prop.toString()),
|
|
18
|
+
})(({ size }) => {
|
|
19
|
+
return {
|
|
20
|
+
width: '100%',
|
|
21
|
+
display: 'flex',
|
|
22
|
+
justifyContent: 'space-between',
|
|
23
|
+
gap: '34px',
|
|
24
|
+
padding: getPadding(size),
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
};
|
|
27
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FreeTextProps } from '../FreeText';
|
|
3
|
+
import type { AnalysisBarProps } from '../AnalysisBar';
|
|
4
|
+
import type { PresentationElementSize, PresentationSymbol } from '../presentations.types';
|
|
5
|
+
import { StatisticProps } from '../Statistic';
|
|
6
|
+
export interface ToggleControlSpec {
|
|
7
|
+
componentType: 'toggle';
|
|
8
|
+
title: string;
|
|
9
|
+
size?: PresentationElementSize;
|
|
10
|
+
symbol?: PresentationSymbol;
|
|
11
|
+
color?: string;
|
|
12
|
+
checked: boolean;
|
|
13
|
+
tooltip?: (StatisticProps | FreeTextProps)[];
|
|
14
|
+
bar?: AnalysisBarProps;
|
|
15
|
+
}
|
|
16
|
+
export interface ToggleControlProps extends ToggleControlSpec {
|
|
17
|
+
isParent?: boolean;
|
|
18
|
+
isDimmed?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ToggleControlGroupProps } from './ToggleControlGroup.types';
|
|
2
|
+
declare const ToggleControlGroup: ({ componentType, size, title, tooltip, bar, childToggles, disabled, checked, behavior, onChange, }: ToggleControlGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default ToggleControlGroup;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { v4 as uuidV4 } from 'uuid';
|
|
4
|
+
import { filter as _filter } from 'lodash';
|
|
5
|
+
import { ToggleControlGroupContainer } from './ToggleControlGroup.styled';
|
|
6
|
+
import ToggleControl from '../ToggleControl/ToggleControl';
|
|
7
|
+
const ToggleControlGroup = ({ componentType = 'toggleGroup', size = 'medium', title, tooltip = [], bar, childToggles, disabled, checked, behavior = 'multi', onChange, }) => {
|
|
8
|
+
const [toggleChecked, setToggleChecked] = useState(checked || _filter(childToggles, (child) => child.checked).length > 0);
|
|
9
|
+
const [childrenChecked, setChildrenChecked] = useState(childToggles?.map((child) => child.checked) || []);
|
|
10
|
+
const handleToggleChange = (event) => {
|
|
11
|
+
setToggleChecked(!toggleChecked);
|
|
12
|
+
onChange(event);
|
|
13
|
+
};
|
|
14
|
+
const handleMultiChange = (index) => {
|
|
15
|
+
const newState = [...childrenChecked];
|
|
16
|
+
newState[index] = !newState[index];
|
|
17
|
+
setChildrenChecked(newState);
|
|
18
|
+
};
|
|
19
|
+
const handleExclusiveChange = (index, event) => {
|
|
20
|
+
const newState = Array(childrenChecked.length).fill(false);
|
|
21
|
+
setChildrenChecked(newState);
|
|
22
|
+
newState[index] = event.target.checked;
|
|
23
|
+
setChildrenChecked(newState);
|
|
24
|
+
};
|
|
25
|
+
return (_jsxs(ToggleControlGroupContainer, { children: [_jsx(ToggleControl, { isParent: true, componentType: "toggle", bar: bar, disabled: disabled, size: size, title: title, tooltip: tooltip, checked: toggleChecked, onChange: handleToggleChange }), childToggles?.map((child, index) => {
|
|
26
|
+
return (_jsx(ToggleControl, { componentType: "toggle", title: child.title, size: size, tooltip: child.tooltip, symbol: child.symbol, color: child.color, isDimmed: !toggleChecked, checked: childrenChecked[index], disabled: !toggleChecked, onChange: (event) => {
|
|
27
|
+
behavior === 'multi' ? handleMultiChange(index) : handleExclusiveChange(index, event);
|
|
28
|
+
child.onChange(event);
|
|
29
|
+
} }, uuidV4()));
|
|
30
|
+
})] }));
|
|
31
|
+
};
|
|
32
|
+
export default ToggleControlGroup;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ToggleControlGroupContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AnalysisBarProps } from '../AnalysisBar';
|
|
3
|
+
import { FreeTextProps } from '../FreeText';
|
|
4
|
+
import type { PresentationElementSize } from '../presentations.types';
|
|
5
|
+
import { StatisticProps } from '../Statistic';
|
|
6
|
+
import type { ToggleControlProps } from '../ToggleControl';
|
|
7
|
+
export type ToggleControlGroupBehavior = 'exclusive' | 'multi';
|
|
8
|
+
export interface ToggleGroupControlSpec {
|
|
9
|
+
componentType: 'toggleGroup';
|
|
10
|
+
title: string;
|
|
11
|
+
behavior?: ToggleControlGroupBehavior;
|
|
12
|
+
size?: PresentationElementSize;
|
|
13
|
+
tooltip?: (StatisticProps | FreeTextProps)[];
|
|
14
|
+
bar?: AnalysisBarProps;
|
|
15
|
+
checked: boolean;
|
|
16
|
+
childToggles: ToggleControlProps[];
|
|
17
|
+
}
|
|
18
|
+
export interface ToggleControlGroupProps extends ToggleGroupControlSpec {
|
|
19
|
+
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './Accordion';
|
|
2
|
+
export * from './AnalysisBar';
|
|
3
|
+
export * from './FreeText';
|
|
4
|
+
export * from './Histogram';
|
|
5
|
+
export * from './HorizonDivider';
|
|
6
|
+
export * from './Score';
|
|
7
|
+
export * from './Statistic';
|
|
8
|
+
export * from './ToggleControl';
|
|
9
|
+
export * from './ToggleControlGroup';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './Accordion';
|
|
2
|
+
export * from './AnalysisBar';
|
|
3
|
+
export * from './FreeText';
|
|
4
|
+
export * from './Histogram';
|
|
5
|
+
export * from './HorizonDivider';
|
|
6
|
+
export * from './Score';
|
|
7
|
+
export * from './Statistic';
|
|
8
|
+
export * from './ToggleControl';
|
|
9
|
+
export * from './ToggleControlGroup';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PresentationSymbolProps, PresentationTypographyProps } from './presentations.types';
|
|
2
|
+
export declare const PresentationTypography: (props: PresentationTypographyProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const PresentationSymbolIcon: ({ symbol, color, isDimmed, }: PresentationSymbolProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from '@mui/material';
|
|
3
|
+
import theme from '../theme';
|
|
4
|
+
export const PresentationTypography = (props) => {
|
|
5
|
+
const { size, ...rest } = props;
|
|
6
|
+
if (size === 'small-dimmed') {
|
|
7
|
+
return (_jsx(Typography, { variant: "body_m2", sx: { color: theme.palette.neutralGrey[40] }, ...rest }));
|
|
8
|
+
}
|
|
9
|
+
if (size === 'small') {
|
|
10
|
+
return (_jsx(Typography, { variant: "body8", ...rest }));
|
|
11
|
+
}
|
|
12
|
+
if (size === 'small-bold') {
|
|
13
|
+
return (_jsx(Typography, { variant: "body8", sx: { fontWeight: 'bold' }, ...rest }));
|
|
14
|
+
}
|
|
15
|
+
if (size === 'medium') {
|
|
16
|
+
return (_jsx(Typography, { variant: "body5", ...rest }));
|
|
17
|
+
}
|
|
18
|
+
if (size === 'medium-bold') {
|
|
19
|
+
return (_jsx(Typography, { variant: "body_b1", ...rest }));
|
|
20
|
+
}
|
|
21
|
+
if (size === 'large-bold') {
|
|
22
|
+
return (_jsx(Typography, { variant: "h9", ...rest }));
|
|
23
|
+
}
|
|
24
|
+
return _jsx(Typography, { ...rest });
|
|
25
|
+
};
|
|
26
|
+
export const PresentationSymbolIcon = ({ symbol, color = 'black', isDimmed = false, }) => {
|
|
27
|
+
if (symbol === 'circle') {
|
|
28
|
+
return (_jsx("div", { style: {
|
|
29
|
+
height: '100%',
|
|
30
|
+
width: '10px',
|
|
31
|
+
display: 'flex',
|
|
32
|
+
opacity: isDimmed ? 0.5 : 1,
|
|
33
|
+
}, children: _jsx("span", { style: {
|
|
34
|
+
height: '6px',
|
|
35
|
+
width: '6px',
|
|
36
|
+
backgroundColor: color,
|
|
37
|
+
borderRadius: '50%',
|
|
38
|
+
border: '1px solid black',
|
|
39
|
+
} }) }));
|
|
40
|
+
}
|
|
41
|
+
if (symbol === 'rectangle') {
|
|
42
|
+
return (_jsx("div", { style: {
|
|
43
|
+
height: '100%',
|
|
44
|
+
width: '10px',
|
|
45
|
+
display: 'flex',
|
|
46
|
+
opacity: isDimmed ? 0.5 : 1,
|
|
47
|
+
}, children: _jsx("span", { style: {
|
|
48
|
+
height: '10px',
|
|
49
|
+
width: '10px',
|
|
50
|
+
backgroundColor: color,
|
|
51
|
+
} }) }));
|
|
52
|
+
}
|
|
53
|
+
if (symbol === 'border-circle') {
|
|
54
|
+
return (_jsx("div", { style: {
|
|
55
|
+
height: '100%',
|
|
56
|
+
width: '10px',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
opacity: isDimmed ? 0.5 : 1,
|
|
59
|
+
}, children: _jsx("span", { style: {
|
|
60
|
+
height: '10px',
|
|
61
|
+
width: '10px',
|
|
62
|
+
backgroundColor: color,
|
|
63
|
+
borderRadius: '50%',
|
|
64
|
+
border: '1px solid black',
|
|
65
|
+
} }) }));
|
|
66
|
+
}
|
|
67
|
+
if (symbol === 'border-rectangle') {
|
|
68
|
+
return (_jsx("div", { style: {
|
|
69
|
+
height: '100%',
|
|
70
|
+
width: '10px',
|
|
71
|
+
display: 'flex',
|
|
72
|
+
opacity: isDimmed ? 0.5 : 1,
|
|
73
|
+
}, children: _jsx("span", { style: {
|
|
74
|
+
height: '10px',
|
|
75
|
+
width: '10px',
|
|
76
|
+
backgroundColor: color,
|
|
77
|
+
border: '1px solid black',
|
|
78
|
+
} }) }));
|
|
79
|
+
}
|
|
80
|
+
// Fallback
|
|
81
|
+
return (_jsx("div", { style: {
|
|
82
|
+
height: '100%',
|
|
83
|
+
width: '10px',
|
|
84
|
+
display: 'flex',
|
|
85
|
+
opacity: isDimmed ? 0.5 : 1,
|
|
86
|
+
}, children: _jsx("span", { style: {
|
|
87
|
+
height: '10px',
|
|
88
|
+
width: '10px',
|
|
89
|
+
backgroundColor: 'black',
|
|
90
|
+
} }) }));
|
|
91
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TypographyProps } from '@mui/material';
|
|
2
|
+
export type PresentationElementSize = 'small-dimmed' | 'small' | 'small-bold' | 'medium' | 'medium-bold' | 'large-bold';
|
|
3
|
+
export type PresentationSymbol = 'circle' | 'rectangle' | 'border-circle' | 'border-rectangle';
|
|
4
|
+
interface PresentationSymbolProps {
|
|
5
|
+
symbol?: PresentationSymbol;
|
|
6
|
+
color?: string;
|
|
7
|
+
isDimmed?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface PresentationTypographyProps extends TypographyProps {
|
|
10
|
+
size?: PresentationElementSize;
|
|
11
|
+
}
|
|
12
|
+
export type { PresentationSymbolProps, PresentationTypographyProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunit/oui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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)"
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"terser-webpack-plugin": "^5.2.5",
|
|
78
78
|
"tinycolor2": "^1.6.0",
|
|
79
79
|
"typescript": "^4.9.5",
|
|
80
|
+
"victory": "^37.3.6",
|
|
80
81
|
"web-vitals": "^2.1.4",
|
|
81
82
|
"webpack": "^5.64.4",
|
|
82
83
|
"webpack-dev-server": "^4.6.0",
|
|
@@ -196,6 +197,7 @@
|
|
|
196
197
|
"storybook": "^7.6.6",
|
|
197
198
|
"ts-loader": "^9.5.1",
|
|
198
199
|
"typescript-eslint": "^8.18.1",
|
|
200
|
+
"uuid": "^11.1.0",
|
|
199
201
|
"webpack-cli": "^5.1.4",
|
|
200
202
|
"webpack-node-externals": "^3.0.0"
|
|
201
203
|
},
|