@semcore/data-table 3.6.3 → 3.7.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.
@@ -2,6 +2,13 @@ SDataTable {
2
2
  position: relative;
3
3
  }
4
4
 
5
+ SDataTable[compact] {
6
+ & SColumn,
7
+ & SCell {
8
+ padding: var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-2x, 8px);
9
+ }
10
+ }
11
+
5
12
  SHeadWrapper {
6
13
  position: relative;
7
14
  }
@@ -22,16 +29,16 @@ SHead {
22
29
 
23
30
  SColumn {
24
31
  display: flex;
25
- align-items: center;
32
+ align-items: flex-start;
26
33
  flex-grow: 1;
27
34
  font-size: var(--intergalactic-fs-100, 12px);
28
35
  color: var(--intergalactic-text-primary, #191b23);
29
36
  box-sizing: border-box;
30
37
  position: relative;
31
38
 
32
- &:focus {
39
+ &:focus-visible {
33
40
  outline: none;
34
- box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.3));
41
+ box-shadow: inset var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.3));
35
42
  }
36
43
  }
37
44
 
@@ -44,7 +51,6 @@ SColumn[hidden] {
44
51
 
45
52
  SColumn[use='primary'] {
46
53
  padding: var(--intergalactic-spacing-3x, 12px);
47
- border-right: 1px solid var(--intergalactic-border-secondary, #e0e1e9);
48
54
  border-bottom: 1px solid var(--intergalactic-border-secondary, #e0e1e9);
49
55
  background-color: var(--intergalactic-table-th-primary-cell, #f4f5f9);
50
56
  }
@@ -55,10 +61,6 @@ SColumn[use='secondary'] {
55
61
  background-color: var(--intergalactic-table-th-secondary-cell, #ffffff);
56
62
  }
57
63
 
58
- SColumn[use]:last-child {
59
- border-right: none;
60
- }
61
-
62
64
  SColumn[group][use] {
63
65
  display: flex;
64
66
  flex-wrap: wrap;
@@ -68,19 +70,14 @@ SColumn[group][use] {
68
70
  padding: 0;
69
71
  }
70
72
 
71
- SColumn[groupHead][use] {
73
+ SColumn[groupHead] {
72
74
  justify-content: center;
73
- border-right: none;
74
75
  /* for resizable */
75
76
  z-index: 1;
76
77
  }
77
78
 
78
- SColumn[groupHead][use='primary'] {
79
- border-bottom: 1px solid var(--intergalactic-border-secondary, #e0e1e9);
80
- }
81
-
82
- SColumn[groupHead][use='secondary'] {
83
- border-bottom: 1px solid var(--intergalactic-border-table-accent-border, #a9abb6);
79
+ SColumn[groupHead] {
80
+ border-bottom: none;
84
81
  }
85
82
 
86
83
  SColumn[sortable] {
@@ -89,15 +86,36 @@ SColumn[sortable] {
89
86
  &[use='primary']:hover {
90
87
  background-color: var(--intergalactic-table-th-primary-cell-hover, #e0e1e9);
91
88
  }
89
+
90
+ &:hover SSortWrapper {
91
+ display: block;
92
+ }
92
93
  }
93
94
 
94
- SColumn[active][use='primary'] {
95
+ SColumn[use='primary'][active] {
95
96
  background-color: var(--intergalactic-table-th-primary-cell-active, #e0e1e9);
97
+ width: 100%;
98
+ }
99
+
100
+ SColumn[active] SSortIcon {
101
+ position: relative;
102
+ }
103
+
104
+ SColumn[active] SSortWrapper {
105
+ display: block;
106
+ width: 16px;
107
+ margin-left: var(--intergalactic-spacing-1x, 4px);
108
+ }
109
+
110
+ SColumn[sortIconFloat] SSortWrapper {
111
+ width: 0;
96
112
  }
97
113
 
98
114
  SColumn[resizable] {
115
+ border-right: 1px solid transparent;
116
+
99
117
  &:hover:after {
100
- background: var(--intergalactic-table-th-primary-cell-hover, #e0e1e9);
118
+ border-right-color: var(--intergalactic-border-table-accent-border, #a9abb6);
101
119
  }
102
120
 
103
121
  &:after {
@@ -105,10 +123,11 @@ SColumn[resizable] {
105
123
  position: absolute;
106
124
  bottom: 0;
107
125
  right: -1px;
108
- height: 100vh;
109
- width: 1px;
126
+ height: 100%;
127
+ width: 5px;
110
128
  background: transparent;
111
129
  cursor: col-resize;
130
+ border-right: 1px solid transparent;
112
131
  }
113
132
  }
114
133
 
@@ -118,13 +137,54 @@ SColumn[fixed] {
118
137
  z-index: 2;
119
138
  }
120
139
 
121
- SSortIcon {
122
- fill: var(--intergalactic-icon-secondary-neutral, #a9abb6);
123
- margin-left: calc(var(--intergalactic-spacing-1x, 4px) + var(--intergalactic-spacing-05x, 2px));
140
+ SColumn[borderLeft],
141
+ SCell[borderLeft] {
142
+ border-left: 1px solid var(--intergalactic-border-secondary, #e0e1e9);
143
+ }
144
+
145
+ SColumn[borderRight],
146
+ SCell[borderRight] {
147
+ border-right: 1px solid var(--intergalactic-border-secondary, #e0e1e9);
124
148
  }
125
149
 
126
- SSortIcon[active] {
150
+ SSortIcon {
127
151
  fill: var(--intergalactic-icon-secondary-neutral-hover-active, #8a8e9b);
152
+ position: absolute;
153
+ top: -2px;
154
+ right: 0;
155
+ }
156
+
157
+ SSortWrapper {
158
+ display: none;
159
+ flex-shrink: 999;
160
+ position: relative;
161
+ flex-basis: 20px;
162
+ height: 0;
163
+ }
164
+
165
+ SSortWrapper:before {
166
+ content: '';
167
+ position: absolute;
168
+ top: -2px;
169
+ right: 0;
170
+ width: 20px;
171
+ height: 16px;
172
+ }
173
+
174
+ SColumn[use='primary'] SSortWrapper:before {
175
+ background: linear-gradient(
176
+ 270deg,
177
+ var(--intergalactic-table-th-primary-cell-hover, #e0e1e9) 67.5%,
178
+ rgba(224, 225, 233, 0) 105%
179
+ );
180
+ }
181
+
182
+ SColumn[use='secondary'] SSortWrapper:before {
183
+ background: linear-gradient(
184
+ 270deg,
185
+ var(--intergalactic-table-th-secondary-cell, #ffffff) 67.5%,
186
+ rgba(255, 255, 255, 0) 105%
187
+ );
128
188
  }
129
189
 
130
190
  SBodyWrapper {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["ROW_GROUP"],"sources":["../../src/types.ts"],"sourcesContent":["import React from 'react';\nimport { ROW_GROUP } from './DataTable';\nimport { Property } from 'csstype';\n\nexport type PseudoChildPropsGetter = (\n props: { [propName: string]: unknown },\n rowData: { [columnName: string]: unknown },\n index: number,\n) => { [propName: string]: unknown };\nexport type PropsLayer = {\n childrenPropsGetter?: PseudoChildPropsGetter;\n [propName: string]: unknown;\n};\n\nexport type SortDirection = 'asc' | 'desc';\nexport type Column<\n Props extends { [propName: string]: unknown } = { [propName: string]: unknown },\n> = {\n name: string;\n active: boolean;\n width: number;\n fixed?: 'left' | 'right';\n resizable?: boolean;\n sortable?: boolean | SortDirection;\n sortDirection: SortDirection;\n varWidth: string;\n setVar: boolean;\n data?: unknown;\n props: {\n name: string;\n ref: React.RefObject<HTMLElement>;\n } & Partial<{\n flex: Property.Flex;\n onClick: (event: React.MouseEvent) => void;\n onKeyDown: (event: React.KeyboardEvent) => void;\n forwardRef: React.Ref<HTMLElement>;\n style: React.CSSProperties;\n fixed: 'left' | 'right';\n children: React.ReactNode[];\n resizable: boolean;\n sortable: boolean | SortDirection;\n sortDirection: SortDirection;\n }> &\n Props;\n columns: Column[];\n};\nexport type Cell = Pick<Column, 'name' | 'fixed' | 'data'> & {\n cssVar: string | string[];\n cellPropsLayers: PropsLayer[];\n};\nexport type RowData<\n Data extends { [columnName: string]: unknown } = { [columnName: string]: unknown },\n> = Data &\n Partial<{\n name: string;\n [ROW_GROUP]: RowData[];\n }>;\nexport type NestedCells = (Cell | NestedCells)[] & { flatRowData?: RowData };\n"],"mappings":"AACA,SAASA,SAAT,QAA0B,aAA1B"}
1
+ {"version":3,"file":"types.js","names":["ROW_GROUP"],"sources":["../../src/types.ts"],"sourcesContent":["import React from 'react';\nimport { ROW_GROUP } from './DataTable';\nimport { Property } from 'csstype';\n\nexport type PseudoChildPropsGetter = (\n props: { [propName: string]: unknown },\n rowData: { [columnName: string]: unknown },\n index: number,\n) => { [propName: string]: unknown };\nexport type PropsLayer = {\n childrenPropsGetter?: PseudoChildPropsGetter;\n [propName: string]: unknown;\n};\n\nexport type SortDirection = 'asc' | 'desc';\nexport type Column<\n Props extends { [propName: string]: unknown } = { [propName: string]: unknown },\n> = {\n name: string;\n active: boolean;\n width: number;\n fixed?: 'left' | 'right';\n resizable?: boolean;\n sortable?: boolean | SortDirection;\n sortDirection: SortDirection;\n varWidth: string;\n setVar: boolean;\n data?: unknown;\n vBorders?: boolean;\n borderLeft?: boolean;\n borderRight?: boolean;\n props: {\n name: string;\n ref: React.RefObject<HTMLElement>;\n } & Partial<{\n flex: Property.Flex;\n justifyContent: Property.JustifyContent;\n onClick: (event: React.MouseEvent) => void;\n onKeyDown: (event: React.KeyboardEvent) => void;\n forwardRef: React.Ref<HTMLElement>;\n style: React.CSSProperties;\n fixed: 'left' | 'right';\n children: React.ReactNode[];\n resizable: boolean;\n sortable: boolean | SortDirection;\n sortDirection: SortDirection;\n vBorders: boolean;\n borderLeft: boolean;\n borderRight: boolean;\n }> &\n Props;\n columns: Column[];\n};\nexport type Cell = Pick<Column, 'name' | 'fixed' | 'data'> & {\n cssVar: string | string[];\n cellPropsLayers: PropsLayer[];\n};\nexport type RowData<\n Data extends { [columnName: string]: unknown } = { [columnName: string]: unknown },\n> = Data &\n Partial<{\n name: string;\n [ROW_GROUP]: RowData[];\n }>;\nexport type NestedCells = (Cell | NestedCells)[] & { flatRowData?: RowData };\n"],"mappings":"AACA,SAASA,SAAT,QAA0B,aAA1B"}
@@ -64,13 +64,21 @@ export interface IDataTableColumnProps extends IFlexProps {
64
64
  fixed?: 'left' | 'right';
65
65
  /** Fields to control the size of the column. */
66
66
  flex?: Property.Flex | 'inherit';
67
+ /** Add vertical borders */
68
+ vBorders?: boolean;
69
+ /** Add vertical border to the right side */
70
+ borderRight?: boolean;
71
+ /** Add vertical border to the left side */
72
+ borderLeft?: boolean;
73
+ /** Make cells less */
74
+ compact?: boolean;
67
75
  }
68
76
  export interface IDataTableBodyProps extends IBoxProps {
69
77
  /** Rows table */
70
78
  rows?: DataTableRow[];
71
79
  /** When enabled, only visually acessable rows are rendered.
72
80
  * `tollerance` property controls how many rows outside of viewport are render.
73
- * `rowHeight` fixes the rows height if it known. If not provided, first row node height is measured.
81
+ * `rowHeight` fixes the rows height if it has known. If not provided, first row node height is measured.
74
82
  * @default { tollerance: 2 }
75
83
  */
76
84
  virtualScroll?: boolean | {
@@ -28,11 +28,15 @@ export declare type Column<Props extends {
28
28
  varWidth: string;
29
29
  setVar: boolean;
30
30
  data?: unknown;
31
+ vBorders?: boolean;
32
+ borderLeft?: boolean;
33
+ borderRight?: boolean;
31
34
  props: {
32
35
  name: string;
33
36
  ref: React.RefObject<HTMLElement>;
34
37
  } & Partial<{
35
38
  flex: Property.Flex;
39
+ justifyContent: Property.JustifyContent;
36
40
  onClick: (event: React.MouseEvent) => void;
37
41
  onKeyDown: (event: React.KeyboardEvent) => void;
38
42
  forwardRef: React.Ref<HTMLElement>;
@@ -42,6 +46,9 @@ export declare type Column<Props extends {
42
46
  resizable: boolean;
43
47
  sortable: boolean | SortDirection;
44
48
  sortDirection: SortDirection;
49
+ vBorders: boolean;
50
+ borderLeft: boolean;
51
+ borderRight: boolean;
45
52
  }> & Props;
46
53
  columns: Column[];
47
54
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/data-table",
3
3
  "description": "Semrush DataTable Component",
4
- "version": "3.6.3",
4
+ "version": "3.7.1",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -25,7 +25,6 @@
25
25
  "@semcore/typography": "*",
26
26
  "@semcore/accordion": "*",
27
27
  "@semcore/divider": "*",
28
- "@semcore/link": "*",
29
28
  "@semcore/portal": "*",
30
29
  "@semcore/progress-bar": "*",
31
30
  "@semcore/skeleton": "*",