@ultraviolet/ui 1.28.0 → 1.29.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/README.md +14 -7
- package/dist/index.d.ts +51 -2
- package/dist/src/components/ActionBar/index.js +22 -37
- package/dist/src/components/Alert/index.js +27 -41
- package/dist/src/components/Avatar/index.js +48 -69
- package/dist/src/components/Badge/index.js +29 -49
- package/dist/src/components/Banner/index.js +42 -62
- package/dist/src/components/BarChart/Tooltip.js +35 -50
- package/dist/src/components/BarChart/index.js +13 -14
- package/dist/src/components/BarStack/index.js +100 -191
- package/dist/src/components/Breadcrumbs/index.js +29 -39
- package/dist/src/components/Bullet/index.js +42 -55
- package/dist/src/components/Button/index.js +73 -99
- package/dist/src/components/Card/index.js +39 -57
- package/dist/src/components/Carousel/index.js +32 -60
- package/dist/src/components/Checkbox/index.js +153 -341
- package/dist/src/components/CheckboxGroup/index.js +25 -27
- package/dist/src/components/CopyButton/index.js +11 -12
- package/dist/src/components/DateInput/index.js +141 -268
- package/dist/src/components/EmptyState/index.js +68 -83
- package/dist/src/components/Expandable/index.js +13 -20
- package/dist/src/components/GlobalAlert/GlobalAlertLink.js +12 -13
- package/dist/src/components/GlobalAlert/index.js +19 -32
- package/dist/src/components/LineChart/CustomLegend.js +80 -89
- package/dist/src/components/LineChart/Tooltip.js +32 -47
- package/dist/src/components/LineChart/helpers.js +15 -50
- package/dist/src/components/LineChart/index.js +23 -33
- package/dist/src/components/Link/index.js +46 -65
- package/dist/src/components/List/Body.js +9 -15
- package/dist/src/components/List/Cell.js +6 -7
- package/dist/src/components/List/HeaderCell.js +28 -56
- package/dist/src/components/List/HeaderRow.js +9 -16
- package/dist/src/components/List/ListContext.js +5 -6
- package/dist/src/components/List/Row.js +44 -90
- package/dist/src/components/List/SelectBar.js +9 -13
- package/dist/src/components/List/SkeletonRows.js +5 -6
- package/dist/src/components/List/index.js +15 -25
- package/dist/src/components/Loader/index.js +18 -25
- package/dist/src/components/Menu/Item.js +39 -49
- package/dist/src/components/Menu/index.js +31 -56
- package/dist/src/components/MenuV2/Item.js +39 -49
- package/dist/src/components/MenuV2/index.js +28 -47
- package/dist/src/components/Meter/index.js +25 -47
- package/dist/src/components/Modal/Dialog.js +33 -58
- package/dist/src/components/Modal/Disclosure.js +8 -9
- package/dist/src/components/Modal/index.js +26 -33
- package/dist/src/components/Notice/index.js +21 -27
- package/dist/src/components/NumberInput/index.js +73 -137
- package/dist/src/components/Pagination/getPageNumbers.js +1 -4
- package/dist/src/components/Pagination/index.js +17 -27
- package/dist/src/components/PasswordCheck/index.js +26 -32
- package/dist/src/components/PasswordStrengthMeter/index.js +25 -44
- package/dist/src/components/PieChart/Legends.js +71 -107
- package/dist/src/components/PieChart/Tooltip.js +33 -36
- package/dist/src/components/PieChart/index.js +13 -17
- package/dist/src/components/Popover/index.js +58 -75
- package/dist/src/components/Popup/helpers.js +13 -15
- package/dist/src/components/Popup/index.js +55 -98
- package/dist/src/components/ProgressBar/index.js +31 -49
- package/dist/src/components/Radio/index.js +58 -113
- package/dist/src/components/RadioGroup/index.js +26 -28
- package/dist/src/components/Row/index.js +25 -31
- package/dist/src/components/SelectInput/index.js +357 -410
- package/dist/src/components/SelectableCard/index.js +73 -115
- package/dist/src/components/Separator/index.js +52 -73
- package/dist/src/components/Skeleton/Block.js +23 -41
- package/dist/src/components/Skeleton/Blocks.js +23 -41
- package/dist/src/components/Skeleton/BoxWithIcon.js +21 -36
- package/dist/src/components/Skeleton/Donut.js +3 -6
- package/dist/src/components/Skeleton/IconSkeleton.js +13 -31
- package/dist/src/components/Skeleton/Line.js +5 -11
- package/dist/src/components/Skeleton/List.js +22 -31
- package/dist/src/components/Skeleton/Slider.js +25 -46
- package/dist/src/components/Skeleton/Square.js +3 -6
- package/dist/src/components/Skeleton/index.js +17 -33
- package/dist/src/components/Snippet/index.js +82 -137
- package/dist/src/components/Stack/index.js +11 -14
- package/dist/src/components/Status/index.js +48 -78
- package/dist/src/components/StepList/index.js +45 -63
- package/dist/src/components/Stepper/index.js +74 -129
- package/dist/src/components/SwitchButton/FocusOverlay.js +13 -23
- package/dist/src/components/SwitchButton/index.js +36 -62
- package/dist/src/components/Table/Body.js +5 -8
- package/dist/src/components/Table/Cell.js +14 -20
- package/dist/src/components/Table/Header.js +8 -14
- package/dist/src/components/Table/HeaderCell.js +40 -56
- package/dist/src/components/Table/HeaderRow.js +4 -5
- package/dist/src/components/Table/Row.js +10 -14
- package/dist/src/components/Table/SelectBar.js +9 -13
- package/dist/src/components/Table/SkeletonRows.js +5 -6
- package/dist/src/components/Table/TableContext.js +6 -7
- package/dist/src/components/Table/index.js +44 -50
- package/dist/src/components/Tabs/Tab.js +57 -118
- package/dist/src/components/Tabs/TabMenu.js +32 -38
- package/dist/src/components/Tabs/TabMenuItem.js +9 -13
- package/dist/src/components/Tabs/index.js +24 -43
- package/dist/src/components/Tag/index.js +57 -74
- package/dist/src/components/TagInput/index.js +63 -94
- package/dist/src/components/TagList/index.js +22 -35
- package/dist/src/components/Text/index.js +29 -31
- package/dist/src/components/TextArea/index.js +240 -0
- package/dist/src/components/TextInput/index.js +166 -260
- package/dist/src/components/TimeInput/index.js +10 -13
- package/dist/src/components/Toaster/index.js +51 -67
- package/dist/src/components/Toggle/index.js +62 -129
- package/dist/src/components/ToggleGroup/index.js +21 -23
- package/dist/src/components/Tooltip/index.js +28 -31
- package/dist/src/components/VerificationCode/index.js +55 -90
- package/dist/src/index.js +1 -0
- package/dist/src/utils/ids.js +1 -6
- package/package.json +3 -3
|
@@ -2,19 +2,18 @@ import { useTheme } from '@emotion/react';
|
|
|
2
2
|
import { Link } from '../Link/index.js';
|
|
3
3
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
4
4
|
|
|
5
|
-
const GlobalAlertLink =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} = _ref;
|
|
5
|
+
const GlobalAlertLink = ({
|
|
6
|
+
children,
|
|
7
|
+
href,
|
|
8
|
+
target,
|
|
9
|
+
download,
|
|
10
|
+
rel,
|
|
11
|
+
className,
|
|
12
|
+
onClick,
|
|
13
|
+
'aria-label': ariaLabel,
|
|
14
|
+
oneLine = false,
|
|
15
|
+
'data-testid': dataTestId
|
|
16
|
+
}) => {
|
|
18
17
|
const {
|
|
19
18
|
theme
|
|
20
19
|
} = useTheme();
|
|
@@ -12,42 +12,29 @@ const CloseButton = /*#__PURE__*/_styled(Button, {
|
|
|
12
12
|
})("background:none;position:absolute;right:", SIZE_HEIGHT.xsmall, "px;&:hover,&:focus,&:active{background:none;}");
|
|
13
13
|
const Container = /*#__PURE__*/_styled(Stack, {
|
|
14
14
|
target: "ewvyccp0"
|
|
15
|
-
})("width:100%;height:56px;padding:0 ",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return theme.colors.info.backgroundStrong;
|
|
25
|
-
}, ";}&[data-variant='danger']{background-color:", _ref3 => {
|
|
26
|
-
let {
|
|
27
|
-
theme
|
|
28
|
-
} = _ref3;
|
|
29
|
-
return theme.colors.danger.backgroundStrong;
|
|
30
|
-
}, ";}&[data-variant='promotional']{background:", _ref4 => {
|
|
31
|
-
let {
|
|
32
|
-
theme
|
|
33
|
-
} = _ref4;
|
|
34
|
-
return theme.colors.other.gradients.background.aqua;
|
|
35
|
-
}, ";}");
|
|
15
|
+
})("width:100%;height:56px;padding:0 ", ({
|
|
16
|
+
theme
|
|
17
|
+
}) => theme.space['2'], ";&[data-variant='info']{background-color:", ({
|
|
18
|
+
theme
|
|
19
|
+
}) => theme.colors.info.backgroundStrong, ";}&[data-variant='danger']{background-color:", ({
|
|
20
|
+
theme
|
|
21
|
+
}) => theme.colors.danger.backgroundStrong, ";}&[data-variant='promotional']{background:", ({
|
|
22
|
+
theme
|
|
23
|
+
}) => theme.colors.other.gradients.background.aqua, ";}");
|
|
36
24
|
/**
|
|
37
25
|
* GlobalAlert is a component that is used to display a global alert message.
|
|
38
26
|
* It has its own internal state and can be closed by clicking on the close button.
|
|
39
27
|
*/
|
|
40
|
-
const GlobalAlert =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} = _ref5;
|
|
28
|
+
const GlobalAlert = ({
|
|
29
|
+
children,
|
|
30
|
+
variant = 'info',
|
|
31
|
+
onClose,
|
|
32
|
+
closable = true,
|
|
33
|
+
buttonText,
|
|
34
|
+
onClickButton,
|
|
35
|
+
className,
|
|
36
|
+
'data-testid': dataTestId
|
|
37
|
+
}) => {
|
|
51
38
|
const {
|
|
52
39
|
theme
|
|
53
40
|
} = useTheme();
|
|
@@ -30,18 +30,15 @@ const StyledText = /*#__PURE__*/_styled(Text, {
|
|
|
30
30
|
styles: "text-align:right;flex:1;min-width:72px;align-self:center",
|
|
31
31
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
32
32
|
});
|
|
33
|
-
const Cell =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
children: value
|
|
43
|
-
});
|
|
44
|
-
};
|
|
33
|
+
const Cell = ({
|
|
34
|
+
value,
|
|
35
|
+
variant
|
|
36
|
+
}) => jsx(StyledText, {
|
|
37
|
+
variant: variant,
|
|
38
|
+
color: "neutral",
|
|
39
|
+
as: "span",
|
|
40
|
+
children: value
|
|
41
|
+
});
|
|
45
42
|
const CellValueContainer = /*#__PURE__*/_styled("div", {
|
|
46
43
|
target: "erndk5t2"
|
|
47
44
|
})(process.env.NODE_ENV === "production" ? {
|
|
@@ -65,83 +62,77 @@ const LongContainer = /*#__PURE__*/_styled("div", {
|
|
|
65
62
|
const noop = value => value.toString();
|
|
66
63
|
const StyledContainer = /*#__PURE__*/_styled("div", {
|
|
67
64
|
target: "erndk5t0"
|
|
68
|
-
})("margin-top:",
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
variant: "body",
|
|
98
|
-
value: "Average"
|
|
99
|
-
}), jsx(Cell, {
|
|
100
|
-
variant: "body",
|
|
101
|
-
value: "Current"
|
|
102
|
-
})]
|
|
103
|
-
}), jsx("div", {
|
|
104
|
-
css: styles.body,
|
|
105
|
-
children: data?.map((row, index) => {
|
|
106
|
-
const values = row.data.map(val => val.y);
|
|
107
|
-
const labelIndexed = `${row.id}${index}`;
|
|
108
|
-
const id = row.id.toString();
|
|
109
|
-
return jsxs("div", {
|
|
110
|
-
css: styles.row,
|
|
111
|
-
children: [jsx(LongContainer, {
|
|
112
|
-
children: jsx(Checkbox, {
|
|
113
|
-
checked: selected.includes(labelIndexed),
|
|
114
|
-
name: id,
|
|
115
|
-
onChange: () => setSelected([...getSelected(id, index, selected)]),
|
|
116
|
-
children: jsxs(CellValueContainer, {
|
|
117
|
-
children: [jsx(Text, {
|
|
118
|
-
as: "span",
|
|
119
|
-
variant: "bodySmall",
|
|
120
|
-
sentiment: "neutral",
|
|
121
|
-
children: row?.['label']
|
|
122
|
-
}), jsx("div", {
|
|
123
|
-
"data-testid": `label-${id}`,
|
|
124
|
-
css: styles.legend(index)
|
|
125
|
-
})]
|
|
126
|
-
})
|
|
127
|
-
})
|
|
128
|
-
}), jsx(Cell, {
|
|
129
|
-
variant: "bodySmall",
|
|
130
|
-
value: axisTransformer(getMin(values))
|
|
131
|
-
}), jsx(Cell, {
|
|
132
|
-
variant: "bodySmall",
|
|
133
|
-
value: axisTransformer(getMax(values))
|
|
134
|
-
}), jsx(Cell, {
|
|
135
|
-
variant: "bodySmall",
|
|
136
|
-
value: axisTransformer(getAverage(values))
|
|
137
|
-
}), jsx(Cell, {
|
|
138
|
-
variant: "bodySmall",
|
|
139
|
-
value: axisTransformer(getCurrent(values))
|
|
140
|
-
})]
|
|
141
|
-
}, labelIndexed);
|
|
142
|
-
})
|
|
65
|
+
})("margin-top:", ({
|
|
66
|
+
theme
|
|
67
|
+
}) => theme.space[2], ";");
|
|
68
|
+
const CustomLegend = ({
|
|
69
|
+
axisTransformer = noop,
|
|
70
|
+
data,
|
|
71
|
+
selected,
|
|
72
|
+
setSelected,
|
|
73
|
+
className,
|
|
74
|
+
'data-testid': dataTestId
|
|
75
|
+
}) => jsxs(StyledContainer, {
|
|
76
|
+
className: className,
|
|
77
|
+
"data-testid": dataTestId,
|
|
78
|
+
children: [jsxs("div", {
|
|
79
|
+
css: styles.head,
|
|
80
|
+
children: [jsx(LongContainer, {
|
|
81
|
+
children: "Legend"
|
|
82
|
+
}), jsx(Cell, {
|
|
83
|
+
variant: "body",
|
|
84
|
+
value: "Minimum"
|
|
85
|
+
}), jsx(Cell, {
|
|
86
|
+
variant: "body",
|
|
87
|
+
value: "Maximum"
|
|
88
|
+
}), jsx(Cell, {
|
|
89
|
+
variant: "body",
|
|
90
|
+
value: "Average"
|
|
91
|
+
}), jsx(Cell, {
|
|
92
|
+
variant: "body",
|
|
93
|
+
value: "Current"
|
|
143
94
|
})]
|
|
144
|
-
})
|
|
145
|
-
|
|
95
|
+
}), jsx("div", {
|
|
96
|
+
css: styles.body,
|
|
97
|
+
children: data?.map((row, index) => {
|
|
98
|
+
const values = row.data.map(val => val.y);
|
|
99
|
+
const labelIndexed = `${row.id}${index}`;
|
|
100
|
+
const id = row.id.toString();
|
|
101
|
+
return jsxs("div", {
|
|
102
|
+
css: styles.row,
|
|
103
|
+
children: [jsx(LongContainer, {
|
|
104
|
+
children: jsx(Checkbox, {
|
|
105
|
+
checked: selected.includes(labelIndexed),
|
|
106
|
+
name: id,
|
|
107
|
+
onChange: () => setSelected([...getSelected(id, index, selected)]),
|
|
108
|
+
children: jsxs(CellValueContainer, {
|
|
109
|
+
children: [jsx(Text, {
|
|
110
|
+
as: "span",
|
|
111
|
+
variant: "bodySmall",
|
|
112
|
+
sentiment: "neutral",
|
|
113
|
+
children: row?.['label']
|
|
114
|
+
}), jsx("div", {
|
|
115
|
+
"data-testid": `label-${id}`,
|
|
116
|
+
css: styles.legend(index)
|
|
117
|
+
})]
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
}), jsx(Cell, {
|
|
121
|
+
variant: "bodySmall",
|
|
122
|
+
value: axisTransformer(getMin(values))
|
|
123
|
+
}), jsx(Cell, {
|
|
124
|
+
variant: "bodySmall",
|
|
125
|
+
value: axisTransformer(getMax(values))
|
|
126
|
+
}), jsx(Cell, {
|
|
127
|
+
variant: "bodySmall",
|
|
128
|
+
value: axisTransformer(getAverage(values))
|
|
129
|
+
}), jsx(Cell, {
|
|
130
|
+
variant: "bodySmall",
|
|
131
|
+
value: axisTransformer(getCurrent(values))
|
|
132
|
+
})]
|
|
133
|
+
}, labelIndexed);
|
|
134
|
+
})
|
|
135
|
+
})]
|
|
136
|
+
});
|
|
146
137
|
|
|
147
138
|
export { CustomLegend };
|
|
@@ -4,55 +4,40 @@ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
|
4
4
|
|
|
5
5
|
const LineTooltipContainer = /*#__PURE__*/_styled("div", {
|
|
6
6
|
target: "e11niu3b1"
|
|
7
|
-
})("display:flex;background:",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
theme
|
|
15
|
-
} = _ref2;
|
|
16
|
-
return theme.radii.small;
|
|
17
|
-
}, ";box-shadow:", _ref3 => {
|
|
18
|
-
let {
|
|
19
|
-
theme
|
|
20
|
-
} = _ref3;
|
|
21
|
-
return theme.shadows.tooltip;
|
|
22
|
-
}, ";padding:5px 9px;align-items:center;");
|
|
7
|
+
})("display:flex;background:", ({
|
|
8
|
+
theme
|
|
9
|
+
}) => theme.colors.neutral.backgroundStronger, ";border-radius:", ({
|
|
10
|
+
theme
|
|
11
|
+
}) => theme.radii.small, ";box-shadow:", ({
|
|
12
|
+
theme
|
|
13
|
+
}) => theme.shadows.tooltip, ";padding:5px 9px;align-items:center;");
|
|
23
14
|
const LineColorSquare = /*#__PURE__*/_styled("span", {
|
|
24
15
|
target: "e11niu3b0"
|
|
25
|
-
})("display:block;width:12px;height:12px;background:",
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
children: [jsx(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
children:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
variant: "bodySmall",
|
|
49
|
-
sentiment: "neutral",
|
|
50
|
-
prominence: "stronger",
|
|
51
|
-
as: "div",
|
|
52
|
-
children: point.data.xFormatted
|
|
53
|
-
})]
|
|
16
|
+
})("display:block;width:12px;height:12px;background:", ({
|
|
17
|
+
color
|
|
18
|
+
}) => color, ";margin-right:12px;");
|
|
19
|
+
const LineChartTooltip = ({
|
|
20
|
+
point
|
|
21
|
+
}) => jsxs(LineTooltipContainer, {
|
|
22
|
+
children: [jsx("div", {
|
|
23
|
+
children: jsx(LineColorSquare, {
|
|
24
|
+
color: point.serieColor
|
|
25
|
+
})
|
|
26
|
+
}), jsxs("div", {
|
|
27
|
+
children: [jsx(Text, {
|
|
28
|
+
variant: "bodyStronger",
|
|
29
|
+
sentiment: "neutral",
|
|
30
|
+
prominence: "stronger",
|
|
31
|
+
as: "div",
|
|
32
|
+
children: point.data.yFormatted
|
|
33
|
+
}), jsx(Text, {
|
|
34
|
+
variant: "bodySmall",
|
|
35
|
+
sentiment: "neutral",
|
|
36
|
+
prominence: "stronger",
|
|
37
|
+
as: "div",
|
|
38
|
+
children: point.data.xFormatted
|
|
54
39
|
})]
|
|
55
|
-
})
|
|
56
|
-
};
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
57
42
|
|
|
58
43
|
export { LineChartTooltip };
|
|
@@ -4,64 +4,29 @@ const parse = data => {
|
|
|
4
4
|
if (data instanceof Date) return data.getTime();
|
|
5
5
|
return 0;
|
|
6
6
|
};
|
|
7
|
-
const getMin =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
return values.length ? Math.min(...values.map(parse)) : 0;
|
|
12
|
-
};
|
|
13
|
-
const getMax = function (values) {
|
|
14
|
-
if (values === void 0) {
|
|
15
|
-
values = [];
|
|
16
|
-
}
|
|
17
|
-
return values.length ? Math.max(...values.map(parse)) : 0;
|
|
18
|
-
};
|
|
19
|
-
const getAverage = function (values) {
|
|
20
|
-
if (values === void 0) {
|
|
21
|
-
values = [];
|
|
22
|
-
}
|
|
23
|
-
return values.length ? Math.round(values.reduce((sum, curr) => sum + parse(curr), 0) / values.length * 100) / 100 : 0;
|
|
24
|
-
};
|
|
7
|
+
const getMin = (values = []) => values.length ? Math.min(...values.map(parse)) : 0;
|
|
8
|
+
const getMax = (values = []) => values.length ? Math.max(...values.map(parse)) : 0;
|
|
9
|
+
const getAverage = (values = []) => values.length ? Math.round(values.reduce((sum, curr) => sum + parse(curr), 0) / values.length * 100) / 100 : 0;
|
|
25
10
|
const getMaxChartValue = preppedData => {
|
|
26
11
|
if (!preppedData?.length) return 0;
|
|
27
|
-
const maximum = Math.max(...preppedData.map(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
let {
|
|
33
|
-
y
|
|
34
|
-
} = _ref2;
|
|
35
|
-
return y || 0;
|
|
36
|
-
}));
|
|
37
|
-
}));
|
|
12
|
+
const maximum = Math.max(...preppedData.map(({
|
|
13
|
+
data
|
|
14
|
+
}) => getMax(data.map(({
|
|
15
|
+
y
|
|
16
|
+
}) => y || 0))));
|
|
38
17
|
return Math.ceil(maximum + maximum * 0.1);
|
|
39
18
|
};
|
|
40
19
|
const getMinChartValue = preppedData => {
|
|
41
20
|
if (!preppedData?.length) return 0;
|
|
42
|
-
const minimum = Math.min(...preppedData.map(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
let {
|
|
48
|
-
y
|
|
49
|
-
} = _ref4;
|
|
50
|
-
return y || 0;
|
|
51
|
-
}));
|
|
52
|
-
}));
|
|
21
|
+
const minimum = Math.min(...preppedData.map(({
|
|
22
|
+
data
|
|
23
|
+
}) => getMin(data.map(({
|
|
24
|
+
y
|
|
25
|
+
}) => y || 0))));
|
|
53
26
|
return Math.floor(minimum - minimum * 0.1);
|
|
54
27
|
};
|
|
55
|
-
const getCurrent =
|
|
56
|
-
|
|
57
|
-
values = [];
|
|
58
|
-
}
|
|
59
|
-
return values.length ? values[values.length - 1] : 0;
|
|
60
|
-
};
|
|
61
|
-
const getSelected = function (label, index, selected) {
|
|
62
|
-
if (selected === void 0) {
|
|
63
|
-
selected = [];
|
|
64
|
-
}
|
|
28
|
+
const getCurrent = (values = []) => values.length ? values[values.length - 1] : 0;
|
|
29
|
+
const getSelected = (label, index, selected = []) => {
|
|
65
30
|
const labelIndexed = label + index.toString();
|
|
66
31
|
const found = selected.indexOf(labelIndexed);
|
|
67
32
|
if (found > -1) {
|
|
@@ -30,21 +30,20 @@ const DEFAULT_CHARTPROPS = {};
|
|
|
30
30
|
* See https://nivo.rocks/line/ for more information.
|
|
31
31
|
* @experimental This component is experimental and may be subject to breaking changes in the future.
|
|
32
32
|
*/
|
|
33
|
-
const LineChart =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} = _ref;
|
|
33
|
+
const LineChart = ({
|
|
34
|
+
height = '537px',
|
|
35
|
+
// to maintain aspect ratio based on our standard 1074px width
|
|
36
|
+
margin = DEFAULT_MARGIN,
|
|
37
|
+
xScale = DEFAULT_XSCALE,
|
|
38
|
+
yScale = DEFAULT_YSCALE,
|
|
39
|
+
data,
|
|
40
|
+
withLegend = false,
|
|
41
|
+
axisFormatters,
|
|
42
|
+
pointFormatters,
|
|
43
|
+
tickValues,
|
|
44
|
+
chartProps = DEFAULT_CHARTPROPS,
|
|
45
|
+
'data-testid': dataTestId
|
|
46
|
+
}) => {
|
|
48
47
|
const theme = useTheme();
|
|
49
48
|
const dataset = {
|
|
50
49
|
datasets: data?.map(d => ({
|
|
@@ -66,28 +65,19 @@ const LineChart = _ref => {
|
|
|
66
65
|
fontSize: 12,
|
|
67
66
|
textColor: theme.colors.neutral.textWeak
|
|
68
67
|
};
|
|
69
|
-
const [selected, setSelected] = useState(dataset.datasets?.map((
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}));
|
|
75
|
-
const finalData = dataset.datasets?.filter((_ref3, index) => {
|
|
76
|
-
let {
|
|
77
|
-
id
|
|
78
|
-
} = _ref3;
|
|
79
|
-
return selected ? selected.includes(`${id}${index}`) : false;
|
|
80
|
-
});
|
|
68
|
+
const [selected, setSelected] = useState(dataset.datasets?.map(({
|
|
69
|
+
id
|
|
70
|
+
}, index) => `${id}${index}`));
|
|
71
|
+
const finalData = dataset.datasets?.filter(({
|
|
72
|
+
id
|
|
73
|
+
}, index) => selected ? selected.includes(`${id}${index}`) : false);
|
|
81
74
|
useEffect(() => {
|
|
82
75
|
if (selected !== undefined) {
|
|
83
76
|
return;
|
|
84
77
|
}
|
|
85
|
-
setSelected(dataset.datasets?.map((
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
} = _ref4;
|
|
89
|
-
return `${id}${index}`;
|
|
90
|
-
}));
|
|
78
|
+
setSelected(dataset.datasets?.map(({
|
|
79
|
+
id
|
|
80
|
+
}, index) => `${id}${index}`));
|
|
91
81
|
}, [dataset.datasets, selected]);
|
|
92
82
|
const localColors = getLegendColor(theme);
|
|
93
83
|
return jsxs(Fragment, {
|
|
@@ -20,43 +20,32 @@ const BLANK_TARGET_ICON_SIZE = 14;
|
|
|
20
20
|
const TRANSITION_DURATION = 250;
|
|
21
21
|
const StyledExternalIconContainer = /*#__PURE__*/_styled("span", {
|
|
22
22
|
target: "e1afnb7a1"
|
|
23
|
-
})("display:inline-flex;padding-bottom:",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = _ref;
|
|
27
|
-
return theme.space['0.5'];
|
|
28
|
-
}, ";");
|
|
23
|
+
})("display:inline-flex;padding-bottom:", ({
|
|
24
|
+
theme
|
|
25
|
+
}) => theme.space['0.5'], ";");
|
|
29
26
|
const StyledLink = /*#__PURE__*/_styled('a', {
|
|
30
27
|
shouldForwardProp: prop => !['sentiment', 'iconPosition', 'as', 'oneLine'].includes(prop),
|
|
31
28
|
target: "e1afnb7a0"
|
|
32
|
-
})("background-color:transparent;border:none;padding:0;color:",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = _ref2;
|
|
29
|
+
})("background-color:transparent;border:none;padding:0;color:", ({
|
|
30
|
+
theme,
|
|
31
|
+
sentiment,
|
|
32
|
+
prominence
|
|
33
|
+
}) => {
|
|
38
34
|
const definedProminence = capitalize(PROMINENCES[prominence ?? 'default']);
|
|
39
35
|
theme.colors[sentiment];
|
|
40
36
|
const text = `text${definedProminence}`;
|
|
41
37
|
return theme.colors[sentiment]?.[text] ?? theme.colors.neutral.text;
|
|
42
|
-
}, ";text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px;text-decoration-color:transparent;display:inline-flex;flex-direction:row;align-items:center;transition:text-decoration-color ", TRANSITION_DURATION, "ms ease-out;", StyledIcon, "{transition:transform ", TRANSITION_DURATION, "ms ease-out;}gap:",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}, ";position:relative;cursor:pointer;>*{pointer-events:none;}", _ref4 => {
|
|
48
|
-
let {
|
|
49
|
-
oneLine
|
|
50
|
-
} = _ref4;
|
|
51
|
-
return oneLine ? `white-space: nowrap;
|
|
38
|
+
}, ";text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px;text-decoration-color:transparent;display:inline-flex;flex-direction:row;align-items:center;transition:text-decoration-color ", TRANSITION_DURATION, "ms ease-out;", StyledIcon, "{transition:transform ", TRANSITION_DURATION, "ms ease-out;}gap:", ({
|
|
39
|
+
theme
|
|
40
|
+
}) => theme.space['1'], ";position:relative;cursor:pointer;>*{pointer-events:none;}", ({
|
|
41
|
+
oneLine
|
|
42
|
+
}) => oneLine ? `white-space: nowrap;
|
|
52
43
|
text-overflow: ellipsis;
|
|
53
44
|
overflow: hidden;
|
|
54
|
-
display: block;` : 'width: fit-content;'
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
theme
|
|
59
|
-
} = _ref5;
|
|
45
|
+
display: block;` : 'width: fit-content;', " ", ({
|
|
46
|
+
size,
|
|
47
|
+
theme
|
|
48
|
+
}) => {
|
|
60
49
|
const variant = size === 'small' ? 'bodySmallStrong' : 'bodyStrong';
|
|
61
50
|
return `
|
|
62
51
|
font-size: ${theme.typography[variant].fontSize};
|
|
@@ -67,53 +56,45 @@ const StyledLink = /*#__PURE__*/_styled('a', {
|
|
|
67
56
|
paragraph-spacing: ${theme.typography[variant].paragraphSpacing};
|
|
68
57
|
text-case: ${theme.typography[variant].textCase};
|
|
69
58
|
`;
|
|
70
|
-
}, " &:hover,&:focus{outline:none;text-decoration:underline;text-decoration-thickness:1px;",
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} = _ref6;
|
|
59
|
+
}, " &:hover,&:focus{outline:none;text-decoration:underline;text-decoration-thickness:1px;", ({
|
|
60
|
+
theme,
|
|
61
|
+
sentiment,
|
|
62
|
+
prominence
|
|
63
|
+
}) => {
|
|
76
64
|
const definedProminence = capitalize(PROMINENCES[prominence ?? 'default']);
|
|
77
65
|
theme.colors[sentiment];
|
|
78
66
|
const text = `text${definedProminence}Hover`;
|
|
79
67
|
return `
|
|
80
68
|
color: ${theme.colors[sentiment]?.[text] ?? theme.colors.neutral.textHover};
|
|
81
69
|
text-decoration-color: ${theme.colors[sentiment]?.[text] ?? theme.colors.neutral.textHover};`;
|
|
82
|
-
}, ";", StyledIcon, "{transform:",
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}, ";}
|
|
89
|
-
let {
|
|
90
|
-
theme,
|
|
91
|
-
sentiment
|
|
92
|
-
} = _ref8;
|
|
93
|
-
return theme.colors[sentiment]?.text ?? theme.colors.neutral.text;
|
|
94
|
-
}, ";}&:active{text-decoration-thickness:2px;}");
|
|
70
|
+
}, ";", StyledIcon, "{transform:", ({
|
|
71
|
+
theme,
|
|
72
|
+
iconPosition
|
|
73
|
+
}) => iconPosition === 'left' ? `translate(${theme.space['0.5']}, 0)` : `translate(-${theme.space['0.5']}, 0)`, ";}}&[data-variant='inline']{text-decoration:underline;text-decoration-thickness:1px;}&:hover::after,&:focus::after{background-color:", ({
|
|
74
|
+
theme,
|
|
75
|
+
sentiment
|
|
76
|
+
}) => theme.colors[sentiment]?.text ?? theme.colors.neutral.text, ";}&:active{text-decoration-thickness:2px;}");
|
|
95
77
|
|
|
96
78
|
/**
|
|
97
79
|
* Link is a component used to navigate between pages or to external websites.
|
|
98
80
|
*/
|
|
99
|
-
const Link = /*#__PURE__*/forwardRef((
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
} = _ref9;
|
|
81
|
+
const Link = /*#__PURE__*/forwardRef(({
|
|
82
|
+
children,
|
|
83
|
+
href,
|
|
84
|
+
target,
|
|
85
|
+
download,
|
|
86
|
+
sentiment = 'info',
|
|
87
|
+
prominence,
|
|
88
|
+
size = 'large',
|
|
89
|
+
iconPosition,
|
|
90
|
+
rel,
|
|
91
|
+
className,
|
|
92
|
+
onClick,
|
|
93
|
+
'aria-label': ariaLabel,
|
|
94
|
+
oneLine = false,
|
|
95
|
+
'data-testid': dataTestId,
|
|
96
|
+
variant = 'standalone'
|
|
97
|
+
}, ref) => {
|
|
117
98
|
const isBlank = target === '_blank';
|
|
118
99
|
const computedRel = rel || (isBlank ? 'noopener noreferrer' : undefined);
|
|
119
100
|
const [isTruncated, setIsTruncated] = useState(false);
|