@monolith-forensics/monolith-ui 1.8.1-dev.3 → 1.8.1
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/Button/Button.js +58 -9
- package/dist/Calendar/Calendar.d.ts +2 -7
- package/dist/Calendar/Calendar.js +49 -226
- package/dist/Calendar/CalendarStyles.d.ts +2 -6
- package/dist/Calendar/CalendarStyles.js +33 -153
- package/dist/Calendar/calendarHelpers.d.ts +2 -6
- package/dist/Calendar/calendarHelpers.js +5 -13
- package/dist/Charts/BarChart/BarChart.js +28 -14
- package/dist/Charts/BarChart/BarChart.styled.d.ts +7 -2
- package/dist/Charts/BarChart/BarChart.styled.js +5 -1
- package/dist/Charts/BarChart/BarChart.types.d.ts +13 -5
- package/dist/Charts/ChartUtils/chartSizing.d.ts +20 -0
- package/dist/Charts/ChartUtils/chartSizing.js +83 -0
- package/dist/Charts/ChartUtils/index.d.ts +1 -0
- package/dist/Charts/ChartUtils/index.js +1 -0
- package/dist/Charts/HeatMap/HeatMap.js +28 -7
- package/dist/Charts/HeatMap/HeatMap.styled.d.ts +6 -2
- package/dist/Charts/HeatMap/HeatMap.styled.js +3 -0
- package/dist/Charts/HeatMap/HeatMap.types.d.ts +7 -1
- package/dist/Charts/LineChart/LineChart.js +34 -15
- package/dist/Charts/LineChart/LineChart.styled.d.ts +7 -2
- package/dist/Charts/LineChart/LineChart.styled.js +5 -1
- package/dist/Charts/LineChart/LineChart.types.d.ts +13 -5
- package/dist/Charts/PieChart/PieChart.js +48 -33
- package/dist/Charts/PieChart/PieChart.styled.d.ts +7 -2
- package/dist/Charts/PieChart/PieChart.styled.js +6 -1
- package/dist/Charts/PieChart/PieChart.types.d.ts +7 -3
- package/dist/CheckBox/CheckBox.js +19 -36
- package/dist/DateInput/DateInput.js +143 -198
- package/dist/DropDownMenu/DropDownMenu.js +15 -25
- package/dist/DropDownMenu/components/MenuComponent.js +2 -8
- package/dist/DropDownMenu/components/MenuItem.d.ts +0 -2
- package/dist/DropDownMenu/components/MenuItem.js +21 -25
- package/dist/DropDownMenu/components/MenuItemList.d.ts +0 -3
- package/dist/DropDownMenu/components/MenuItemList.js +86 -192
- package/dist/DropDownMenu/components/StyledContent.js +2 -1
- package/dist/DropDownMenu/components/StyledFloatContainer.js +1 -1
- package/dist/DropDownMenu/types.d.ts +0 -3
- package/dist/FieldLabel/FieldLabel.js +12 -4
- package/dist/FileInputField/FileInputField.js +23 -4
- package/dist/FileViewer/viewers/ImageViewer.js +18 -75
- package/dist/FormSection/FormSection.js +25 -5
- package/dist/IconButton/IconButton.js +16 -2
- package/dist/Input/Input.js +56 -7
- package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +4 -1
- package/dist/Pill/Pill.js +79 -8
- package/dist/Popover/Popover.context.d.ts +1 -2
- package/dist/Popover/Popover.js +2 -5
- package/dist/Popover/Popover.styles.d.ts +6 -1
- package/dist/Popover/Popover.styles.js +28 -11
- package/dist/Popover/Popover.transitions.d.ts +2 -4
- package/dist/Popover/Popover.transitions.js +49 -23
- package/dist/Popover/PopoverDropdown.js +8 -6
- package/dist/Popover/PopoverTarget.js +3 -6
- package/dist/QueryFilter/DefaultOperators.d.ts +76 -1
- package/dist/QueryFilter/DefaultOperators.js +21 -1
- package/dist/QueryFilter/QueryFilter.d.ts +1 -1
- package/dist/QueryFilter/QueryFilter.js +303 -3
- package/dist/QueryFilter/index.d.ts +2 -3
- package/dist/QueryFilter/index.js +2 -3
- package/dist/QueryFilter/types.d.ts +52 -1
- package/dist/QueryFilter/types.js +1 -1
- package/dist/QueryFilter/useQueryFilter.d.ts +1 -1
- package/dist/QueryFilter/useQueryFilter.js +19 -23
- package/dist/RichTextEditor/Components/CodeBlockBaseButton.d.ts +18 -0
- package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +6 -0
- package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +9 -0
- package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +42 -0
- package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +10 -0
- package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +60 -0
- package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +9 -0
- package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +30 -0
- package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +3 -0
- package/dist/RichTextEditor/Components/CodeBlockNodeView.js +28 -0
- package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +10 -0
- package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +17 -0
- package/dist/RichTextEditor/Components/LinkEditor.d.ts +8 -0
- package/dist/RichTextEditor/Components/LinkEditor.js +94 -0
- package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +19 -0
- package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +24 -0
- package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableRails.js +180 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +5 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +6 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +5 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +183 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +16 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +217 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +8 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +11 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +3 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +23 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +75 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.js +3 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +16 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +53 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +40 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +167 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +76 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +1 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +4 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +4 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +12 -0
- package/dist/RichTextEditor/Components/TableTools/index.d.ts +3 -0
- package/dist/RichTextEditor/Components/TableTools/index.js +2 -0
- package/dist/RichTextEditor/Enums/HighlightColors.d.ts +9 -0
- package/dist/RichTextEditor/Enums/HighlightColors.js +10 -0
- package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +15 -5
- package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +4 -7
- package/dist/RichTextEditor/Plugins/UploadImagesPlugin.d.ts +0 -15
- package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +51 -115
- package/dist/RichTextEditor/Plugins/index.d.ts +0 -1
- package/dist/RichTextEditor/Plugins/index.js +0 -1
- package/dist/RichTextEditor/RichTextEditor.d.ts +2 -3
- package/dist/RichTextEditor/RichTextEditor.js +35 -302
- package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +20 -0
- package/dist/RichTextEditor/Utils/codeBlockUtils.js +137 -0
- package/dist/RichTextEditor/Utils/codeUtils.d.ts +3 -0
- package/dist/RichTextEditor/Utils/codeUtils.js +12 -0
- package/dist/RichTextEditor/Utils/linkUtils.d.ts +19 -0
- package/dist/RichTextEditor/Utils/linkUtils.js +57 -0
- package/dist/RichTextEditor/Utils/tableUtils.d.ts +1 -0
- package/dist/RichTextEditor/Utils/tableUtils.js +1 -0
- package/dist/SegmentedControl/SegmentedControl.utils.d.ts +2 -2
- package/dist/SegmentedControl/SegmentedControl.utils.js +30 -3
- package/dist/SelectBox/SelectBox.js +5 -5
- package/dist/SelectBox/select-box.styled-components.d.ts +1 -4
- package/dist/SelectBox/select-box.styled-components.js +48 -11
- package/dist/SelectBox/types.d.ts +0 -1
- package/dist/Switch/Switch.d.ts +2 -2
- package/dist/Switch/Switch.js +83 -18
- package/dist/Table/ColumnResizer.d.ts +9 -6
- package/dist/Table/ColumnResizer.js +10 -30
- package/dist/Table/StateStorage.d.ts +0 -4
- package/dist/Table/StateStorage.js +0 -13
- package/dist/Table/Table.js +12 -160
- package/dist/Table/TableComponents.d.ts +0 -10
- package/dist/Table/TableComponents.js +10 -71
- package/dist/Table/TableDefaults.d.ts +0 -7
- package/dist/Table/TableDefaults.js +0 -7
- package/dist/Table/TableHeader.js +16 -31
- package/dist/Table/TableMenu/TableMenu.js +1 -1
- package/dist/Table/TableProvider.js +75 -354
- package/dist/Table/TableRow.js +16 -28
- package/dist/Table/Utils/index.d.ts +1 -0
- package/dist/Table/Utils/index.js +1 -0
- package/dist/Table/types.d.ts +19 -70
- package/dist/TagBox/TagBox.d.ts +1 -1
- package/dist/TagBox/TagBox.js +80 -22
- package/dist/TagBox/types.d.ts +0 -1
- package/dist/TextArea/TextArea.js +23 -9
- package/dist/TextInput/TextInput.js +6 -12
- package/dist/Utilities/parseTimestamp.js +6 -11
- package/dist/core/ArrowButton.d.ts +0 -2
- package/dist/core/ArrowButton.js +3 -7
- package/dist/core/ClearButton.d.ts +0 -2
- package/dist/core/ClearButton.js +3 -7
- package/dist/core/controlSizes.js +9 -9
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -2
- package/dist/theme/variants.js +8 -2
- package/package.json +18 -26
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +0 -41
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js +0 -363
- package/dist/DateTimeRangePicker/index.d.ts +0 -2
- package/dist/DateTimeRangePicker/index.js +0 -2
|
@@ -1,145 +1,70 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
export const MainContainer = styled.div `
|
|
3
3
|
display: flex;
|
|
4
|
-
align-items: flex-start;
|
|
5
|
-
gap: 8px;
|
|
6
4
|
`;
|
|
7
5
|
export const CalendarContainer = styled.div `
|
|
8
|
-
|
|
6
|
+
font-size: 5px;
|
|
7
|
+
width: 250px;
|
|
9
8
|
border-radius: 4px;
|
|
10
9
|
overflow: hidden;
|
|
11
|
-
box-sizing: border-box;
|
|
12
10
|
`;
|
|
13
11
|
export const CalendarHeader = styled.div `
|
|
14
12
|
display: flex;
|
|
15
13
|
align-items: center;
|
|
16
14
|
justify-content: space-between;
|
|
17
|
-
gap: 4px;
|
|
18
|
-
padding: 0 2px 6px;
|
|
19
|
-
`;
|
|
20
|
-
export const CalendarHeaderControls = styled.div `
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
gap: 4px;
|
|
25
|
-
flex: 1;
|
|
26
|
-
min-width: 0;
|
|
27
|
-
`;
|
|
28
|
-
export const CalendarNavButton = styled.button `
|
|
29
|
-
display: inline-flex;
|
|
30
|
-
align-items: center;
|
|
31
|
-
justify-content: center;
|
|
32
|
-
padding: 4px;
|
|
33
|
-
border: none;
|
|
34
|
-
border-radius: 4px;
|
|
35
|
-
background: transparent;
|
|
36
|
-
color: ${(props) => props.theme.palette.text.secondary};
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
transition: background 0.2s ease-out;
|
|
39
|
-
|
|
40
|
-
&:hover {
|
|
41
|
-
background: ${(props) => props.theme.palette.action.hover};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&:focus-visible {
|
|
45
|
-
outline: 2px solid ${(props) => props.theme.palette.primary.main};
|
|
46
|
-
outline-offset: 2px;
|
|
47
|
-
}
|
|
48
15
|
`;
|
|
49
16
|
export const CalendarGrid = styled.div `
|
|
50
17
|
display: grid;
|
|
51
|
-
grid-template: repeat(7, auto) / repeat(7,
|
|
52
|
-
gap: 3px;
|
|
53
|
-
justify-content: center;
|
|
54
|
-
justify-items: center;
|
|
18
|
+
grid-template: repeat(7, auto) / repeat(7, auto);
|
|
55
19
|
`;
|
|
56
20
|
export const CalendarMonth = styled.div `
|
|
57
21
|
font-weight: 500;
|
|
58
22
|
font-size: 12px;
|
|
59
23
|
color: ${(props) => props.theme.palette.text.primary};
|
|
60
24
|
text-align: center;
|
|
61
|
-
padding:
|
|
25
|
+
padding: 0.5em 0.25em;
|
|
62
26
|
word-spacing: 5px;
|
|
63
27
|
user-select: none;
|
|
64
|
-
flex: 1;
|
|
65
|
-
`;
|
|
66
|
-
export const CalendarHeaderSelect = styled.div `
|
|
67
|
-
.mfui-DropDownMenu {
|
|
68
|
-
min-width: 0;
|
|
69
|
-
}
|
|
70
28
|
`;
|
|
71
29
|
export const CalendarCell = styled.div `
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
justify-content: center;
|
|
75
30
|
text-align: center;
|
|
76
31
|
align-self: center;
|
|
77
32
|
letter-spacing: 0.1rem;
|
|
78
|
-
|
|
79
|
-
width: 32px;
|
|
80
|
-
min-height: 32px;
|
|
81
|
-
height: 32px;
|
|
82
|
-
padding: 6px 4px;
|
|
33
|
+
padding: 7px;
|
|
83
34
|
user-select: none;
|
|
84
35
|
border-radius: 5px;
|
|
85
36
|
border: 1px solid transparent;
|
|
86
|
-
box-sizing: border-box;
|
|
87
37
|
grid-column: ${({ index = 0 }) => (index % 7) + 1} / span 1;
|
|
88
38
|
`;
|
|
89
39
|
export const CalendarDay = styled(CalendarCell) `
|
|
90
40
|
font-weight: bold;
|
|
91
|
-
font-size:
|
|
41
|
+
font-size: 10px;
|
|
92
42
|
border-radius: 0px;
|
|
93
43
|
color: ${(props) => props.theme.palette.text.secondary};
|
|
94
|
-
min-height: 24px;
|
|
95
44
|
`;
|
|
96
45
|
export const CalendarDate = styled(CalendarCell) `
|
|
97
46
|
font-weight: ${(props) => (props.inMonth ? 500 : 300)};
|
|
98
|
-
font-size:
|
|
99
|
-
line-height: 1.1;
|
|
47
|
+
font-size: 10px;
|
|
100
48
|
cursor: pointer;
|
|
101
49
|
|
|
102
50
|
color: ${({ inMonth, theme }) => inMonth ? theme.palette.text.primary : theme.palette.text.secondary};
|
|
103
|
-
background: transparent;
|
|
104
|
-
opacity: ${({ inMonth }) => (inMonth ? 1 : 0.65)};
|
|
105
51
|
grid-row: ${({ index }) => Math.floor((index || 0) / 7) + 2} / span 1;
|
|
106
52
|
transition: all 0.2s ease-out;
|
|
107
53
|
border-radius: 5px;
|
|
108
54
|
&:hover {
|
|
109
55
|
background: ${({ theme }) => theme.palette.action.hover};
|
|
110
|
-
opacity: 1;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&:focus-visible {
|
|
114
|
-
outline: 2px solid ${({ theme }) => theme.palette.primary.main};
|
|
115
|
-
outline-offset: 1px;
|
|
116
56
|
}
|
|
117
57
|
|
|
118
58
|
&[data-disabled="true"] {
|
|
119
|
-
|
|
120
|
-
color: ${({ theme }) => theme.palette.text.
|
|
121
|
-
|
|
122
|
-
opacity: 0.62;
|
|
123
|
-
font-weight: 500;
|
|
124
|
-
text-decoration: line-through;
|
|
125
|
-
text-decoration-thickness: 1px;
|
|
126
|
-
|
|
127
|
-
&:hover {
|
|
128
|
-
background: transparent;
|
|
129
|
-
opacity: 0.62;
|
|
130
|
-
}
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
color: ${({ theme }) => theme.palette.text.disabled};
|
|
131
61
|
}
|
|
132
62
|
`;
|
|
133
63
|
export const HighlightedCalendarDate = styled(CalendarDate) `
|
|
134
64
|
color: white !important;
|
|
135
65
|
background: ${(props) => props.theme.palette.primary.main} !important;
|
|
136
66
|
border: 1px solid ${(props) => props.theme.palette.primary.main} !important;
|
|
137
|
-
font-weight: 700;
|
|
138
|
-
opacity: 1;
|
|
139
67
|
position: relative;
|
|
140
|
-
box-shadow:
|
|
141
|
-
inset 0 0 0 1px ${(props) => props.theme.palette.primary.main},
|
|
142
|
-
0 4px 10px ${(props) => `${props.theme.palette.primary.main}33`};
|
|
143
68
|
::before {
|
|
144
69
|
content: "";
|
|
145
70
|
position: absolute;
|
|
@@ -151,112 +76,72 @@ export const HighlightedCalendarDate = styled(CalendarDate) `
|
|
|
151
76
|
`;
|
|
152
77
|
export const TodayCalendarDate = styled(HighlightedCalendarDate) `
|
|
153
78
|
color: ${(props) => props.theme.palette.text.primary} !important;
|
|
154
|
-
background:
|
|
155
|
-
border: 1px dashed ${(props) => props.theme.palette.primary.main} !important;
|
|
156
|
-
box-shadow: none;
|
|
157
|
-
font-weight: 600;
|
|
79
|
+
background: transparent !important;
|
|
158
80
|
::after {
|
|
159
81
|
content: "";
|
|
160
82
|
position: absolute;
|
|
161
|
-
|
|
162
|
-
bottom:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
border-
|
|
166
|
-
background: ${(props) => props.theme.palette.primary.main};
|
|
167
|
-
transform: translateX(-50%);
|
|
83
|
+
right: 0;
|
|
84
|
+
bottom: 0;
|
|
85
|
+
border-bottom: 0.75em solid #06c;
|
|
86
|
+
border-left: 0.75em solid transparent;
|
|
87
|
+
border-top: 0.75em solid transparent;
|
|
168
88
|
}
|
|
169
89
|
:hover {
|
|
170
90
|
color: ${(props) => props.theme.palette.text.primary} !important;
|
|
171
|
-
background: ${(props) =>
|
|
91
|
+
background: ${(props) => props.theme.palette.action.hover} !important;
|
|
172
92
|
}
|
|
173
93
|
`;
|
|
174
94
|
export const TimeContainer = styled.div `
|
|
175
|
-
position: relative;
|
|
176
|
-
flex: 0 0 132px;
|
|
177
95
|
font-size: 12px;
|
|
178
|
-
width:
|
|
179
|
-
height:
|
|
180
|
-
box-sizing: border-box;
|
|
96
|
+
width: 150px;
|
|
97
|
+
height: 100%;
|
|
181
98
|
border: 1px solid ${(props) => props.theme.palette.divider};
|
|
99
|
+
border-left: none;
|
|
182
100
|
border-radius: 4px;
|
|
183
|
-
background: ${(props) => props.theme.palette.input.background};
|
|
184
101
|
overflow: hidden;
|
|
185
102
|
`;
|
|
186
103
|
export const TimePickerContainer = styled.div `
|
|
187
104
|
display: flex;
|
|
188
|
-
height:
|
|
105
|
+
height: 100%;
|
|
189
106
|
`;
|
|
190
107
|
export const TimeHeader = styled.div `
|
|
191
|
-
|
|
192
|
-
font-weight: 600;
|
|
108
|
+
font-weight: 500;
|
|
193
109
|
font-size: 12px;
|
|
194
110
|
color: ${(props) => props.theme.palette.text.primary};
|
|
195
111
|
border-bottom: 1px solid ${(props) => props.theme.palette.divider};
|
|
196
112
|
text-align: center;
|
|
197
|
-
padding:
|
|
198
|
-
line-height:
|
|
113
|
+
padding: 5px;
|
|
114
|
+
line-height: 2.3;
|
|
199
115
|
height: 40px;
|
|
200
116
|
user-select: none;
|
|
201
|
-
display: flex;
|
|
202
|
-
align-items: center;
|
|
203
|
-
justify-content: center;
|
|
204
|
-
gap: 6px;
|
|
205
|
-
`;
|
|
206
|
-
export const TimeHeaderValue = styled.span `
|
|
207
|
-
color: ${(props) => props.theme.palette.text.primary};
|
|
208
117
|
`;
|
|
209
|
-
export const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
font-size: 10px;
|
|
215
|
-
font-weight: 700;
|
|
216
|
-
line-height: 1;
|
|
217
|
-
text-transform: uppercase;
|
|
118
|
+
export const TimeHourSelect = styled.div `
|
|
119
|
+
border-right: 1px solid ${(props) => props.theme.palette.divider};
|
|
120
|
+
width: 50%;
|
|
121
|
+
height: 250px;
|
|
122
|
+
overflow-y: auto;
|
|
218
123
|
`;
|
|
219
|
-
export const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
width: 100%;
|
|
124
|
+
export const TimeMinuteSelect = styled.div `
|
|
125
|
+
width: 50%;
|
|
126
|
+
height: 250px;
|
|
223
127
|
overflow-y: auto;
|
|
224
128
|
`;
|
|
225
129
|
export const TimeItem = styled.div `
|
|
226
130
|
font-weight: 500;
|
|
227
|
-
font-size:
|
|
131
|
+
font-size: 10px;
|
|
228
132
|
color: ${(props) => props.theme.palette.text.primary};
|
|
229
133
|
text-align: center;
|
|
230
|
-
padding:
|
|
134
|
+
padding: 5px;
|
|
231
135
|
user-select: none;
|
|
232
136
|
cursor: pointer;
|
|
233
137
|
transition: all 0.2s ease-out;
|
|
234
|
-
border-radius: 4px;
|
|
235
|
-
margin: 1px 4px;
|
|
236
138
|
:hover {
|
|
237
139
|
background: ${(props) => props.theme.palette.action.hover};
|
|
238
140
|
}
|
|
239
|
-
|
|
240
|
-
&:focus-visible {
|
|
241
|
-
outline: 2px solid ${(props) => props.theme.palette.primary.main};
|
|
242
|
-
outline-offset: -2px;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
&[data-disabled="true"] {
|
|
246
|
-
cursor: not-allowed;
|
|
247
|
-
color: ${({ theme }) => theme.palette.text.secondary};
|
|
248
|
-
opacity: 0.62;
|
|
249
|
-
text-decoration: line-through;
|
|
250
|
-
|
|
251
|
-
&:hover {
|
|
252
|
-
background: transparent;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
141
|
`;
|
|
256
142
|
export const TimeItemActive = styled(TimeItem) `
|
|
257
143
|
background: ${(props) => props.theme.palette.primary.main};
|
|
258
144
|
color: white;
|
|
259
|
-
font-weight: 700;
|
|
260
145
|
&:hover {
|
|
261
146
|
background: ${(props) => props.theme.palette.primary.main};
|
|
262
147
|
}
|
|
@@ -276,9 +161,4 @@ export const NoValueButton = styled.button `
|
|
|
276
161
|
:hover {
|
|
277
162
|
background: ${(props) => props.theme.palette.action.hover};
|
|
278
163
|
}
|
|
279
|
-
|
|
280
|
-
&:focus-visible {
|
|
281
|
-
outline: 2px solid ${(props) => props.theme.palette.primary.main};
|
|
282
|
-
outline-offset: 2px;
|
|
283
|
-
}
|
|
284
164
|
`;
|
|
@@ -8,10 +8,7 @@ export declare const HOURS12: {
|
|
|
8
8
|
value: number;
|
|
9
9
|
label: string;
|
|
10
10
|
}[];
|
|
11
|
-
export declare const MINUTES:
|
|
12
|
-
value: number;
|
|
13
|
-
label: string;
|
|
14
|
-
}[];
|
|
11
|
+
export declare const MINUTES: (string | number)[];
|
|
15
12
|
export declare const WEEK_DAYS: {
|
|
16
13
|
Sunday: string;
|
|
17
14
|
Monday: string;
|
|
@@ -38,8 +35,7 @@ export declare const CALENDAR_MONTHS: {
|
|
|
38
35
|
};
|
|
39
36
|
export declare const CALENDAR_WEEKS = 6;
|
|
40
37
|
export declare const zeroPad: (value: number, length: number) => string;
|
|
41
|
-
export declare const
|
|
42
|
-
export declare const getMonthDays: (month?: number, year?: number) => 28 | 30 | 29 | 31;
|
|
38
|
+
export declare const getMonthDays: (month?: number, year?: number) => 28 | 29 | 30 | 31;
|
|
43
39
|
export declare const getMonthFirstDay: (month?: number, year?: number) => number;
|
|
44
40
|
export declare const isDate: (date: Date) => boolean;
|
|
45
41
|
export declare const isSameMonth: (date: Date, basedate?: Date) => boolean;
|
|
@@ -12,25 +12,20 @@ export const HOURS24 = [...new Array(24)].map((n, index) => {
|
|
|
12
12
|
});
|
|
13
13
|
export const HOURS12 = [
|
|
14
14
|
...[...new Array(12)].map((n, index) => {
|
|
15
|
-
const displayHour = index === 0 ? 12 : index;
|
|
16
15
|
return {
|
|
17
16
|
value: index,
|
|
18
|
-
label:
|
|
17
|
+
label: index < 10 ? `0${index} AM` : `${index} AM`,
|
|
19
18
|
};
|
|
20
19
|
}),
|
|
21
20
|
...[...new Array(12)].map((n, index) => {
|
|
22
|
-
const displayHour = index === 0 ? 12 : index;
|
|
23
21
|
return {
|
|
24
22
|
value: index + 12,
|
|
25
|
-
label:
|
|
23
|
+
label: index < 10 ? `0${index} PM` : `${index} PM`,
|
|
26
24
|
};
|
|
27
25
|
}),
|
|
28
26
|
];
|
|
29
27
|
export const MINUTES = new Array(60).fill(0).map((n, index) => {
|
|
30
|
-
return {
|
|
31
|
-
value: index,
|
|
32
|
-
label: index < 10 ? `0${index}` : `${index}`,
|
|
33
|
-
};
|
|
28
|
+
return index < 10 ? `0${index}` : index;
|
|
34
29
|
});
|
|
35
30
|
export const WEEK_DAYS = {
|
|
36
31
|
Sunday: "Su",
|
|
@@ -63,13 +58,10 @@ export const CALENDAR_WEEKS = 6;
|
|
|
63
58
|
export const zeroPad = (value, length) => {
|
|
64
59
|
return `${value}`.padStart(length, "0");
|
|
65
60
|
};
|
|
66
|
-
export const createLocalDate = (year, month, day) => {
|
|
67
|
-
return new Date(year, month - 1, day);
|
|
68
|
-
};
|
|
69
61
|
// (int) Number days in a month for a given year from 28 - 31
|
|
70
62
|
export const getMonthDays = (month = THIS_MONTH, year = THIS_YEAR) => {
|
|
71
63
|
const months30 = [4, 6, 9, 11];
|
|
72
|
-
const leapYear = year % 4 === 0
|
|
64
|
+
const leapYear = year % 4 === 0;
|
|
73
65
|
return month === 2
|
|
74
66
|
? leapYear
|
|
75
67
|
? 29
|
|
@@ -81,7 +73,7 @@ export const getMonthDays = (month = THIS_MONTH, year = THIS_YEAR) => {
|
|
|
81
73
|
// (int) First day of the month for a given year from 1 - 7
|
|
82
74
|
// 1 => Sunday, 7 => Saturday
|
|
83
75
|
export const getMonthFirstDay = (month = THIS_MONTH, year = THIS_YEAR) => {
|
|
84
|
-
return
|
|
76
|
+
return +new Date(`${year}-${zeroPad(month, 2)}-01`).getDay() + 1;
|
|
85
77
|
};
|
|
86
78
|
// (bool) Checks if a value is a date - this is just a simple check
|
|
87
79
|
export const isDate = (date) => {
|
|
@@ -23,15 +23,16 @@ import { scaleBand, scaleLinear } from "d3-scale";
|
|
|
23
23
|
import { forwardRef, useEffect, useId, useImperativeHandle, useMemo, useRef, useState, } from "react";
|
|
24
24
|
import { useTheme } from "styled-components";
|
|
25
25
|
import { ChartExportControl } from "../ChartPrimitives";
|
|
26
|
-
import { DEFAULT_CHART_EXPORT_FORMATS, copyChartImage, downloadChartImage, } from "../ChartUtils";
|
|
26
|
+
import { DEFAULT_CHART_EXPORT_FORMATS, copyChartImage, downloadChartImage, useChartResponsiveSize, } from "../ChartUtils";
|
|
27
27
|
import { clamp, easeOutCubic, formatDefaultValue, getBandPadding, getBarKey, getCategoryKey, getGradientColor, getGradientColorFromStops, getGradientStops, getRoundedBarPath, getSeriesKey, getSeriesLabelText, getValueDomain, mergeChartMargin, normalizeTickValue, useThemeColors, } from "./BarChart.lib";
|
|
28
28
|
import { StyledAxisLine, StyledAxisText, StyledBar, StyledChartActions, StyledChartFrame, StyledChartScroller, StyledContainer, StyledEmptyState, StyledGridLine, StyledLegend, StyledLegendItem, StyledLegendLabel, StyledLegendValue, StyledSvg, StyledSwatch, StyledTooltip, StyledTooltipHeader, StyledTooltipLabel, StyledTooltipList, StyledTooltipMeta, StyledTooltipRow, StyledTooltipSwatch, StyledTooltipValue, StyledValueLabel, } from "./BarChart.styled";
|
|
29
29
|
const BarChartInner = (_a, ref) => {
|
|
30
30
|
var _b, _c, _d;
|
|
31
|
-
var { data, series, width =
|
|
31
|
+
var { data, series, width, height, responsive = false, aspectRatio, minWidth = 180, minHeight = 180, orientation = "vertical", seriesLayout = "grouped", margin, barGap = 10, groupBarGap, maxBarThickness, barRadius = 3, colors, colorGradient, barOpacity = 1, barBorderColor, barBorderWidth = 1, barBorderOpacity = 1, minValue, maxValue, valueTickCount = 5, showGridLines = true, showAxisLines = true, showCategoryAxisLabels = true, showValueAxisLabels = true, showLegend = false, showLegendSwatches = true, showLegendLabels = true, showLegendValues = true, showLabels = false, emptyLabel = "No data", ariaLabel = "Bar chart", animateOnRender = false, animationDuration = 520, animationStagger = 35, showExportButton = false, exportFileName = "bar-chart", exportFormats = DEFAULT_CHART_EXPORT_FORMATS, exportScale = 2, exportBackgroundColor, showTooltips = false, valueFormatter, categoryLabelFormatter, tickFormatter, labelFormatter, tooltipFormatter, onBarClick, onLegendItemClick, onSeriesLegendItemClick, className } = _a, props = __rest(_a, ["data", "series", "width", "height", "responsive", "aspectRatio", "minWidth", "minHeight", "orientation", "seriesLayout", "margin", "barGap", "groupBarGap", "maxBarThickness", "barRadius", "colors", "colorGradient", "barOpacity", "barBorderColor", "barBorderWidth", "barBorderOpacity", "minValue", "maxValue", "valueTickCount", "showGridLines", "showAxisLines", "showCategoryAxisLabels", "showValueAxisLabels", "showLegend", "showLegendSwatches", "showLegendLabels", "showLegendValues", "showLabels", "emptyLabel", "ariaLabel", "animateOnRender", "animationDuration", "animationStagger", "showExportButton", "exportFileName", "exportFormats", "exportScale", "exportBackgroundColor", "showTooltips", "valueFormatter", "categoryLabelFormatter", "tickFormatter", "labelFormatter", "tooltipFormatter", "onBarClick", "onLegendItemClick", "onSeriesLegendItemClick", "className"]);
|
|
32
32
|
const descriptionId = useId();
|
|
33
33
|
const theme = useTheme();
|
|
34
34
|
const containerRef = useRef(null);
|
|
35
|
+
const chartSizeRef = useRef(null);
|
|
35
36
|
const chartFrameRef = useRef(null);
|
|
36
37
|
const svgRef = useRef(null);
|
|
37
38
|
const tooltipRef = useRef(null);
|
|
@@ -69,8 +70,18 @@ const BarChartInner = (_a, ref) => {
|
|
|
69
70
|
},
|
|
70
71
|
];
|
|
71
72
|
}, [data, series]);
|
|
72
|
-
const
|
|
73
|
-
|
|
73
|
+
const chartSize = useChartResponsiveSize(chartSizeRef, {
|
|
74
|
+
width,
|
|
75
|
+
height,
|
|
76
|
+
responsive,
|
|
77
|
+
aspectRatio,
|
|
78
|
+
defaultWidth: 640,
|
|
79
|
+
defaultHeight: 320,
|
|
80
|
+
minWidth: Math.max(minWidth, 1),
|
|
81
|
+
minHeight: Math.max(minHeight, 1),
|
|
82
|
+
});
|
|
83
|
+
const safeWidth = chartSize.width;
|
|
84
|
+
const safeHeight = chartSize.height;
|
|
74
85
|
const safeBarRadius = Math.max(barRadius, 0);
|
|
75
86
|
const safeBarGap = Math.max(barGap, 0);
|
|
76
87
|
const safeGroupBarGap = Math.max(groupBarGap !== null && groupBarGap !== void 0 ? groupBarGap : barGap, 0);
|
|
@@ -286,8 +297,7 @@ const BarChartInner = (_a, ref) => {
|
|
|
286
297
|
}, [categories, isMultiSeries, seriesLayout]);
|
|
287
298
|
const safeAnimationDuration = Math.max(animationDuration, 0);
|
|
288
299
|
const safeAnimationStagger = Math.max(animationStagger, 0);
|
|
289
|
-
const totalAnimationDuration = safeAnimationDuration +
|
|
290
|
-
Math.max(bars.length - 1, 0) * safeAnimationStagger;
|
|
300
|
+
const totalAnimationDuration = safeAnimationDuration + Math.max(bars.length - 1, 0) * safeAnimationStagger;
|
|
291
301
|
useEffect(() => {
|
|
292
302
|
var _a;
|
|
293
303
|
if (!animateOnRender || bars.length === 0) {
|
|
@@ -329,7 +339,10 @@ const BarChartInner = (_a, ref) => {
|
|
|
329
339
|
const elapsed = animationElapsed - index * safeAnimationStagger;
|
|
330
340
|
return easeOutCubic(clamp(elapsed / safeAnimationDuration, 0, 1));
|
|
331
341
|
};
|
|
332
|
-
const formatValue = (datum, sourceSeries) => {
|
|
342
|
+
const formatValue = (datum, sourceSeries) => {
|
|
343
|
+
var _a;
|
|
344
|
+
return (_a = valueFormatter === null || valueFormatter === void 0 ? void 0 : valueFormatter(datum.value, datum, sourceSeries)) !== null && _a !== void 0 ? _a : formatDefaultValue(datum.value);
|
|
345
|
+
};
|
|
333
346
|
const formatCategoryLabel = (category) => {
|
|
334
347
|
var _a, _b;
|
|
335
348
|
return (_b = categoryLabelFormatter === null || categoryLabelFormatter === void 0 ? void 0 : categoryLabelFormatter(category.representativeDatum, category.index, (_a = category.bars[0]) === null || _a === void 0 ? void 0 : _a.sourceSeries)) !== null && _b !== void 0 ? _b : category.label;
|
|
@@ -354,10 +367,10 @@ const BarChartInner = (_a, ref) => {
|
|
|
354
367
|
});
|
|
355
368
|
};
|
|
356
369
|
const activeTooltipBar = showTooltips && activeTooltip
|
|
357
|
-
? (_c = bars.find((bar) => bar.key === activeTooltip.barKey)) !== null && _c !== void 0 ? _c : null
|
|
370
|
+
? ((_c = bars.find((bar) => bar.key === activeTooltip.barKey)) !== null && _c !== void 0 ? _c : null)
|
|
358
371
|
: null;
|
|
359
372
|
const activeTooltipCategory = isMultiSeries && activeTooltipBar
|
|
360
|
-
? (_d = categories.find((category) => category.key === activeTooltipBar.categoryKey)) !== null && _d !== void 0 ? _d : null
|
|
373
|
+
? ((_d = categories.find((category) => category.key === activeTooltipBar.categoryKey)) !== null && _d !== void 0 ? _d : null)
|
|
361
374
|
: null;
|
|
362
375
|
const tooltipStyle = useMemo(() => {
|
|
363
376
|
if (!activeTooltip ||
|
|
@@ -410,7 +423,7 @@ const BarChartInner = (_a, ref) => {
|
|
|
410
423
|
height: tooltipRef.current.offsetHeight,
|
|
411
424
|
});
|
|
412
425
|
}, [activeTooltipBar, activeTooltipCategory, isMultiSeries]);
|
|
413
|
-
return (_jsxs(StyledContainer, Object.assign({ ref: containerRef, className: className }, props, { children: [bars.length === 0 ? (_jsx(StyledEmptyState, { "$width": safeWidth, "$height": safeHeight, children: emptyLabel })) : (
|
|
426
|
+
return (_jsxs(StyledContainer, Object.assign({ ref: containerRef, className: className, "$fillAvailableWidth": chartSize.fillAvailableWidth }, props, { children: [_jsx(StyledChartScroller, { ref: chartSizeRef, "$width": chartSize.widthStyle, "$height": chartSize.heightStyle, children: bars.length === 0 ? (_jsx(StyledEmptyState, { "$width": safeWidth, "$height": safeHeight, children: emptyLabel })) : (_jsxs(StyledChartFrame, { ref: chartFrameRef, children: [showExportButton && exportFormats.length > 0 && (_jsx(StyledChartActions, { "data-chart-export-ignore": "true", children: _jsx(ChartExportControl, { rootRef: containerRef, svgRef: svgRef, fileName: exportFileName, formats: exportFormats, scale: exportScale, backgroundColor: resolvedExportBackgroundColor }) })), _jsxs(StyledSvg, { ref: svgRef, width: safeWidth, height: safeHeight, viewBox: `0 0 ${safeWidth} ${safeHeight}`, role: "img", "aria-label": ariaLabel, "aria-describedby": descriptionId, children: [_jsx("desc", { id: descriptionId, children: description }), showGridLines &&
|
|
414
427
|
tickValues.map((tick) => {
|
|
415
428
|
const tickPosition = valueScale(tick);
|
|
416
429
|
return orientation === "vertical" ? (_jsx(StyledGridLine, { x1: resolvedMargin.left, x2: resolvedMargin.left + plotWidth, y1: resolvedMargin.top + tickPosition, y2: resolvedMargin.top + tickPosition }, `grid-${tick}`)) : (_jsx(StyledGridLine, { x1: resolvedMargin.left + tickPosition, x2: resolvedMargin.left + tickPosition, y1: resolvedMargin.top, y2: resolvedMargin.top + plotHeight }, `grid-${tick}`));
|
|
@@ -434,7 +447,8 @@ const BarChartInner = (_a, ref) => {
|
|
|
434
447
|
const endPosition = valueScale(bar.valueEnd);
|
|
435
448
|
const animatedStartPosition = zeroPosition +
|
|
436
449
|
(startPosition - zeroPosition) * animationProgress;
|
|
437
|
-
const animatedEndPosition = zeroPosition +
|
|
450
|
+
const animatedEndPosition = zeroPosition +
|
|
451
|
+
(endPosition - zeroPosition) * animationProgress;
|
|
438
452
|
const x = orientation === "vertical"
|
|
439
453
|
? resolvedMargin.left +
|
|
440
454
|
categoryBandStart +
|
|
@@ -528,7 +542,7 @@ const BarChartInner = (_a, ref) => {
|
|
|
528
542
|
categoryScale.bandwidth() / 2, y: resolvedMargin.top + plotHeight + 20, textAnchor: "middle", children: formatCategoryLabel(category) }, `category-${category.key}`)) : (_jsx(StyledAxisText, { x: resolvedMargin.left - 10, y: resolvedMargin.top +
|
|
529
543
|
((_b = categoryScale(category.key)) !== null && _b !== void 0 ? _b : 0) +
|
|
530
544
|
categoryScale.bandwidth() / 2, textAnchor: "end", dominantBaseline: "middle", children: formatCategoryLabel(category) }, `category-${category.key}`));
|
|
531
|
-
})] })] }) })
|
|
545
|
+
})] })] })) }), activeTooltip && activeTooltipBar && tooltipStyle && (_jsx(StyledTooltip, { ref: tooltipRef, style: tooltipStyle, children: tooltipFormatter ? (tooltipFormatter(activeTooltipBar, activeTooltipBar.index, activeTooltipBar.sourceSeries)) : isMultiSeries && activeTooltipCategory ? (_jsxs(_Fragment, { children: [_jsx(StyledTooltipHeader, { children: _jsx(StyledTooltipLabel, { children: activeTooltipCategory.label }) }), _jsxs(StyledTooltipMeta, { children: [formatDefaultValue(activeTooltipCategory.bars.reduce((sum, bar) => sum + bar.value, 0)), " ", "total"] }), _jsx(StyledTooltipList, { children: activeTooltipCategory.bars.map((bar) => (_jsxs(StyledTooltipRow, { children: [_jsx(StyledTooltipSwatch, { "$color": bar.color }), _jsx(StyledTooltipLabel, { children: bar.seriesLabel }), _jsx(StyledTooltipValue, { children: formatValue(bar, bar.sourceSeries) })] }, `tooltip-${bar.key}`))) })] })) : (_jsxs(_Fragment, { children: [_jsxs(StyledTooltipHeader, { children: [_jsx(StyledTooltipSwatch, { "$color": activeTooltipBar.color }), _jsx(StyledTooltipLabel, { children: activeTooltipBar.label })] }), _jsx(StyledTooltipMeta, { children: formatValue(activeTooltipBar, activeTooltipBar.sourceSeries) })] })) })), shouldShowLegend && (_jsx(StyledLegend, { children: isMultiSeries
|
|
532
546
|
? resolvedSeries.map((seriesEntry) => (_jsxs(StyledLegendItem, { "$active": activeSeriesKey === seriesEntry.key, "$showSwatch": showLegendSwatches, "$showLabel": showLegendLabels, "$showValue": showLegendValues, tabIndex: 0, onMouseEnter: () => setActiveSeriesKey(seriesEntry.key), onMouseLeave: () => setActiveSeriesKey(null), onFocus: () => setActiveSeriesKey(seriesEntry.key), onBlur: () => setActiveSeriesKey(null), onClick: (event) => seriesEntry.sourceSeries &&
|
|
533
547
|
(onSeriesLegendItemClick === null || onSeriesLegendItemClick === void 0 ? void 0 : onSeriesLegendItemClick(event, seriesEntry.sourceSeries)), onKeyDown: (event) => {
|
|
534
548
|
if (event.key !== "Enter" && event.key !== " ")
|
|
@@ -537,13 +551,13 @@ const BarChartInner = (_a, ref) => {
|
|
|
537
551
|
if (seriesEntry.sourceSeries) {
|
|
538
552
|
onSeriesLegendItemClick === null || onSeriesLegendItemClick === void 0 ? void 0 : onSeriesLegendItemClick(event, seriesEntry.sourceSeries);
|
|
539
553
|
}
|
|
540
|
-
}, children: [showLegendSwatches && _jsx(StyledSwatch, { "$color": seriesEntry.color }), showLegendLabels && (_jsx(StyledLegendLabel, { children: seriesEntry.label })), showLegendValues && (_jsx(StyledLegendValue, { children: formatSeriesValue(seriesEntry) }))] }, `legend-${seriesEntry.key}`)))
|
|
554
|
+
}, children: [showLegendSwatches && (_jsx(StyledSwatch, { "$color": seriesEntry.color })), showLegendLabels && (_jsx(StyledLegendLabel, { children: seriesEntry.label })), showLegendValues && (_jsx(StyledLegendValue, { children: formatSeriesValue(seriesEntry) }))] }, `legend-${seriesEntry.key}`)))
|
|
541
555
|
: bars.map((bar) => (_jsxs(StyledLegendItem, { "$active": activeBarKey === bar.key, "$showSwatch": showLegendSwatches, "$showLabel": showLegendLabels, "$showValue": showLegendValues, tabIndex: 0, onMouseEnter: () => setActiveBarKey(bar.key), onMouseLeave: () => setActiveBarKey(null), onFocus: () => setActiveBarKey(bar.key), onBlur: () => setActiveBarKey(null), onClick: (event) => onLegendItemClick === null || onLegendItemClick === void 0 ? void 0 : onLegendItemClick(event, bar), onKeyDown: (event) => {
|
|
542
556
|
if (event.key !== "Enter" && event.key !== " ")
|
|
543
557
|
return;
|
|
544
558
|
event.preventDefault();
|
|
545
559
|
onLegendItemClick === null || onLegendItemClick === void 0 ? void 0 : onLegendItemClick(event, bar);
|
|
546
|
-
}, children: [showLegendSwatches && _jsx(StyledSwatch, { "$color": bar.color }), showLegendLabels && _jsx(StyledLegendLabel, { children: bar.label }), showLegendValues && (_jsx(StyledLegendValue, { children: formatValue(bar, bar.sourceSeries) }))] }, bar.key))) }))] })));
|
|
560
|
+
}, children: [showLegendSwatches && _jsx(StyledSwatch, { "$color": bar.color }), showLegendLabels && (_jsx(StyledLegendLabel, { children: bar.label })), showLegendValues && (_jsx(StyledLegendValue, { children: formatValue(bar, bar.sourceSeries) }))] }, bar.key))) }))] })));
|
|
547
561
|
};
|
|
548
562
|
export const BarChart = forwardRef(BarChartInner);
|
|
549
563
|
export default BarChart;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { StyledChartActions } from "../ChartPrimitives";
|
|
2
|
-
export declare const StyledContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").
|
|
3
|
-
|
|
2
|
+
export declare const StyledContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
+
$fillAvailableWidth: boolean;
|
|
4
|
+
}>> & string;
|
|
5
|
+
export declare const StyledChartScroller: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
6
|
+
$width?: string;
|
|
7
|
+
$height?: string;
|
|
8
|
+
}>> & string;
|
|
4
9
|
export declare const StyledChartFrame: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
10
|
export { StyledChartActions };
|
|
6
11
|
export declare const StyledSvg: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").SVGProps<SVGSVGElement>, never>> & string;
|
|
@@ -11,7 +11,7 @@ export const StyledContainer = styled.div `
|
|
|
11
11
|
align-items: flex-start;
|
|
12
12
|
flex-wrap: wrap;
|
|
13
13
|
gap: 20px;
|
|
14
|
-
width: fit-content;
|
|
14
|
+
width: ${({ $fillAvailableWidth }) => $fillAvailableWidth ? "100%" : "fit-content"};
|
|
15
15
|
max-width: 100%;
|
|
16
16
|
color: ${({ theme }) => theme.palette.text.primary};
|
|
17
17
|
box-sizing: border-box;
|
|
@@ -19,10 +19,13 @@ export const StyledContainer = styled.div `
|
|
|
19
19
|
`;
|
|
20
20
|
export const StyledChartScroller = styled.div `
|
|
21
21
|
display: flex;
|
|
22
|
+
width: ${({ $width }) => $width !== null && $width !== void 0 ? $width : "auto"};
|
|
23
|
+
height: ${({ $height }) => $height !== null && $height !== void 0 ? $height : "auto"};
|
|
22
24
|
max-width: 100%;
|
|
23
25
|
overflow-x: auto;
|
|
24
26
|
overflow-y: visible;
|
|
25
27
|
padding-bottom: 2px;
|
|
28
|
+
box-sizing: border-box;
|
|
26
29
|
`;
|
|
27
30
|
export const StyledChartFrame = styled.div `
|
|
28
31
|
position: relative;
|
|
@@ -93,6 +96,7 @@ export const StyledEmptyState = styled.div `
|
|
|
93
96
|
justify-content: center;
|
|
94
97
|
width: ${({ $width }) => $width}px;
|
|
95
98
|
height: ${({ $height }) => $height}px;
|
|
99
|
+
box-sizing: border-box;
|
|
96
100
|
border: 1px dashed ${({ theme }) => theme.palette.divider};
|
|
97
101
|
border-radius: 8px;
|
|
98
102
|
background: linear-gradient(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from "react";
|
|
2
|
-
import type { ChartExportOptions } from "../ChartUtils";
|
|
2
|
+
import type { ChartDimension, ChartExportOptions } from "../ChartUtils";
|
|
3
3
|
export type BarChartDatum<TData = unknown> = {
|
|
4
4
|
/** Stable identifier for the bar. Falls back to label and index when omitted. */
|
|
5
5
|
id?: string | number;
|
|
@@ -86,10 +86,18 @@ export type BarChartProps<TData = unknown> = HTMLAttributes<HTMLDivElement> & Ch
|
|
|
86
86
|
data?: BarChartDatum<TData>[];
|
|
87
87
|
/** Multi-series bar data. Takes precedence over data when provided. */
|
|
88
88
|
series?: BarChartSeries<TData>[];
|
|
89
|
-
/** SVG width in pixels. Defaults to 640. */
|
|
90
|
-
width?:
|
|
91
|
-
/** SVG height in pixels. Defaults to 320. */
|
|
92
|
-
height?:
|
|
89
|
+
/** SVG width in pixels or any CSS length measured from the chart frame. Defaults to 640. */
|
|
90
|
+
width?: ChartDimension;
|
|
91
|
+
/** SVG height in pixels or any CSS length measured from the chart frame. Defaults to 320. */
|
|
92
|
+
height?: ChartDimension;
|
|
93
|
+
/** Measures the chart frame and fits the SVG width to its available space. Defaults to false. */
|
|
94
|
+
responsive?: boolean;
|
|
95
|
+
/** Calculates height from resolved width when height is omitted. */
|
|
96
|
+
aspectRatio?: number;
|
|
97
|
+
/** Minimum rendered SVG width in pixels. Defaults to 180. */
|
|
98
|
+
minWidth?: number;
|
|
99
|
+
/** Minimum rendered SVG height in pixels. Defaults to 180. */
|
|
100
|
+
minHeight?: number;
|
|
93
101
|
/** Bar layout direction. Defaults to "vertical". */
|
|
94
102
|
orientation?: BarChartOrientation;
|
|
95
103
|
/** Multi-series layout mode. Defaults to "grouped". */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
export type ChartDimension = number | string;
|
|
3
|
+
export type ChartResponsiveSizeOptions = {
|
|
4
|
+
width?: ChartDimension;
|
|
5
|
+
height?: ChartDimension;
|
|
6
|
+
responsive?: boolean;
|
|
7
|
+
aspectRatio?: number;
|
|
8
|
+
defaultWidth: number;
|
|
9
|
+
defaultHeight: number;
|
|
10
|
+
minWidth: number;
|
|
11
|
+
minHeight: number;
|
|
12
|
+
};
|
|
13
|
+
export type ResolvedChartSize = {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
widthStyle?: string;
|
|
17
|
+
heightStyle?: string;
|
|
18
|
+
fillAvailableWidth: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare const useChartResponsiveSize: (ref: RefObject<HTMLElement | null>, { width, height, responsive, aspectRatio, defaultWidth, defaultHeight, minWidth, minHeight, }: ChartResponsiveSizeOptions) => ResolvedChartSize;
|