@monolith-forensics/monolith-ui 1.8.1-dev.4 → 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.
Files changed (170) hide show
  1. package/dist/Button/Button.js +58 -9
  2. package/dist/Calendar/Calendar.d.ts +2 -7
  3. package/dist/Calendar/Calendar.js +49 -226
  4. package/dist/Calendar/CalendarStyles.d.ts +2 -6
  5. package/dist/Calendar/CalendarStyles.js +33 -153
  6. package/dist/Calendar/calendarHelpers.d.ts +2 -6
  7. package/dist/Calendar/calendarHelpers.js +5 -13
  8. package/dist/Charts/BarChart/BarChart.js +28 -14
  9. package/dist/Charts/BarChart/BarChart.styled.d.ts +7 -2
  10. package/dist/Charts/BarChart/BarChart.styled.js +5 -1
  11. package/dist/Charts/BarChart/BarChart.types.d.ts +13 -5
  12. package/dist/Charts/ChartUtils/chartSizing.d.ts +20 -0
  13. package/dist/Charts/ChartUtils/chartSizing.js +83 -0
  14. package/dist/Charts/ChartUtils/index.d.ts +1 -0
  15. package/dist/Charts/ChartUtils/index.js +1 -0
  16. package/dist/Charts/HeatMap/HeatMap.js +28 -7
  17. package/dist/Charts/HeatMap/HeatMap.styled.d.ts +6 -2
  18. package/dist/Charts/HeatMap/HeatMap.styled.js +3 -0
  19. package/dist/Charts/HeatMap/HeatMap.types.d.ts +7 -1
  20. package/dist/Charts/LineChart/LineChart.js +34 -15
  21. package/dist/Charts/LineChart/LineChart.styled.d.ts +7 -2
  22. package/dist/Charts/LineChart/LineChart.styled.js +5 -1
  23. package/dist/Charts/LineChart/LineChart.types.d.ts +13 -5
  24. package/dist/Charts/PieChart/PieChart.js +48 -33
  25. package/dist/Charts/PieChart/PieChart.styled.d.ts +7 -2
  26. package/dist/Charts/PieChart/PieChart.styled.js +6 -1
  27. package/dist/Charts/PieChart/PieChart.types.d.ts +7 -3
  28. package/dist/CheckBox/CheckBox.js +19 -36
  29. package/dist/DateInput/DateInput.js +143 -198
  30. package/dist/DropDownMenu/DropDownMenu.js +15 -25
  31. package/dist/DropDownMenu/components/MenuComponent.js +2 -8
  32. package/dist/DropDownMenu/components/MenuItem.d.ts +0 -2
  33. package/dist/DropDownMenu/components/MenuItem.js +21 -25
  34. package/dist/DropDownMenu/components/MenuItemList.d.ts +0 -3
  35. package/dist/DropDownMenu/components/MenuItemList.js +86 -192
  36. package/dist/DropDownMenu/components/StyledContent.js +2 -1
  37. package/dist/DropDownMenu/components/StyledFloatContainer.js +1 -1
  38. package/dist/DropDownMenu/types.d.ts +0 -3
  39. package/dist/FieldLabel/FieldLabel.js +12 -4
  40. package/dist/FileInputField/FileInputField.js +23 -4
  41. package/dist/FileViewer/viewers/ImageViewer.js +18 -75
  42. package/dist/FormSection/FormSection.js +25 -5
  43. package/dist/IconButton/IconButton.js +16 -2
  44. package/dist/Input/Input.js +56 -7
  45. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +4 -1
  46. package/dist/Pill/Pill.js +79 -8
  47. package/dist/Popover/Popover.context.d.ts +1 -2
  48. package/dist/Popover/Popover.js +2 -5
  49. package/dist/Popover/Popover.styles.d.ts +6 -1
  50. package/dist/Popover/Popover.styles.js +28 -11
  51. package/dist/Popover/Popover.transitions.d.ts +2 -4
  52. package/dist/Popover/Popover.transitions.js +49 -23
  53. package/dist/Popover/PopoverDropdown.js +8 -6
  54. package/dist/Popover/PopoverTarget.js +3 -6
  55. package/dist/QueryFilter/DefaultOperators.d.ts +76 -0
  56. package/dist/QueryFilter/DefaultOperators.js +21 -0
  57. package/dist/QueryFilter/QueryFilter.d.ts +1 -1
  58. package/dist/QueryFilter/QueryFilter.js +303 -3
  59. package/dist/QueryFilter/index.d.ts +2 -3
  60. package/dist/QueryFilter/index.js +2 -3
  61. package/dist/QueryFilter/types.d.ts +52 -0
  62. package/dist/QueryFilter/types.js +1 -0
  63. package/dist/QueryFilter/useQueryFilter.d.ts +1 -1
  64. package/dist/QueryFilter/useQueryFilter.js +19 -23
  65. package/dist/RichTextEditor/Components/CodeBlockBaseButton.d.ts +18 -0
  66. package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +6 -0
  67. package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +9 -0
  68. package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +42 -0
  69. package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +10 -0
  70. package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +60 -0
  71. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +9 -0
  72. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +30 -0
  73. package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +3 -0
  74. package/dist/RichTextEditor/Components/CodeBlockNodeView.js +28 -0
  75. package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +10 -0
  76. package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +17 -0
  77. package/dist/RichTextEditor/Components/LinkEditor.d.ts +8 -0
  78. package/dist/RichTextEditor/Components/LinkEditor.js +94 -0
  79. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +2 -0
  80. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +19 -0
  81. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +2 -0
  82. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +24 -0
  83. package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +2 -0
  84. package/dist/RichTextEditor/Components/TableTools/TableRails.js +180 -0
  85. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +5 -0
  86. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +6 -0
  87. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +5 -0
  88. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +183 -0
  89. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +16 -0
  90. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +217 -0
  91. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +8 -0
  92. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +11 -0
  93. package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +3 -0
  94. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +23 -0
  95. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +75 -0
  96. package/dist/RichTextEditor/Components/TableTools/TableTools.js +3 -0
  97. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +16 -0
  98. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +53 -0
  99. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +40 -0
  100. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +167 -0
  101. package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +76 -0
  102. package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +1 -0
  103. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +4 -0
  104. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +4 -0
  105. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +2 -0
  106. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +12 -0
  107. package/dist/RichTextEditor/Components/TableTools/index.d.ts +3 -0
  108. package/dist/RichTextEditor/Components/TableTools/index.js +2 -0
  109. package/dist/RichTextEditor/Enums/HighlightColors.d.ts +9 -0
  110. package/dist/RichTextEditor/Enums/HighlightColors.js +10 -0
  111. package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +15 -5
  112. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +4 -7
  113. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.d.ts +0 -15
  114. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +51 -115
  115. package/dist/RichTextEditor/Plugins/index.d.ts +0 -1
  116. package/dist/RichTextEditor/Plugins/index.js +0 -1
  117. package/dist/RichTextEditor/RichTextEditor.d.ts +2 -3
  118. package/dist/RichTextEditor/RichTextEditor.js +35 -309
  119. package/dist/RichTextEditor/Toolbar/Toolbar.js +2 -14
  120. package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +20 -0
  121. package/dist/RichTextEditor/Utils/codeBlockUtils.js +137 -0
  122. package/dist/RichTextEditor/Utils/codeUtils.d.ts +3 -0
  123. package/dist/RichTextEditor/Utils/codeUtils.js +12 -0
  124. package/dist/RichTextEditor/Utils/linkUtils.d.ts +19 -0
  125. package/dist/RichTextEditor/Utils/linkUtils.js +57 -0
  126. package/dist/RichTextEditor/Utils/tableUtils.d.ts +1 -0
  127. package/dist/RichTextEditor/Utils/tableUtils.js +1 -0
  128. package/dist/SegmentedControl/SegmentedControl.utils.d.ts +2 -2
  129. package/dist/SegmentedControl/SegmentedControl.utils.js +30 -3
  130. package/dist/SelectBox/SelectBox.js +5 -5
  131. package/dist/SelectBox/select-box.styled-components.d.ts +1 -4
  132. package/dist/SelectBox/select-box.styled-components.js +48 -11
  133. package/dist/SelectBox/types.d.ts +0 -1
  134. package/dist/Switch/Switch.d.ts +2 -2
  135. package/dist/Switch/Switch.js +83 -18
  136. package/dist/Table/ColumnResizer.d.ts +9 -6
  137. package/dist/Table/ColumnResizer.js +10 -30
  138. package/dist/Table/StateStorage.d.ts +0 -4
  139. package/dist/Table/StateStorage.js +0 -13
  140. package/dist/Table/Table.js +12 -160
  141. package/dist/Table/TableComponents.d.ts +0 -10
  142. package/dist/Table/TableComponents.js +10 -71
  143. package/dist/Table/TableDefaults.d.ts +0 -7
  144. package/dist/Table/TableDefaults.js +0 -7
  145. package/dist/Table/TableHeader.js +16 -31
  146. package/dist/Table/TableMenu/TableMenu.js +1 -1
  147. package/dist/Table/TableProvider.js +75 -354
  148. package/dist/Table/TableRow.js +16 -28
  149. package/dist/Table/Utils/index.d.ts +1 -0
  150. package/dist/Table/Utils/index.js +1 -0
  151. package/dist/Table/Utils/resizeHandler.d.ts +3 -0
  152. package/dist/Table/Utils/resizeHandler.js +84 -0
  153. package/dist/Table/types.d.ts +19 -70
  154. package/dist/TagBox/TagBox.d.ts +1 -1
  155. package/dist/TagBox/TagBox.js +80 -22
  156. package/dist/TagBox/types.d.ts +0 -1
  157. package/dist/TextArea/TextArea.js +23 -9
  158. package/dist/TextInput/TextInput.js +6 -12
  159. package/dist/Utilities/parseTimestamp.js +6 -11
  160. package/dist/core/ArrowButton.d.ts +0 -2
  161. package/dist/core/ArrowButton.js +3 -7
  162. package/dist/core/ClearButton.d.ts +0 -2
  163. package/dist/core/ClearButton.js +3 -7
  164. package/dist/core/controlSizes.js +9 -9
  165. package/dist/core/index.d.ts +0 -1
  166. package/dist/core/index.js +0 -1
  167. package/dist/index.d.ts +0 -3
  168. package/dist/index.js +0 -2
  169. package/dist/theme/variants.js +8 -2
  170. package/package.json +18 -26
@@ -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
- width: 268px;
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, 32px);
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: 8px 4px;
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
- min-width: 32px;
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: 11px;
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: 11px;
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
- cursor: not-allowed;
120
- color: ${({ theme }) => theme.palette.text.secondary};
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: ${(props) => `${props.theme.palette.primary.main}14`} !important;
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
- left: 50%;
162
- bottom: 3px;
163
- width: 4px;
164
- height: 4px;
165
- border-radius: 999px;
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) => `${props.theme.palette.primary.main}20`} !important;
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: 132px;
179
- height: auto;
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: 238px;
105
+ height: 100%;
189
106
  `;
190
107
  export const TimeHeader = styled.div `
191
- box-sizing: border-box;
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: 6px 5px;
198
- line-height: 1.25;
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 TimeZoneBadge = styled.span `
210
- padding: 2px 5px;
211
- border-radius: 4px;
212
- background: ${(props) => props.theme.palette.action.hover};
213
- color: ${(props) => props.theme.palette.text.secondary};
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 TimeSelectList = styled.div `
220
- flex: 1 1 auto;
221
- min-height: 0;
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: 11px;
131
+ font-size: 10px;
228
132
  color: ${(props) => props.theme.palette.text.primary};
229
133
  text-align: center;
230
- padding: 6px 5px;
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 createLocalDate: (year: number, month: number, day: number) => Date;
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: displayHour < 10 ? `0${displayHour} AM` : `${displayHour} AM`,
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: displayHour < 10 ? `0${displayHour} PM` : `${displayHour} PM`,
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 && (year % 100 !== 0 || year % 400 === 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 createLocalDate(year, month, 1).getDay() + 1;
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 = 640, height = 320, 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", "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"]);
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 safeWidth = Math.max(width, 180);
73
- const safeHeight = Math.max(height, 180);
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) => { var _a; return (_a = valueFormatter === null || valueFormatter === void 0 ? void 0 : valueFormatter(datum.value, datum, sourceSeries)) !== null && _a !== void 0 ? _a : formatDefaultValue(datum.value); };
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 })) : (_jsx(StyledChartScroller, { children: _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 &&
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 + (endPosition - zeroPosition) * animationProgress;
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
- })] })] }) })), 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
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").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
- export declare const StyledChartScroller: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
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?: number;
91
- /** SVG height in pixels. Defaults to 320. */
92
- height?: number;
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;