@addev-be/ui 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@addev-be/ui",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "watch": "tsc -b --watch",
@@ -3,8 +3,8 @@
3
3
 
4
4
  import * as styles from './styles';
5
5
 
6
- import { MouseEvent, useCallback } from 'react';
7
6
  import { DataGridCellProps, DataGridColumn } from './types';
7
+ import { MouseEvent, useCallback } from 'react';
8
8
 
9
9
  import { DataGridEditableCell } from './DataGridEditableCell';
10
10
  import { useDataGridContext } from './hooks';
@@ -69,6 +69,7 @@ export const DataGridCell = <R,>({
69
69
  onDoubleClick={onDoubleClick}
70
70
  style={style}
71
71
  $userSelect={userSelect}
72
+ $color={column.color}
72
73
  >
73
74
  {(column.render ?? defaultRender)(row, column)}
74
75
  </DataGridCellComponent>
@@ -18,6 +18,7 @@ export const DataGridFooter = <R,>({
18
18
  selectedRows,
19
19
  sortedRows,
20
20
  selectable,
21
+ headerColor,
21
22
  footers = {},
22
23
  gridTemplateColumns,
23
24
  footerFunctions,
@@ -34,6 +35,7 @@ export const DataGridFooter = <R,>({
34
35
  <styles.DataGridHeaderCellContainer
35
36
  key={key}
36
37
  style={{ width: (col.width ?? DEFAULT_COLUMN_WIDTH) + 'px' }}
38
+ $headerColor={col.color ?? headerColor}
37
39
  >
38
40
  {footerFunctions?.[key]?.(rows, sortedRows, selectedRows)}
39
41
  </styles.DataGridHeaderCellContainer>
@@ -72,7 +72,7 @@ export const DataGridHeaderCell = <R,>({
72
72
 
73
73
  return (
74
74
  <styles.DataGridHeaderCellContainer
75
- $headerColor={headerColor}
75
+ $headerColor={column.color ?? headerColor}
76
76
  $isResizing={isResizing}
77
77
  >
78
78
  {filterDropdown}
@@ -63,6 +63,7 @@ export const DataGridRowTemplate = <R,>({
63
63
  columnIndex={index}
64
64
  context={context}
65
65
  columnKey={key}
66
+ color={col.color}
66
67
  />
67
68
  ))}
68
69
  </styles.DataGridRow>
@@ -7,6 +7,7 @@ import {
7
7
  } from './constants';
8
8
  import styled, { css } from 'styled-components';
9
9
 
10
+ import { DataGridCellFCProps } from './types';
10
11
  import { ThemeColor } from '../../../providers/ThemeProvider/types';
11
12
  import { VirtualScrollerFiller } from '../VirtualScroller/styles';
12
13
 
@@ -108,11 +109,7 @@ export const DataGridHeaderCellContainer = styled.div<DataGridHeaderCellContaine
108
109
  `;
109
110
  DataGridHeaderCellContainer.displayName = 'DataGridHeaderCellContainer';
110
111
 
111
- type DataGridCellProps = {
112
- $userSelect?: boolean;
113
- };
114
-
115
- export const DataGridCell = styled.div<DataGridCellProps>`
112
+ export const DataGridCell = styled.div<DataGridCellFCProps>`
116
113
  position: relative;
117
114
  padding: 0 var(--space-3);
118
115
  overflow: hidden;
@@ -121,6 +118,7 @@ export const DataGridCell = styled.div<DataGridCellProps>`
121
118
  white-space: nowrap;
122
119
  border-right: 1px solid var(--color-neutral-200);
123
120
  border-bottom: 1px solid var(--color-neutral-200);
121
+ background-color: ${({ $color = 'neutral' }) => `var(--color-${$color}-50)`};
124
122
  `;
125
123
  DataGridCell.displayName = 'DataGridCell';
126
124
 
@@ -318,6 +316,7 @@ SelectionCell.displayName = 'SelectionCell';
318
316
 
319
317
  export const HeaderSelectionCell = styled(DataGridHeaderCellContainer)`
320
318
  ${selectionCellStyle}
319
+ padding: 0;
321
320
  `;
322
321
  HeaderSelectionCell.displayName = 'HeaderSelectionCell';
323
322
 
@@ -16,10 +16,14 @@ import {
16
16
  import { SettingsContextProps } from '../../../providers/SettingsProvider';
17
17
  import { ThemeColor } from '../../../providers/ThemeProvider/types';
18
18
 
19
- export type DataGridCellFC = FC<{
19
+ export type DataGridCellFCProps = {
20
20
  onDoubleClick?: MouseEventHandler;
21
21
  style?: CSSProperties;
22
- }>;
22
+ $color?: ThemeColor;
23
+ $userSelect?: boolean;
24
+ };
25
+
26
+ export type DataGridCellFC = FC<DataGridCellFCProps>;
23
27
 
24
28
  export type DataGridFooterPredefinedFunction =
25
29
  | 'average'
@@ -37,6 +41,7 @@ export type DataGridFooterFunction<R> = (
37
41
  export type DataGridColumn<R> = {
38
42
  component?: DataGridCellFC;
39
43
  editable?: boolean;
44
+ color?: ThemeColor;
40
45
  excelFormatter?: (value: any) => string;
41
46
  excelBackgroundColor?: (value: any) => string;
42
47
  excelValue?: (value: any) => string;
@@ -176,6 +181,7 @@ export type DataGridCellProps<R> = {
176
181
  className?: string;
177
182
  style?: CSSProperties;
178
183
  userSelect?: boolean;
184
+ color?: ThemeColor;
179
185
  };
180
186
 
181
187
  export type DataGridHeaderCellProps<R> = {
@@ -185,6 +191,7 @@ export type DataGridHeaderCellProps<R> = {
185
191
  context: DataGridContext<R>;
186
192
  onFilterButtonClicked?: (columnKey: string) => void;
187
193
  isFilterOpen?: boolean;
194
+ color?: ThemeColor;
188
195
  };
189
196
 
190
197
  export type DataGridSort = 'asc' | 'desc';
@@ -1,24 +1,20 @@
1
1
  import styled, { css } from 'styled-components';
2
2
 
3
3
  import { ThemeColorWithIntensity } from '../../../providers/ThemeProvider';
4
- import { getColor } from '../../../providers/ThemeProvider/helpers';
5
4
 
6
5
  export const FormGroupContainer = styled.fieldset<{
7
6
  color?: ThemeColorWithIntensity;
8
7
  }>`
9
8
  display: flex;
10
9
  flex-direction: column;
11
- background: ${({ color = 'neutral-100' }) =>
12
- `linear-gradient(180deg, var(--color-${getColor(
13
- color
14
- )}-200) 0%, var(--color-neutral-100) var(--space-10))`};
10
+ background: var(--color-neutral-100);
15
11
  border-radius: var(--rounded-md);
16
12
  box-shadow: var(--shadow-md);
17
13
  padding: var(--space-4);
18
14
  margin: 0;
19
15
  border: 1px solid var(--color-neutral-100);
20
16
  gap: var(--space-2);
21
- border-left: 4px solid ${({ color = 'neutral' }) => `var(--color-${color})`};
17
+ border-left: 8px solid ${({ color = 'neutral' }) => `var(--color-${color})`};
22
18
  `;
23
19
 
24
20
  export const FormGroupHeader = styled.div`