@addev-be/ui 0.14.5 → 0.15.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 (215) hide show
  1. package/assets/icons/arrow-down-1-9.svg +1 -1
  2. package/assets/icons/arrow-down-a-z.svg +1 -1
  3. package/assets/icons/arrow-up-z-a.svg +1 -1
  4. package/assets/icons/check.svg +1 -1
  5. package/assets/icons/circle-check.svg +1 -1
  6. package/assets/icons/down.svg +1 -1
  7. package/assets/icons/filter-full.svg +1 -1
  8. package/assets/icons/filter.svg +1 -1
  9. package/assets/icons/hashtag.svg +1 -1
  10. package/assets/icons/image-slash.svg +1 -1
  11. package/assets/icons/left.svg +1 -1
  12. package/assets/icons/magnifier.svg +1 -1
  13. package/assets/icons/phone.svg +1 -1
  14. package/assets/icons/right.svg +1 -1
  15. package/assets/icons/sort-calendar-ascending.svg +5 -5
  16. package/assets/icons/spinner-third.svg +1 -1
  17. package/assets/icons/table-columns.svg +1 -1
  18. package/assets/icons/table-footer-slash.svg +4 -4
  19. package/assets/icons/table-footer.svg +3 -3
  20. package/assets/icons/up.svg +1 -1
  21. package/assets/icons/user-tie.svg +1 -1
  22. package/assets/icons/x-bar.svg +3 -3
  23. package/dist/components/auth/LoginForm.js +0 -1
  24. package/dist/components/data/DataGrid/AdvancedRequestDataGrid.d.ts +10 -0
  25. package/dist/components/data/DataGrid/AdvancedRequestDataGrid.js +173 -0
  26. package/dist/components/data/DataGrid/FilterValuesScroller.d.ts +13 -0
  27. package/dist/components/data/DataGrid/FilterValuesScroller.js +73 -0
  28. package/dist/components/data/DataGrid/VirtualScroller.d.ts +11 -0
  29. package/dist/components/data/DataGrid/VirtualScroller.js +41 -0
  30. package/dist/components/data/DataGrid/helpers/advancedRequests.d.ts +12 -0
  31. package/dist/components/data/DataGrid/helpers/advancedRequests.js +53 -0
  32. package/dist/components/data/DataGrid/helpers.d.ts +28 -0
  33. package/dist/components/data/DataGrid/helpers.js +436 -0
  34. package/dist/config/types.d.ts +11 -0
  35. package/dist/config/types.js +2 -0
  36. package/dist/providers/AuthenticationProvider/index.d.ts +0 -1
  37. package/dist/providers/AuthenticationProvider/index.js +14 -28
  38. package/dist/services/advancedRequests.d.ts +1 -1
  39. package/dist/services/requests/userPermissions.d.ts +4 -0
  40. package/dist/services/requests/userPermissions.js +20 -0
  41. package/dist/services/sqlRequests.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/src/Icons.tsx +134 -134
  44. package/src/components/auth/LoginForm.tsx +84 -84
  45. package/src/components/auth/LoginPage.tsx +32 -32
  46. package/src/components/auth/PasswordRecoveryForm.tsx +52 -52
  47. package/src/components/auth/PasswordResetForm.tsx +112 -112
  48. package/src/components/auth/index.ts +4 -4
  49. package/src/components/auth/styles.ts +14 -14
  50. package/src/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.ts +93 -93
  51. package/src/components/data/AdvancedRequestDataGrid/helpers/columns.tsx +262 -262
  52. package/src/components/data/AdvancedRequestDataGrid/helpers/index.ts +2 -2
  53. package/src/components/data/AdvancedRequestDataGrid/index.tsx +267 -267
  54. package/src/components/data/AdvancedRequestDataGrid/types.ts +47 -47
  55. package/src/components/data/DataGrid/DataGridCell.tsx +83 -77
  56. package/src/components/data/DataGrid/DataGridColumnsModal/helpers.ts +9 -9
  57. package/src/components/data/DataGrid/DataGridColumnsModal/hooks.tsx +59 -59
  58. package/src/components/data/DataGrid/DataGridColumnsModal/index.tsx +182 -182
  59. package/src/components/data/DataGrid/DataGridColumnsModal/styles.ts +104 -104
  60. package/src/components/data/DataGrid/DataGridEditableCell/CheckboxEditableCell.tsx +38 -38
  61. package/src/components/data/DataGrid/DataGridEditableCell/DateEditableCell.tsx +39 -39
  62. package/src/components/data/DataGrid/DataGridEditableCell/NumberEditableCell.tsx +68 -68
  63. package/src/components/data/DataGrid/DataGridEditableCell/TextEditableCell.tsx +38 -38
  64. package/src/components/data/DataGrid/DataGridEditableCell/index.tsx +106 -60
  65. package/src/components/data/DataGrid/DataGridEditableCell/styles.ts +35 -0
  66. package/src/components/data/DataGrid/DataGridEditableCell/types.ts +17 -14
  67. package/src/components/data/DataGrid/DataGridFilterMenu/FilterValuesScroller.tsx +131 -131
  68. package/src/components/data/DataGrid/DataGridFilterMenu/hooks.tsx +81 -81
  69. package/src/components/data/DataGrid/DataGridFilterMenu/index.tsx +376 -376
  70. package/src/components/data/DataGrid/DataGridFilterMenu/styles.ts +97 -97
  71. package/src/components/data/DataGrid/DataGridFooter.tsx +45 -45
  72. package/src/components/data/DataGrid/DataGridHeader.tsx +173 -173
  73. package/src/components/data/DataGrid/DataGridHeaderCell.tsx +115 -115
  74. package/src/components/data/DataGrid/DataGridRowTemplate.tsx +80 -78
  75. package/src/components/data/DataGrid/FilterModalContent/index.tsx +136 -136
  76. package/src/components/data/DataGrid/FilterModalContent/styles.ts +22 -22
  77. package/src/components/data/DataGrid/constants.ts +6 -6
  78. package/src/components/data/DataGrid/helpers/columns.tsx +384 -383
  79. package/src/components/data/DataGrid/helpers/filters.ts +287 -287
  80. package/src/components/data/DataGrid/helpers/index.ts +2 -2
  81. package/src/components/data/DataGrid/hooks/index.ts +29 -29
  82. package/src/components/data/DataGrid/hooks/useDataGrid.tsx +378 -411
  83. package/src/components/data/DataGrid/hooks/useDataGridChangedRows.ts +56 -56
  84. package/src/components/data/DataGrid/hooks/useDataGridCopy.ts +174 -174
  85. package/src/components/data/DataGrid/hooks/useDataGridSettings.ts +48 -48
  86. package/src/components/data/DataGrid/index.tsx +110 -110
  87. package/src/components/data/DataGrid/styles.ts +369 -390
  88. package/src/components/data/DataGrid/types.ts +367 -355
  89. package/src/components/data/SmartQueryDataGrid/helpers/columns.tsx +333 -333
  90. package/src/components/data/SmartQueryDataGrid/helpers/hooks.ts +41 -41
  91. package/src/components/data/SmartQueryDataGrid/helpers/index.ts +2 -2
  92. package/src/components/data/SmartQueryDataGrid/helpers/smartQueries.ts +17 -17
  93. package/src/components/data/SmartQueryDataGrid/hooks.ts +75 -75
  94. package/src/components/data/SmartQueryDataGrid/index.tsx +338 -338
  95. package/src/components/data/SmartQueryDataGrid/types.ts +45 -45
  96. package/src/components/data/SqlRequestDataGrid/SqlRequestForeignListEditableCell.tsx +16 -0
  97. package/src/components/data/SqlRequestDataGrid/helpers/columns.tsx +478 -366
  98. package/src/components/data/SqlRequestDataGrid/helpers/index.ts +2 -2
  99. package/src/components/data/SqlRequestDataGrid/helpers/sqlRequests.ts +16 -16
  100. package/src/components/data/SqlRequestDataGrid/index.tsx +402 -402
  101. package/src/components/data/SqlRequestDataGrid/styles.ts +15 -15
  102. package/src/components/data/SqlRequestDataGrid/types.ts +74 -63
  103. package/src/components/data/SqlRequestForeignList/index.tsx +259 -157
  104. package/src/components/data/SqlRequestForeignList/styles.ts +42 -38
  105. package/src/components/data/SqlRequestForeignList/types.ts +34 -0
  106. package/src/components/data/SqlRequestGrid/filters/FiltersSidebar.tsx +110 -110
  107. package/src/components/data/SqlRequestGrid/filters/styles.ts +88 -88
  108. package/src/components/data/SqlRequestGrid/helpers/index.ts +1 -1
  109. package/src/components/data/SqlRequestGrid/helpers/sqlRequests.ts +16 -16
  110. package/src/components/data/SqlRequestGrid/index.tsx +316 -316
  111. package/src/components/data/SqlRequestGrid/styles.ts +20 -20
  112. package/src/components/data/SqlRequestGrid/types.ts +75 -75
  113. package/src/components/data/VirtualScroller/hooks.ts +71 -71
  114. package/src/components/data/VirtualScroller/index.tsx +91 -89
  115. package/src/components/data/VirtualScroller/styles.ts +58 -58
  116. package/src/components/data/VirtualScroller/types.ts +12 -12
  117. package/src/components/data/index.ts +23 -23
  118. package/src/components/forms/AutoTextArea.tsx +41 -41
  119. package/src/components/forms/Button.tsx +133 -133
  120. package/src/components/forms/Form/Checkbox.tsx +13 -13
  121. package/src/components/forms/Form/FormGroup.tsx +27 -27
  122. package/src/components/forms/Form/Input.tsx +13 -13
  123. package/src/components/forms/Form/InputWithLabel.tsx +18 -18
  124. package/src/components/forms/Form/Select.tsx +76 -65
  125. package/src/components/forms/Form/TextArea.tsx +13 -13
  126. package/src/components/forms/Form/index.tsx +37 -37
  127. package/src/components/forms/Form/styles.ts +101 -101
  128. package/src/components/forms/Form/types.ts +7 -7
  129. package/src/components/forms/IconButton.tsx +57 -57
  130. package/src/components/forms/IndeterminateCheckbox.tsx +46 -46
  131. package/src/components/forms/Select.tsx +35 -35
  132. package/src/components/forms/VerticalLabel.tsx +20 -20
  133. package/src/components/forms/index.ts +8 -8
  134. package/src/components/forms/styles.ts +31 -31
  135. package/src/components/index.ts +6 -6
  136. package/src/components/layout/Columns.ts +20 -20
  137. package/src/components/layout/Dropdown/index.tsx +113 -112
  138. package/src/components/layout/Dropdown/styles.ts +45 -45
  139. package/src/components/layout/Grid/index.tsx +8 -8
  140. package/src/components/layout/Grid/styles.ts +34 -34
  141. package/src/components/layout/Loading/index.tsx +29 -29
  142. package/src/components/layout/Loading/styles.ts +29 -29
  143. package/src/components/layout/Masonry/index.tsx +29 -29
  144. package/src/components/layout/Masonry/styles.ts +20 -20
  145. package/src/components/layout/Modal/index.tsx +51 -51
  146. package/src/components/layout/Modal/styles.ts +121 -121
  147. package/src/components/layout/index.ts +6 -6
  148. package/src/components/search/HighlightedText.tsx +37 -37
  149. package/src/components/search/QuickSearchBar.tsx +86 -86
  150. package/src/components/search/QuickSearchResults.tsx +86 -86
  151. package/src/components/search/index.ts +9 -9
  152. package/src/components/search/styles.ts +96 -96
  153. package/src/components/search/types.ts +26 -26
  154. package/src/components/ui/Avatar/index.tsx +54 -54
  155. package/src/components/ui/Card/index.tsx +14 -14
  156. package/src/components/ui/Card/styles.ts +37 -37
  157. package/src/components/ui/ContextMenu/index.tsx +79 -79
  158. package/src/components/ui/ContextMenu/styles.ts +119 -119
  159. package/src/components/ui/Ellipsis.tsx +32 -0
  160. package/src/components/ui/Label.tsx +90 -90
  161. package/src/components/ui/Message/index.tsx +57 -57
  162. package/src/components/ui/Message/styles.ts +40 -40
  163. package/src/components/ui/index.ts +6 -5
  164. package/src/config/index.ts +14 -14
  165. package/src/helpers/dates.ts +17 -17
  166. package/src/helpers/getScrollbarSize.ts +14 -14
  167. package/src/helpers/index.ts +3 -3
  168. package/src/helpers/numbers.ts +63 -63
  169. package/src/helpers/text.ts +13 -13
  170. package/src/hooks/index.ts +3 -3
  171. package/src/hooks/useElementSize.ts +24 -24
  172. package/src/hooks/useShowArchived.ts +28 -28
  173. package/src/hooks/useWindowSize.ts +20 -20
  174. package/src/index.ts +9 -9
  175. package/src/providers/AuthenticationProvider/helpers.ts +3 -3
  176. package/src/providers/AuthenticationProvider/index.tsx +243 -243
  177. package/src/providers/LoadingProvider/index.tsx +47 -47
  178. package/src/providers/PortalsProvider/index.tsx +54 -54
  179. package/src/providers/PortalsProvider/styles.ts +31 -31
  180. package/src/providers/SettingsProvider/index.tsx +70 -70
  181. package/src/providers/ThemeProvider/ThemeProvider.ts +63 -63
  182. package/src/providers/ThemeProvider/defaultTheme.ts +457 -457
  183. package/src/providers/ThemeProvider/helpers.ts +11 -11
  184. package/src/providers/ThemeProvider/index.ts +4 -4
  185. package/src/providers/ThemeProvider/types.ts +131 -131
  186. package/src/providers/TrackingProvider/index.tsx +71 -71
  187. package/src/providers/UiProviders/index.tsx +68 -68
  188. package/src/providers/UiProviders/styles.ts +10 -10
  189. package/src/providers/hooks.ts +12 -12
  190. package/src/providers/index.ts +8 -8
  191. package/src/services/HttpService.ts +92 -92
  192. package/src/services/WebSocketService.ts +137 -137
  193. package/src/services/advancedRequests.ts +102 -102
  194. package/src/services/base.ts +23 -23
  195. package/src/services/globalSearch.ts +29 -29
  196. package/src/services/hooks.ts +44 -44
  197. package/src/services/index.ts +21 -21
  198. package/src/services/requests/auth.ts +44 -44
  199. package/src/services/requests/generic.ts +62 -62
  200. package/src/services/requests/tracking.ts +12 -12
  201. package/src/services/requests/userProfiles.ts +35 -35
  202. package/src/services/requests/users.ts +28 -28
  203. package/src/services/smartQueries.ts +122 -122
  204. package/src/services/sqlRequests.ts +111 -111
  205. package/src/services/types/auth.ts +131 -131
  206. package/src/services/types/base.ts +10 -10
  207. package/src/services/types/generic.ts +96 -96
  208. package/src/services/types/tracking.ts +39 -39
  209. package/src/services/types/userProfiles.ts +107 -107
  210. package/src/services/types/users.ts +106 -106
  211. package/src/services/updateSqlRequests.ts +34 -34
  212. package/src/styles/animations.scss +30 -30
  213. package/src/styles/index.scss +42 -42
  214. package/src/typings.d.ts +13 -13
  215. package/tsconfig.json +18 -18
@@ -1,390 +1,369 @@
1
- import {
2
- DEFAULT_FOOTER_ROW_HEIGHT,
3
- DEFAULT_HEADER_ROW_HEIGHT,
4
- DEFAULT_ROW_HEIGHT,
5
- SELECTION_CELL_WIDTH,
6
- TOOLBAR_HEIGHT,
7
- } from './constants';
8
- import styled, { css } from 'styled-components';
9
-
10
- import { DataGridCellFCProps } from './types';
11
- import { ThemeColor } from '../../../providers/ThemeProvider/types';
12
- import { VirtualScrollerFiller } from '../VirtualScroller/styles';
13
-
14
- export const DataGridResizeGrip = styled.div<{ $headerColor?: ThemeColor }>`
15
- position: absolute;
16
- top: 0;
17
- right: 0;
18
- width: var(--space-1);
19
- height: 100%;
20
-
21
- ${({ $headerColor }) =>
22
- $headerColor
23
- ? css`
24
- background-color: var(--color-${$headerColor}-400);
25
- &:hover,
26
- &.active {
27
- background-color: var(--color-${$headerColor}-500);
28
- }
29
- `
30
- : css`
31
- background-color: var(--color-neutral-400);
32
- &:hover,
33
- &.active {
34
- background-color: var(--color-neutral-500);
35
- }
36
- `}
37
-
38
- cursor: col-resize;
39
- display: none;
40
- `;
41
-
42
- type DataGridHeaderCellContainerProps = {
43
- $isResizing?: boolean;
44
- $headerColor?: ThemeColor;
45
- };
46
-
47
- export const DataGridHeaderCellContainer = styled.div<DataGridHeaderCellContainerProps>`
48
- align-items: center;
49
- display: flex;
50
- flex-wrap: nowrap;
51
- font-weight: var(--font-bold);
52
- gap: var(--space-1);
53
- height: 100%;
54
- user-select: none;
55
- line-height: 1.5rem;
56
- padding: 0 0.75rem;
57
- position: relative;
58
-
59
- z-index: ${({ $isResizing }) => ($isResizing ? 1 : 0)};
60
-
61
- ${({ $headerColor }) =>
62
- $headerColor
63
- ? css`
64
- background-color: var(--color-${$headerColor}-200);
65
- color: var(--color-${$headerColor}-950);
66
- &:hover {
67
- background-color: var(--color-${$headerColor}-300);
68
- }
69
-
70
- & > button {
71
- background-color: var(--color-${$headerColor}-400);
72
- border-color: var(--color-${$headerColor}-500);
73
- &:hover {
74
- background-color: var(--color-${$headerColor}-500);
75
- border-color: var(--color-${$headerColor}-600);
76
- }
77
- }
78
- & > button.danger {
79
- background-color: var(--color-red-400);
80
- border-color: var(--color-red-500);
81
- &:hover {
82
- background-color: var(--color-red-500);
83
- border-color: var(--color-red-600);
84
- }
85
- }
86
- `
87
- : css`
88
- background-color: var(--color-neutral-200);
89
- color: var(--color-neutral-950);
90
- &:hover {
91
- background-color: var(--color-neutral-300);
92
- }
93
- `}
94
-
95
- &:hover {
96
- ${DataGridResizeGrip} {
97
- display: block;
98
- }
99
- }
100
-
101
- & > span {
102
- display: inline-block;
103
- text-overflow: ellipsis;
104
- overflow: hidden;
105
- white-space: nowrap;
106
- flex: 1;
107
- font-weight: bold;
108
- }
109
- `;
110
- DataGridHeaderCellContainer.displayName = 'DataGridHeaderCellContainer';
111
-
112
- export const DataGridHeaderTextContainer = styled.div`
113
- display: flex;
114
- flex: 1;
115
- line-height: 1rem;
116
- align-items: center;
117
- font-size: var(--text-md);
118
- max-height: 100%;
119
- `;
120
-
121
- export const DataGridCell = styled.div<DataGridCellFCProps>`
122
- position: relative;
123
- padding: 0 var(--space-3);
124
- overflow: hidden;
125
- text-overflow: ellipsis;
126
- user-select: ${({ $userSelect }) => ($userSelect ? 'text' : 'none')};
127
- white-space: nowrap;
128
- border-right: 1px solid var(--color-neutral-200);
129
- border-bottom: 1px solid var(--color-neutral-200);
130
- background-color: ${({ $color = 'neutral' }) => `var(--color-${$color}-50)`};
131
- text-align: ${({ $textAlign = 'left' }) => $textAlign};
132
- `;
133
- DataGridCell.displayName = 'DataGridCell';
134
-
135
- export const DataGridHeaderTitle = styled.div`
136
- white-space: normal;
137
- font-weight: var(--font-bold);
138
- color: var(--color-neutral-900);
139
- height: auto;
140
- `;
141
-
142
- export const DataGridToolsRow = styled.div`
143
- grid-column-start: 1;
144
- grid-column-end: -1;
145
- grid-row: 1;
146
- display: flex;
147
- background-color: var(--color-neutral-200);
148
- position: sticky;
149
- top: 0;
150
- z-index: 10;
151
- `;
152
-
153
- export const DataGridToolsRowButtonsContainer = styled.div`
154
- display: inline-flex;
155
- gap: var(--space-1);
156
- align-items: center;
157
- padding: 0 var(--space-1);
158
- position: sticky;
159
- left: 0;
160
- `;
161
-
162
- export const DataGridContainer = styled.div<{
163
- $headerRowHeight?: number;
164
- $rowHeight?: number;
165
- $rowsCount: number;
166
- $showToolsHeader?: boolean;
167
- $withFooter?: boolean;
168
- $fixedColumnWidths?: (string | number)[];
169
- }>`
170
- display: grid;
171
- width: 100%;
172
- height: 100%;
173
- background-color: var(--color-neutral-50);
174
- font-size: var(--text-base);
175
- overflow: scroll;
176
- grid-template-rows: ${({
177
- $headerRowHeight = DEFAULT_HEADER_ROW_HEIGHT,
178
- $withFooter = false,
179
- }) =>
180
- `${TOOLBAR_HEIGHT}px ${$headerRowHeight}px auto ${
181
- $withFooter ? DEFAULT_FOOTER_ROW_HEIGHT + 'px' : ''
182
- }`};
183
-
184
- ${DataGridToolsRow} {
185
- height: ${TOOLBAR_HEIGHT}px;
186
- }
187
- ${DataGridHeaderCellContainer} {
188
- position: sticky;
189
- top: ${({ $headerRowHeight = DEFAULT_HEADER_ROW_HEIGHT }) =>
190
- `${$headerRowHeight}px`};
191
- height: ${({ $headerRowHeight = DEFAULT_HEADER_ROW_HEIGHT }) =>
192
- `${$headerRowHeight}px`};
193
- }
194
- ${DataGridCell} {
195
- height: ${({ $rowHeight = DEFAULT_ROW_HEIGHT }) => `${$rowHeight}px`};
196
- line-height: ${({ $rowHeight = DEFAULT_ROW_HEIGHT }) => `${$rowHeight}px`};
197
- box-sizing: border-box;
198
- }
199
-
200
- ${({ $fixedColumnWidths = [] }) =>
201
- $fixedColumnWidths.map(
202
- (width, i) => `
203
- ${DataGridHeaderCellContainer}:nth-child(${i + 1}) {
204
- position: sticky;
205
- left: ${
206
- i === 0
207
- ? '0'
208
- : `calc(${$fixedColumnWidths
209
- .slice(0, i)
210
- .map((w) => (typeof w === 'number' ? `${w}px` : w))
211
- .join(' + ')})`
212
- };
213
- background-color: var(--color-neutral-200);
214
- z-index: 1;
215
- }`
216
- )}
217
-
218
- ${({ $fixedColumnWidths = [] }) =>
219
- $fixedColumnWidths.map(
220
- (width, i) => `
221
- ${DataGridCell}:nth-child(${i + 1}) {
222
- position: sticky;
223
- left: ${
224
- i === 0
225
- ? '0'
226
- : `calc(${$fixedColumnWidths
227
- .slice(0, i)
228
- .map((w) => (typeof w === 'number' ? `${w}px` : w))
229
- .join(' + ')})`
230
- };
231
- background-color: var(--color-neutral-50);
232
- z-index: 1;
233
- }`
234
- )}
235
-
236
- ${VirtualScrollerFiller} {
237
- grid-column-start: 1;
238
- grid-column-end: -1;
239
- grid-row: 3;
240
- }
241
- `;
242
- DataGridContainer.displayName = 'DataGridContainer';
243
-
244
- type DataGridHeaderOrFooterRowProps = {
245
- $headerRowHeight?: number;
246
- $headerColor?: ThemeColor;
247
- $gridTemplateColumns: string;
248
- };
249
-
250
- const dataGridHeaderOrFooterRowCss = css<DataGridHeaderOrFooterRowProps>`
251
- display: grid;
252
- grid-template-rows: ${({ $headerRowHeight = DEFAULT_HEADER_ROW_HEIGHT }) =>
253
- `${$headerRowHeight}px`};
254
- z-index: 10;
255
- position: sticky;
256
- align-items: center;
257
-
258
- ${({ $headerColor }) =>
259
- $headerColor
260
- ? css`
261
- background-color: var(--color-${$headerColor}-100);
262
- color: var(--color-${$headerColor}-900);
263
- `
264
- : css`
265
- background-color: var(--color-neutral-200);
266
- color: var(--color-neutral-900);
267
- `}
268
- `;
269
-
270
- export const DataGridHeaderRow = styled.div.attrs<DataGridHeaderOrFooterRowProps>(
271
- ({ $gridTemplateColumns }) => ({
272
- style: {
273
- gridTemplateColumns: $gridTemplateColumns,
274
- },
275
- })
276
- )`
277
- ${dataGridHeaderOrFooterRowCss}
278
- top: ${TOOLBAR_HEIGHT}px;
279
- `;
280
- DataGridHeaderRow.displayName = 'DataGridHeaderRow';
281
-
282
- export const DataGridFooterRow = styled.div.attrs<DataGridHeaderOrFooterRowProps>(
283
- ({ $gridTemplateColumns }) => ({
284
- style: {
285
- gridTemplateColumns: $gridTemplateColumns,
286
- },
287
- })
288
- )`
289
- ${dataGridHeaderOrFooterRowCss}
290
- bottom: 0;
291
- `;
292
- DataGridFooterRow.displayName = 'DataGridFooterRow';
293
-
294
- type DataGridRowProps = {
295
- $edited?: boolean;
296
- };
297
-
298
- export const DataGridRow = styled.div<DataGridRowProps>`
299
- display: contents;
300
-
301
- ${({ $edited }) =>
302
- $edited &&
303
- css`
304
- & > ${DataGridCell}, & > ${SelectionCell} {
305
- background-color: var(--color-warning-100);
306
- color: var(--color-warning-900);
307
- }
308
- `}
309
- `;
310
- DataGridRow.displayName = 'DataGridRow';
311
-
312
- export const LoadingCell = styled(DataGridCell)`
313
- padding: var(--space-2);
314
- box-sizing: border-box;
315
-
316
- &.animate-pulse > div {
317
- background-color: var(--color-neutral-200);
318
- border-radius: var(--rounded-full);
319
- width: 100%;
320
- height: 100%;
321
- }
322
- `;
323
- LoadingCell.displayName = 'LoadingCell';
324
-
325
- const selectionCellStyle = css`
326
- display: flex;
327
- align-items: center;
328
- justify-content: center;
329
- width: var(--space-8);
330
- padding: 0 var(--space-1);
331
- cursor: pointer;
332
-
333
- & > input[type='checkbox'] {
334
- height: var(--space-4);
335
- width: ${SELECTION_CELL_WIDTH};
336
- border-radius: var(--rounded-sm);
337
- border: 1px solid var(--color-neutral-300);
338
- color: var(--color-primary-600);
339
- }
340
- `;
341
-
342
- export const SelectionCell = styled(DataGridCell)`
343
- ${selectionCellStyle}
344
- `;
345
- SelectionCell.displayName = 'SelectionCell';
346
-
347
- export const HeaderSelectionCell = styled(DataGridHeaderCellContainer)`
348
- ${selectionCellStyle}
349
- padding: 0;
350
- `;
351
- HeaderSelectionCell.displayName = 'HeaderSelectionCell';
352
-
353
- export const ResizeBackdrop = styled.div.attrs({
354
- className: 'ResizeBackdrop',
355
- })`
356
- position: fixed;
357
- top: 0;
358
- left: 0;
359
- right: 0;
360
- bottom: 0;
361
- background-color: rgba(0, 0, 0, 0);
362
- cursor: col-resize;
363
- z-index: 100;
364
- `;
365
- ResizeBackdrop.displayName = 'ResizeBackdrop';
366
-
367
- export const EditableCellContainer = styled.div<{
368
- $textAlign?: 'left' | 'right' | 'center';
369
- }>`
370
- position: relative;
371
- & input,
372
- & select {
373
- position: absolute;
374
- inset: 0;
375
- z-index: 10;
376
-
377
- font-size: inherit;
378
- font-family: inherit;
379
- font-weight: inherit;
380
- text-align: ${({ $textAlign = 'left' }) => $textAlign};
381
-
382
- border: 1px solid var(--color-neutral-300);
383
- padding: var(--space-1) var(--space-2);
384
-
385
- color: var(--color-neutral-900);
386
- &::placeholder {
387
- color: var(--color-neutral-400);
388
- }
389
- }
390
- `;
1
+ import {
2
+ DEFAULT_FOOTER_ROW_HEIGHT,
3
+ DEFAULT_HEADER_ROW_HEIGHT,
4
+ DEFAULT_ROW_HEIGHT,
5
+ SELECTION_CELL_WIDTH,
6
+ TOOLBAR_HEIGHT,
7
+ } from './constants';
8
+ import styled, { css } from 'styled-components';
9
+
10
+ import { DataGridCellFCProps } from './types';
11
+ import { ThemeColor } from '../../../providers/ThemeProvider/types';
12
+ import { VirtualScrollerFiller } from '../VirtualScroller/styles';
13
+
14
+ export const DataGridResizeGrip = styled.div<{ $headerColor?: ThemeColor }>`
15
+ position: absolute;
16
+ top: 0;
17
+ right: 0;
18
+ width: var(--space-1);
19
+ height: 100%;
20
+
21
+ ${({ $headerColor }) =>
22
+ $headerColor
23
+ ? css`
24
+ background-color: var(--color-${$headerColor}-400);
25
+ &:hover,
26
+ &.active {
27
+ background-color: var(--color-${$headerColor}-500);
28
+ }
29
+ `
30
+ : css`
31
+ background-color: var(--color-neutral-400);
32
+ &:hover,
33
+ &.active {
34
+ background-color: var(--color-neutral-500);
35
+ }
36
+ `}
37
+
38
+ cursor: col-resize;
39
+ display: none;
40
+ `;
41
+
42
+ type DataGridHeaderCellContainerProps = {
43
+ $isResizing?: boolean;
44
+ $headerColor?: ThemeColor;
45
+ };
46
+
47
+ export const DataGridHeaderCellContainer = styled.div<DataGridHeaderCellContainerProps>`
48
+ align-items: center;
49
+ display: flex;
50
+ flex-wrap: nowrap;
51
+ font-weight: var(--font-bold);
52
+ gap: var(--space-1);
53
+ height: 100%;
54
+ user-select: none;
55
+ line-height: 1.5rem;
56
+ padding: 0 0.75rem;
57
+ position: relative;
58
+
59
+ z-index: ${({ $isResizing }) => ($isResizing ? 1 : 0)};
60
+
61
+ ${({ $headerColor }) =>
62
+ $headerColor
63
+ ? css`
64
+ background-color: var(--color-${$headerColor}-200);
65
+ color: var(--color-${$headerColor}-950);
66
+ &:hover {
67
+ background-color: var(--color-${$headerColor}-300);
68
+ }
69
+
70
+ & > button {
71
+ background-color: var(--color-${$headerColor}-400);
72
+ border-color: var(--color-${$headerColor}-500);
73
+ &:hover {
74
+ background-color: var(--color-${$headerColor}-500);
75
+ border-color: var(--color-${$headerColor}-600);
76
+ }
77
+ }
78
+ & > button.danger {
79
+ background-color: var(--color-red-400);
80
+ border-color: var(--color-red-500);
81
+ &:hover {
82
+ background-color: var(--color-red-500);
83
+ border-color: var(--color-red-600);
84
+ }
85
+ }
86
+ `
87
+ : css`
88
+ background-color: var(--color-neutral-200);
89
+ color: var(--color-neutral-950);
90
+ &:hover {
91
+ background-color: var(--color-neutral-300);
92
+ }
93
+ `}
94
+
95
+ &:hover {
96
+ ${DataGridResizeGrip} {
97
+ display: block;
98
+ }
99
+ }
100
+
101
+ & > span {
102
+ display: inline-block;
103
+ text-overflow: ellipsis;
104
+ overflow: hidden;
105
+ white-space: nowrap;
106
+ flex: 1;
107
+ font-weight: bold;
108
+ }
109
+ `;
110
+ DataGridHeaderCellContainer.displayName = 'DataGridHeaderCellContainer';
111
+
112
+ export const DataGridHeaderTextContainer = styled.div`
113
+ display: flex;
114
+ flex: 1;
115
+ line-height: 1rem;
116
+ align-items: center;
117
+ font-size: var(--text-md);
118
+ max-height: 100%;
119
+ `;
120
+
121
+ export const dataGridCellCss = css<DataGridCellFCProps>`
122
+ position: relative;
123
+ padding: 0 var(--space-3);
124
+ overflow: hidden;
125
+ text-overflow: ellipsis;
126
+ user-select: ${({ $userSelect }) => ($userSelect ? 'text' : 'none')};
127
+ white-space: nowrap;
128
+ border-right: 1px solid var(--color-neutral-200);
129
+ border-bottom: 1px solid var(--color-neutral-200);
130
+ background-color: ${({ $color = 'neutral' }) => `var(--color-${$color}-50)`};
131
+ text-align: ${({ $textAlign = 'left' }) => $textAlign};
132
+ `;
133
+
134
+ export const DataGridCell = styled.div<DataGridCellFCProps>`
135
+ ${dataGridCellCss}
136
+ `;
137
+ DataGridCell.displayName = 'DataGridCell';
138
+
139
+ export const DataGridHeaderTitle = styled.div`
140
+ white-space: normal;
141
+ font-weight: var(--font-bold);
142
+ color: var(--color-neutral-900);
143
+ height: auto;
144
+ `;
145
+
146
+ export const DataGridToolsRow = styled.div`
147
+ grid-column-start: 1;
148
+ grid-column-end: -1;
149
+ grid-row: 1;
150
+ display: flex;
151
+ background-color: var(--color-neutral-200);
152
+ position: sticky;
153
+ top: 0;
154
+ z-index: 10;
155
+ `;
156
+
157
+ export const DataGridToolsRowButtonsContainer = styled.div`
158
+ display: inline-flex;
159
+ gap: var(--space-1);
160
+ align-items: center;
161
+ padding: 0 var(--space-1);
162
+ position: sticky;
163
+ left: 0;
164
+ `;
165
+
166
+ export const DataGridContainer = styled.div<{
167
+ $headerRowHeight?: number;
168
+ $rowHeight?: number;
169
+ $rowsCount: number;
170
+ $showToolsHeader?: boolean;
171
+ $withFooter?: boolean;
172
+ $fixedColumnWidths?: (string | number)[];
173
+ }>`
174
+ display: grid;
175
+ width: 100%;
176
+ height: 100%;
177
+ background-color: var(--color-neutral-50);
178
+ font-size: var(--text-base);
179
+ overflow: scroll;
180
+ grid-template-rows: ${({
181
+ $headerRowHeight = DEFAULT_HEADER_ROW_HEIGHT,
182
+ $withFooter = false,
183
+ }) =>
184
+ `${TOOLBAR_HEIGHT}px ${$headerRowHeight}px auto ${
185
+ $withFooter ? DEFAULT_FOOTER_ROW_HEIGHT + 'px' : ''
186
+ }`};
187
+
188
+ ${DataGridToolsRow} {
189
+ height: ${TOOLBAR_HEIGHT}px;
190
+ }
191
+ ${DataGridHeaderCellContainer} {
192
+ position: sticky;
193
+ top: ${({ $headerRowHeight = DEFAULT_HEADER_ROW_HEIGHT }) =>
194
+ `${$headerRowHeight}px`};
195
+ height: ${({ $headerRowHeight = DEFAULT_HEADER_ROW_HEIGHT }) =>
196
+ `${$headerRowHeight}px`};
197
+ }
198
+ ${DataGridCell} {
199
+ height: ${({ $rowHeight = DEFAULT_ROW_HEIGHT }) => `${$rowHeight}px`};
200
+ line-height: ${({ $rowHeight = DEFAULT_ROW_HEIGHT }) => `${$rowHeight}px`};
201
+ box-sizing: border-box;
202
+ }
203
+
204
+ ${({ $fixedColumnWidths = [] }) =>
205
+ $fixedColumnWidths.map(
206
+ (width, i) => `
207
+ ${DataGridHeaderCellContainer}:nth-child(${i + 1}) {
208
+ position: sticky;
209
+ left: ${
210
+ i === 0
211
+ ? '0'
212
+ : `calc(${$fixedColumnWidths
213
+ .slice(0, i)
214
+ .map((w) => (typeof w === 'number' ? `${w}px` : w))
215
+ .join(' + ')})`
216
+ };
217
+ background-color: var(--color-neutral-200);
218
+ z-index: 1;
219
+ }`
220
+ )}
221
+
222
+ ${({ $fixedColumnWidths = [] }) =>
223
+ $fixedColumnWidths.map(
224
+ (width, i) => `
225
+ ${DataGridCell}:nth-child(${i + 1}) {
226
+ position: sticky;
227
+ left: ${
228
+ i === 0
229
+ ? '0'
230
+ : `calc(${$fixedColumnWidths
231
+ .slice(0, i)
232
+ .map((w) => (typeof w === 'number' ? `${w}px` : w))
233
+ .join(' + ')})`
234
+ };
235
+ background-color: var(--color-neutral-50);
236
+ z-index: 1;
237
+ }`
238
+ )}
239
+
240
+ ${VirtualScrollerFiller} {
241
+ grid-column-start: 1;
242
+ grid-column-end: -1;
243
+ grid-row: 3;
244
+ }
245
+ `;
246
+ DataGridContainer.displayName = 'DataGridContainer';
247
+
248
+ type DataGridHeaderOrFooterRowProps = {
249
+ $headerRowHeight?: number;
250
+ $headerColor?: ThemeColor;
251
+ $gridTemplateColumns: string;
252
+ };
253
+
254
+ const dataGridHeaderOrFooterRowCss = css<DataGridHeaderOrFooterRowProps>`
255
+ display: grid;
256
+ grid-template-rows: ${({ $headerRowHeight = DEFAULT_HEADER_ROW_HEIGHT }) =>
257
+ `${$headerRowHeight}px`};
258
+ z-index: 10;
259
+ position: sticky;
260
+ align-items: center;
261
+
262
+ ${({ $headerColor }) =>
263
+ $headerColor
264
+ ? css`
265
+ background-color: var(--color-${$headerColor}-100);
266
+ color: var(--color-${$headerColor}-900);
267
+ `
268
+ : css`
269
+ background-color: var(--color-neutral-200);
270
+ color: var(--color-neutral-900);
271
+ `}
272
+ `;
273
+
274
+ export const DataGridHeaderRow = styled.div.attrs<DataGridHeaderOrFooterRowProps>(
275
+ ({ $gridTemplateColumns }) => ({
276
+ style: {
277
+ gridTemplateColumns: $gridTemplateColumns,
278
+ },
279
+ })
280
+ )`
281
+ ${dataGridHeaderOrFooterRowCss}
282
+ top: ${TOOLBAR_HEIGHT}px;
283
+ `;
284
+ DataGridHeaderRow.displayName = 'DataGridHeaderRow';
285
+
286
+ export const DataGridFooterRow = styled.div.attrs<DataGridHeaderOrFooterRowProps>(
287
+ ({ $gridTemplateColumns }) => ({
288
+ style: {
289
+ gridTemplateColumns: $gridTemplateColumns,
290
+ },
291
+ })
292
+ )`
293
+ ${dataGridHeaderOrFooterRowCss}
294
+ bottom: 0;
295
+ `;
296
+ DataGridFooterRow.displayName = 'DataGridFooterRow';
297
+
298
+ type DataGridRowProps = {
299
+ $edited?: boolean;
300
+ };
301
+
302
+ export const DataGridRow = styled.div<DataGridRowProps>`
303
+ display: contents;
304
+
305
+ ${({ $edited }) =>
306
+ $edited &&
307
+ css`
308
+ & > ${DataGridCell}, & > ${SelectionCell} {
309
+ background-color: var(--color-warning-100);
310
+ color: var(--color-warning-900);
311
+ }
312
+ `}
313
+ `;
314
+ DataGridRow.displayName = 'DataGridRow';
315
+
316
+ export const LoadingCell = styled(DataGridCell)`
317
+ padding: var(--space-2);
318
+ box-sizing: border-box;
319
+
320
+ &.animate-pulse > div {
321
+ background-color: var(--color-neutral-200);
322
+ border-radius: var(--rounded-full);
323
+ width: 100%;
324
+ height: 100%;
325
+ }
326
+ `;
327
+ LoadingCell.displayName = 'LoadingCell';
328
+
329
+ const selectionCellStyle = css`
330
+ display: flex;
331
+ align-items: center;
332
+ justify-content: center;
333
+ width: var(--space-8);
334
+ padding: 0 var(--space-1);
335
+ cursor: pointer;
336
+
337
+ & > input[type='checkbox'] {
338
+ height: var(--space-4);
339
+ width: ${SELECTION_CELL_WIDTH};
340
+ border-radius: var(--rounded-sm);
341
+ border: 1px solid var(--color-neutral-300);
342
+ color: var(--color-primary-600);
343
+ }
344
+ `;
345
+
346
+ export const SelectionCell = styled(DataGridCell)`
347
+ ${selectionCellStyle}
348
+ `;
349
+ SelectionCell.displayName = 'SelectionCell';
350
+
351
+ export const HeaderSelectionCell = styled(DataGridHeaderCellContainer)`
352
+ ${selectionCellStyle}
353
+ padding: 0;
354
+ `;
355
+ HeaderSelectionCell.displayName = 'HeaderSelectionCell';
356
+
357
+ export const ResizeBackdrop = styled.div.attrs({
358
+ className: 'ResizeBackdrop',
359
+ })`
360
+ position: fixed;
361
+ top: 0;
362
+ left: 0;
363
+ right: 0;
364
+ bottom: 0;
365
+ background-color: rgba(0, 0, 0, 0);
366
+ cursor: col-resize;
367
+ z-index: 100;
368
+ `;
369
+ ResizeBackdrop.displayName = 'ResizeBackdrop';