@lunit/oui 1.2.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.
Files changed (134) hide show
  1. package/dist/assets/ic-bell-noti-outlined-20px.js +1 -1
  2. package/dist/assets/ic-close-large-outlined-20px.js +1 -1
  3. package/dist/assets/ic-close-small-outlined-20px.js +1 -1
  4. package/dist/assets/ic-copy-coordinates-outlined-20px.d.ts +3 -0
  5. package/dist/assets/ic-copy-coordinates-outlined-20px.js +3 -0
  6. package/dist/assets/ic-download-pdf-outlined-20px.js +1 -1
  7. package/dist/assets/ic-ellipse-outlined-20px.js +1 -1
  8. package/dist/assets/ic-filter-noti-outlined-20px.js +1 -1
  9. package/dist/assets/ic-hide-large-outlined-20px.js +1 -1
  10. package/dist/assets/ic-hide-small-outlined-20px.js +1 -1
  11. package/dist/assets/ic-information-large-outlined-20px.js +1 -1
  12. package/dist/assets/ic-information-small-outlined-20px.js +1 -1
  13. package/dist/assets/ic-manufacturer-outlined-20px.js +1 -1
  14. package/dist/assets/ic-rectangle-outlined-20px.js +1 -1
  15. package/dist/assets/ic-refresh-left-outlined-20px.js +1 -1
  16. package/dist/assets/ic-refresh-right-outlined-20px.js +1 -1
  17. package/dist/assets/ic-show-large-outlined-20px.js +1 -1
  18. package/dist/assets/ic-show-small-outlined-20px.js +1 -1
  19. package/dist/assets/index.d.ts +1 -0
  20. package/dist/assets/index.js +1 -0
  21. package/dist/components/Alert/Alert.utils.js +3 -3
  22. package/dist/components/Chip/Chip.utils.js +3 -3
  23. package/dist/components/TextField/TextArea.types.d.ts +2 -1
  24. package/dist/components/TextField/TextInput.js +5 -1
  25. package/dist/components/TextField/TextInput.styled.js +2 -1
  26. package/dist/components/TextField/TextInput.types.d.ts +6 -2
  27. package/dist/components/TextField/TextInput.utils.d.ts +3 -3
  28. package/dist/components/TextField/TextInput.utils.js +4 -2
  29. package/dist/components/TextField/components/Buttons.d.ts +7 -1
  30. package/dist/components/TextField/components/Buttons.js +15 -1
  31. package/dist/components/TextField/components/FileInput.d.ts +4 -0
  32. package/dist/components/TextField/components/FileInput.js +21 -0
  33. package/dist/components/Toggle/Toggle.d.ts +3 -0
  34. package/dist/components/Toggle/Toggle.js +16 -0
  35. package/dist/components/Toggle/Toggle.styled.d.ts +7 -0
  36. package/dist/components/Toggle/Toggle.styled.js +90 -0
  37. package/dist/components/Toggle/Toggle.types.d.ts +18 -0
  38. package/dist/components/Toggle/Toggle.types.js +1 -0
  39. package/dist/components/Toggle/index.d.ts +4 -0
  40. package/dist/components/Toggle/index.js +2 -0
  41. package/dist/components/UploadManager/UploadManager.js +2 -2
  42. package/dist/components/index.d.ts +1 -0
  43. package/dist/components/index.js +1 -0
  44. package/dist/icons/CopyCoordinates/index.d.ts +12 -0
  45. package/dist/icons/CopyCoordinates/index.js +13 -0
  46. package/dist/icons/index.d.ts +3 -1
  47. package/dist/icons/index.js +3 -1
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.js +1 -0
  50. package/dist/presentations/Accordion/Accordion.d.ts +3 -0
  51. package/dist/presentations/Accordion/Accordion.js +21 -0
  52. package/dist/presentations/Accordion/Accordion.styled.d.ts +22 -0
  53. package/dist/presentations/Accordion/Accordion.styled.js +39 -0
  54. package/dist/presentations/Accordion/Accordion.types.d.ts +22 -0
  55. package/dist/presentations/Accordion/Accordion.types.js +1 -0
  56. package/dist/presentations/Accordion/index.d.ts +2 -0
  57. package/dist/presentations/Accordion/index.js +2 -0
  58. package/dist/presentations/AnalysisBar/AnalysisBar.d.ts +3 -0
  59. package/dist/presentations/AnalysisBar/AnalysisBar.js +26 -0
  60. package/dist/presentations/AnalysisBar/AnalysisBar.styled.d.ts +31 -0
  61. package/dist/presentations/AnalysisBar/AnalysisBar.styled.js +103 -0
  62. package/dist/presentations/AnalysisBar/AnalysisBar.types.d.ts +11 -0
  63. package/dist/presentations/AnalysisBar/AnalysisBar.types.js +1 -0
  64. package/dist/presentations/AnalysisBar/AnalysisBar.utils.d.ts +5 -0
  65. package/dist/presentations/AnalysisBar/AnalysisBar.utils.js +34 -0
  66. package/dist/presentations/AnalysisBar/HeatmapGraphIcon/HeatmapGraphSVG.d.ts +3 -0
  67. package/dist/presentations/AnalysisBar/HeatmapGraphIcon/HeatmapGraphSVG.js +3 -0
  68. package/dist/presentations/AnalysisBar/HeatmapGraphIcon/index.d.ts +7 -0
  69. package/dist/presentations/AnalysisBar/HeatmapGraphIcon/index.js +8 -0
  70. package/dist/presentations/AnalysisBar/index.d.ts +4 -0
  71. package/dist/presentations/AnalysisBar/index.js +2 -0
  72. package/dist/presentations/FreeText/FreeText.d.ts +3 -0
  73. package/dist/presentations/FreeText/FreeText.js +27 -0
  74. package/dist/presentations/FreeText/FreeText.types.d.ts +9 -0
  75. package/dist/presentations/FreeText/FreeText.types.js +1 -0
  76. package/dist/presentations/FreeText/index.d.ts +4 -0
  77. package/dist/presentations/FreeText/index.js +2 -0
  78. package/dist/presentations/Histogram/Histogram.d.ts +3 -0
  79. package/dist/presentations/Histogram/Histogram.js +15 -0
  80. package/dist/presentations/Histogram/Histogram.styled.d.ts +23 -0
  81. package/dist/presentations/Histogram/Histogram.styled.js +47 -0
  82. package/dist/presentations/Histogram/Histogram.types.d.ts +27 -0
  83. package/dist/presentations/Histogram/Histogram.types.js +1 -0
  84. package/dist/presentations/Histogram/Histogram.utils.d.ts +23 -0
  85. package/dist/presentations/Histogram/Histogram.utils.js +45 -0
  86. package/dist/presentations/Histogram/HistogramCharts.d.ts +3 -0
  87. package/dist/presentations/Histogram/HistogramCharts.js +20 -0
  88. package/dist/presentations/Histogram/HistogramTabs.d.ts +3 -0
  89. package/dist/presentations/Histogram/HistogramTabs.js +27 -0
  90. package/dist/presentations/Histogram/index.d.ts +4 -0
  91. package/dist/presentations/Histogram/index.js +2 -0
  92. package/dist/presentations/HorizonDivider/HorizonDivider.d.ts +3 -0
  93. package/dist/presentations/HorizonDivider/HorizonDivider.js +6 -0
  94. package/dist/presentations/HorizonDivider/HorizonDivider.types.d.ts +4 -0
  95. package/dist/presentations/HorizonDivider/HorizonDivider.types.js +1 -0
  96. package/dist/presentations/HorizonDivider/index.d.ts +4 -0
  97. package/dist/presentations/HorizonDivider/index.js +2 -0
  98. package/dist/presentations/Score/Score.d.ts +3 -0
  99. package/dist/presentations/Score/Score.js +9 -0
  100. package/dist/presentations/Score/Score.types.d.ts +13 -0
  101. package/dist/presentations/Score/Score.types.js +1 -0
  102. package/dist/presentations/Score/index.d.ts +4 -0
  103. package/dist/presentations/Score/index.js +2 -0
  104. package/dist/presentations/Statistic/Statistic.d.ts +3 -0
  105. package/dist/presentations/Statistic/Statistic.js +12 -0
  106. package/dist/presentations/Statistic/Statistic.styled.d.ts +11 -0
  107. package/dist/presentations/Statistic/Statistic.styled.js +17 -0
  108. package/dist/presentations/Statistic/Statistic.types.d.ts +11 -0
  109. package/dist/presentations/Statistic/Statistic.types.js +1 -0
  110. package/dist/presentations/Statistic/index.d.ts +4 -0
  111. package/dist/presentations/Statistic/index.js +2 -0
  112. package/dist/presentations/ToggleControl/ToggleControl.d.ts +3 -0
  113. package/dist/presentations/ToggleControl/ToggleControl.js +22 -0
  114. package/dist/presentations/ToggleControl/ToggleControl.styled.d.ts +15 -0
  115. package/dist/presentations/ToggleControl/ToggleControl.styled.js +27 -0
  116. package/dist/presentations/ToggleControl/ToggleControl.types.d.ts +21 -0
  117. package/dist/presentations/ToggleControl/ToggleControl.types.js +1 -0
  118. package/dist/presentations/ToggleControl/index.d.ts +4 -0
  119. package/dist/presentations/ToggleControl/index.js +2 -0
  120. package/dist/presentations/ToggleControlGroup/ToggleControlGroup.d.ts +3 -0
  121. package/dist/presentations/ToggleControlGroup/ToggleControlGroup.js +32 -0
  122. package/dist/presentations/ToggleControlGroup/ToggleControlGroup.styled.d.ts +4 -0
  123. package/dist/presentations/ToggleControlGroup/ToggleControlGroup.styled.js +9 -0
  124. package/dist/presentations/ToggleControlGroup/ToggleControlGroup.types.d.ts +21 -0
  125. package/dist/presentations/ToggleControlGroup/ToggleControlGroup.types.js +1 -0
  126. package/dist/presentations/ToggleControlGroup/index.d.ts +2 -0
  127. package/dist/presentations/ToggleControlGroup/index.js +2 -0
  128. package/dist/presentations/index.d.ts +9 -0
  129. package/dist/presentations/index.js +9 -0
  130. package/dist/presentations/presentations.styled.d.ts +3 -0
  131. package/dist/presentations/presentations.styled.js +91 -0
  132. package/dist/presentations/presentations.types.d.ts +12 -0
  133. package/dist/presentations/presentations.types.js +1 -0
  134. package/package.json +7 -3
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { VictoryStructuredData } from './Histogram.types';
2
+ /**
3
+ * Creates an array of data points for the histogram chart.
4
+ *
5
+ * @param sourceData - The source data array.
6
+ * @returns An array of data points for the histogram chart.
7
+ */
8
+ export declare function makeHistoDataArray(sourceData: number[]): VictoryStructuredData;
9
+ /**
10
+ * Returns the border radius for a tab button based on its index and the total number of tabs.
11
+ *
12
+ * @param idx - The index of the tab button.
13
+ * @param max - The total number of tab buttons.
14
+ * @returns The border radius for the tab button.
15
+ */
16
+ export declare function doBorderRadius(idx: number, max: number): string;
17
+ /**
18
+ * Calculates the font size for a tab button based on its label.
19
+ *
20
+ * @param text - The label of the tab button.
21
+ * @returns The font size for the tab button.
22
+ */
23
+ export declare const calculateFontSize: (text: string) => number;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Creates an array of data points for the histogram chart.
3
+ *
4
+ * @param sourceData - The source data array.
5
+ * @returns An array of data points for the histogram chart.
6
+ */
7
+ export function makeHistoDataArray(sourceData) {
8
+ const cappedData = sourceData.slice(0, 10);
9
+ return cappedData.map((d, i) => ({
10
+ x: i * 10,
11
+ y: d,
12
+ }));
13
+ }
14
+ /**
15
+ * Returns the border radius for a tab button based on its index and the total number of tabs.
16
+ *
17
+ * @param idx - The index of the tab button.
18
+ * @param max - The total number of tab buttons.
19
+ * @returns The border radius for the tab button.
20
+ */
21
+ export function doBorderRadius(idx, max) {
22
+ const BORDER_RADIUS = '6px';
23
+ const borderRadiusMap = {
24
+ 0: `${BORDER_RADIUS} 0 0 0`,
25
+ 1: `0 ${BORDER_RADIUS} 0 0`,
26
+ [max - 2]: `0 0 0 ${BORDER_RADIUS}`,
27
+ [max - 1]: `0 0 ${BORDER_RADIUS} 0`,
28
+ };
29
+ return borderRadiusMap[idx] || '0';
30
+ }
31
+ /**
32
+ * Calculates the font size for a tab button based on its label.
33
+ *
34
+ * @param text - The label of the tab button.
35
+ * @returns The font size for the tab button.
36
+ */
37
+ export const calculateFontSize = (text) => {
38
+ if (text.length <= 9)
39
+ return 14;
40
+ if (text.length <= 12)
41
+ return 12;
42
+ if (text.length <= 15)
43
+ return 11;
44
+ return 9;
45
+ };
@@ -0,0 +1,3 @@
1
+ import type { HistogramChartProps } from './Histogram.types';
2
+ declare const HistogramChart: ({ dataset, xAxisLabels, yAxisLabels }: HistogramChartProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default HistogramChart;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { VictoryAxis, VictoryBar, VictoryChart, VictoryLabel } from 'victory';
3
+ import theme from '../../theme';
4
+ import { makeHistoDataArray } from './Histogram.utils';
5
+ const HistogramChart = ({ dataset, xAxisLabels, yAxisLabels }) => {
6
+ const dataArray = dataset.data;
7
+ return (_jsxs(VictoryChart, { height: 400, width: 470, domain: { x: [0, 100], y: [0, 100] }, children: [_jsx(VictoryAxis, { crossAxis: true, tickValues: xAxisLabels, style: {
8
+ tickLabels: { fill: theme.palette.neutralGrey[0], fontSize: '20px' },
9
+ ticks: { stroke: theme.palette.neutralGrey[50], opacity: 0.5 },
10
+ } }), _jsx(VictoryAxis, { orientation: "right", dependentAxis: true, tickFormat: (t) => (t === 0 ? ' (%)' : `${t}`), tickValues: yAxisLabels, style: {
11
+ tickLabels: {
12
+ fill: theme.palette.neutralGrey[0],
13
+ fontSize: '20px',
14
+ },
15
+ grid: { stroke: theme.palette.neutralGrey[50], strokeDasharray: '10, 5', opacity: 0.5 },
16
+ }, tickLabelComponent: _jsx(VictoryLabel, { dx: 10 }) }), _jsx(VictoryBar, { data: makeHistoDataArray(dataArray), style: {
17
+ data: { fill: theme.palette.lunitTeal[40], width: 34 },
18
+ }, alignment: "start", cornerRadius: { topLeft: 6, topRight: 6 } })] }));
19
+ };
20
+ export default HistogramChart;
@@ -0,0 +1,3 @@
1
+ import type { HistogramTabsProps } from './Histogram.types';
2
+ declare const HistogramTabs: ({ options, active, onChange }: HistogramTabsProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default HistogramTabs;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Typography } from '@mui/material';
3
+ import { calculateFontSize, doBorderRadius } from './Histogram.utils';
4
+ import { HistogramTabsContainer, TabButton } from './Histogram.styled';
5
+ const HistogramTabs = ({ options, active, onChange }) => {
6
+ return (_jsx(HistogramTabsContainer, { children: options.map((tabLabel, idx) => {
7
+ const fontSize = calculateFontSize(tabLabel);
8
+ const commonButtonProps = {
9
+ key: tabLabel,
10
+ disableRipple: true,
11
+ active: idx === active,
12
+ onClick: () => onChange(idx),
13
+ sx: {
14
+ padding: '4px 6px',
15
+ borderRadius: doBorderRadius(idx, options.length),
16
+ },
17
+ };
18
+ return (_jsx(TabButton, { ...commonButtonProps, children: _jsx(Typography, { variant: "body_sb1", sx: {
19
+ fontSize: `${fontSize}px`,
20
+ whiteSpace: 'nowrap',
21
+ overflow: 'hidden',
22
+ textOverflow: 'ellipsis',
23
+ width: '100%',
24
+ }, children: tabLabel }) }));
25
+ }) }));
26
+ };
27
+ export default HistogramTabs;
@@ -0,0 +1,4 @@
1
+ import Histogram from './Histogram';
2
+ import type { HistogramProps } from './Histogram.types';
3
+ export { Histogram };
4
+ export type { HistogramProps };
@@ -0,0 +1,2 @@
1
+ import Histogram from './Histogram';
2
+ export { Histogram };
@@ -0,0 +1,3 @@
1
+ import type { HorizonDividerProps } from './HorizonDivider.types';
2
+ declare const HorizonDivider: ({ componentType }: HorizonDividerProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default HorizonDivider;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Divider } from '../../components';
3
+ const HorizonDivider = ({ componentType = 'divider' }) => {
4
+ return _jsx(Divider, { orientation: "horizontal" });
5
+ };
6
+ export default HorizonDivider;
@@ -0,0 +1,4 @@
1
+ interface HorizonDividerProps {
2
+ componentType: 'divider';
3
+ }
4
+ export type { HorizonDividerProps };
@@ -0,0 +1,4 @@
1
+ import HorizonDivider from './HorizonDivider';
2
+ import type { HorizonDividerProps } from './HorizonDivider.types';
3
+ export { HorizonDivider };
4
+ export type { HorizonDividerProps };
@@ -0,0 +1,2 @@
1
+ import HorizonDivider from './HorizonDivider';
2
+ export { HorizonDivider };
@@ -0,0 +1,3 @@
1
+ import { ScoreProps } from './Score.types';
2
+ declare const Score: ({ componentType, title, size, metrics }: ScoreProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default Score;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PresentationTypography } from '../presentations.styled';
3
+ const capitalize = (str) => {
4
+ return str.charAt(0).toUpperCase() + str.slice(1);
5
+ };
6
+ const Score = ({ componentType = 'score', title, size = 'medium', metrics }) => {
7
+ return (_jsxs(PresentationTypography, { size: size, style: { color: metrics.isFullColored ? metrics.color : 'inherit' }, children: [title, ": ", metrics.value, metrics.scoreType && (_jsx("span", { style: { color: metrics.color, marginLeft: 4 }, children: capitalize(metrics.scoreType) }))] }));
8
+ };
9
+ export default Score;
@@ -0,0 +1,13 @@
1
+ import { PresentationElementSize } from '../presentations.types';
2
+ interface ScoreProps {
3
+ componentType: 'score';
4
+ title: string;
5
+ size?: PresentationElementSize;
6
+ metrics: {
7
+ value: string;
8
+ scoreType?: 'positive' | 'negative';
9
+ color?: string;
10
+ isFullColored?: boolean;
11
+ };
12
+ }
13
+ export type { ScoreProps };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import Score from './Score';
2
+ import { ScoreProps } from './Score.types';
3
+ export { Score };
4
+ export type { ScoreProps };
@@ -0,0 +1,2 @@
1
+ import Score from './Score';
2
+ export { Score };
@@ -0,0 +1,3 @@
1
+ import { StatisticProps } from './Statistic.types';
2
+ declare const Statistic: ({ componentType, title, layout, metrics, size, symbol, color, ...rest }: StatisticProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default Statistic;
@@ -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,4 @@
1
+ import Statistic from './Statistic';
2
+ import type { StatisticProps } from './Statistic.types';
3
+ export { Statistic };
4
+ export type { StatisticProps };
@@ -0,0 +1,2 @@
1
+ import Statistic from './Statistic';
2
+ export { Statistic };
@@ -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,4 @@
1
+ import ToggleControl from './ToggleControl';
2
+ import type { ToggleControlProps, ToggleControlSpec } from './ToggleControl.types';
3
+ export { ToggleControl };
4
+ export type { ToggleControlProps, ToggleControlSpec };
@@ -0,0 +1,2 @@
1
+ import ToggleControl from './ToggleControl';
2
+ export { ToggleControl };
@@ -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,9 @@
1
+ import { Box, styled } from '@mui/material';
2
+ export const ToggleControlGroupContainer = styled(Box)(() => {
3
+ return {
4
+ display: 'flex',
5
+ flexDirection: 'column',
6
+ alignItems: 'flex-start',
7
+ gap: '8px',
8
+ };
9
+ });
@@ -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,2 @@
1
+ import ToggleControlGroup from './ToggleControlGroup';
2
+ export { ToggleControlGroup };
@@ -0,0 +1,2 @@
1
+ import ToggleControlGroup from './ToggleControlGroup';
2
+ export { 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,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
+ };