@spaced-out/ui-design-system 0.1.50 → 0.1.51

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.51](https://github.com/spaced-out/ui-design-system/compare/v0.1.50...v0.1.51) (2023-09-20)
6
+
7
+
8
+ ### Features
9
+
10
+ * new table actions ([#144](https://github.com/spaced-out/ui-design-system/issues/144)) ([d28c032](https://github.com/spaced-out/ui-design-system/commit/d28c0321fff272694e2363fd0a634c6a9030b50a))
11
+
5
12
  ### [0.1.50](https://github.com/spaced-out/ui-design-system/compare/v0.1.49...v0.1.50) (2023-09-15)
6
13
 
7
14
 
@@ -63,7 +63,8 @@ function DefaultTableHeader(props) {
63
63
  sortDirection = 'original',
64
64
  handleCheckboxClick,
65
65
  checked,
66
- disabled
66
+ disabled,
67
+ stickyHeader
67
68
  } = props;
68
69
  const tableHeaderCells = () => /*#__PURE__*/React.createElement(React.Fragment, null, columns.map((columnData, index) => {
69
70
  const {
@@ -130,7 +131,9 @@ function DefaultTableHeader(props) {
130
131
  }, filterIcon))));
131
132
  }));
132
133
  return /*#__PURE__*/React.createElement(BasicTableHead, {
133
- className: (0, _classify.default)(_TableModule.default.tableHeaderSortable, className)
134
+ className: (0, _classify.default)(_TableModule.default.tableHeaderSortable, {
135
+ [_TableModule.default.stickyHeader]: stickyHeader
136
+ }, className)
134
137
  }, /*#__PURE__*/React.createElement(_DefaultRow.BasicRow, {
135
138
  className: _TableModule.default.defaultHeaderRow
136
139
  }, handleCheckboxClick && /*#__PURE__*/React.createElement(BasicHeadCell, {
@@ -56,6 +56,7 @@ export type TableHeaderProps<T, U> = {
56
56
  checked?: 'true' | 'false' | 'mixed',
57
57
  handleCheckboxClick?: ({value: string, checked: boolean}) => mixed,
58
58
  disabled?: boolean,
59
+ stickyHeader?: boolean,
59
60
  };
60
61
 
61
62
  const SortIcon = ({
@@ -113,6 +114,7 @@ export function DefaultTableHeader<T: GenericObject, U: GenericObject>(
113
114
  handleCheckboxClick,
114
115
  checked,
115
116
  disabled,
117
+ stickyHeader,
116
118
  } = props;
117
119
 
118
120
  const tableHeaderCells = () => (
@@ -208,7 +210,13 @@ export function DefaultTableHeader<T: GenericObject, U: GenericObject>(
208
210
  );
209
211
 
210
212
  return (
211
- <BasicTableHead className={classify(css.tableHeaderSortable, className)}>
213
+ <BasicTableHead
214
+ className={classify(
215
+ css.tableHeaderSortable,
216
+ {[css.stickyHeader]: stickyHeader},
217
+ className,
218
+ )}
219
+ >
212
220
  <BasicRow className={css.defaultHeaderRow}>
213
221
  {handleCheckboxClick && (
214
222
  <BasicHeadCell scope="col">
@@ -55,7 +55,8 @@ function StaticTable(props) {
55
55
  emptyText,
56
56
  disabled,
57
57
  customLoader,
58
- borderRadius
58
+ borderRadius,
59
+ stickyHeader
59
60
  } = props;
60
61
 
61
62
  // this is a fallback and honestly probably doesn't need the
@@ -86,7 +87,9 @@ function StaticTable(props) {
86
87
  }
87
88
  }, /*#__PURE__*/React.createElement(BasicTable, {
88
89
  "data-id": "basic-table",
89
- className: (0, _classify.classify)(className, classNames?.table)
90
+ className: (0, _classify.classify)(className, {
91
+ [_TableModule.default.fullHeightTable]: isLoading || !entries.length && !!emptyText
92
+ }, classNames?.table)
90
93
  }, showHeader && /*#__PURE__*/React.createElement(_DefaultTableHeader.DefaultTableHeader, {
91
94
  className: (0, _classify.classify)(tableHeaderClassName, classNames?.tableHeader),
92
95
  sortable: sortable,
@@ -96,6 +99,7 @@ function StaticTable(props) {
96
99
  sortDirection: sortDirection,
97
100
  disabled: disabled,
98
101
  handleCheckboxClick: handleHeaderCheckboxClick,
102
+ stickyHeader: stickyHeader,
99
103
  checked: selectedKeys == null || selectedKeys.length === 0 ? 'false' : selectedKeys.length < entries.length ? 'mixed' : 'true'
100
104
  }), /*#__PURE__*/React.createElement(BasicTableBody, {
101
105
  className: classNames?.tableBody
@@ -65,6 +65,7 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
65
65
  disabled,
66
66
  customLoader,
67
67
  borderRadius,
68
+ stickyHeader,
68
69
  } = props;
69
70
 
70
71
  // this is a fallback and honestly probably doesn't need the
@@ -102,7 +103,14 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
102
103
  >
103
104
  <BasicTable
104
105
  data-id="basic-table"
105
- className={classify(className, classNames?.table)}
106
+ className={classify(
107
+ className,
108
+ {
109
+ [css.fullHeightTable]:
110
+ isLoading || (!entries.length && !!emptyText),
111
+ },
112
+ classNames?.table,
113
+ )}
106
114
  >
107
115
  {showHeader && (
108
116
  <DefaultTableHeader
@@ -114,6 +122,7 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
114
122
  sortDirection={sortDirection}
115
123
  disabled={disabled}
116
124
  handleCheckboxClick={handleHeaderCheckboxClick}
125
+ stickyHeader={stickyHeader}
117
126
  checked={
118
127
  selectedKeys == null || selectedKeys.length === 0
119
128
  ? 'false'
@@ -52,6 +52,9 @@ export type TableProps<T, U> = {
52
52
  disabled?: boolean,
53
53
  customLoader?: React.Node,
54
54
  borderRadius?: string,
55
+
56
+ // For this to work the table wrapper should be scrollable
57
+ stickyHeader?: boolean,
55
58
  };
56
59
 
57
60
  /**
@@ -11,8 +11,8 @@
11
11
  colorGrayLightest
12
12
  ) from '../../styles/variables/_color.css';
13
13
  @value (spaceNone, spaceXXSmall, spaceXSmall, spaceSmall, spaceMedium) from '../../styles/variables/_space.css';
14
- @value (sizeFluid, size48, size60, size240, size300) from '../../styles/variables/_size.css';
15
- @value (borderWidthNone, borderWidthPrimary, borderRadiusNone, borderRadiusMedium) from '../../styles/variables/_border.css';
14
+ @value (sizeFluid, size2, size48, size60, size240, size300) from '../../styles/variables/_size.css';
15
+ @value (borderWidthNone, borderWidthPrimary, borderRadiusNone, borderRadiusMedium, borderWidthSecondary) from '../../styles/variables/_border.css';
16
16
  @value (fontLineHeight170) from '../../styles/variables/_font.css';
17
17
  @value (elevationCard) from '../../styles/variables/_elevation.css';
18
18
 
@@ -40,6 +40,9 @@
40
40
  table-layout: fixed;
41
41
  white-space: nowrap;
42
42
  }
43
+ .fullHeightTable {
44
+ height: sizeFluid;
45
+ }
43
46
  .defaultTableBody {
44
47
  flex-flow: column;
45
48
  border-radius: borderRadiusNone borderRadiusNone var(--border-radius)
@@ -121,7 +124,7 @@
121
124
  .stickyCell {
122
125
  position: sticky;
123
126
  left: spaceNone;
124
- z-index: elevationCard;
127
+ z-index: calc(elevationCard / 2);
125
128
  }
126
129
 
127
130
  .stickyHeaderCell {
@@ -254,3 +257,19 @@
254
257
  .selectedSortArrow {
255
258
  color: colorTextPrimary;
256
259
  }
260
+
261
+ .stickyHeader {
262
+ position: sticky;
263
+ top: spaceNone;
264
+ z-index: elevationCard;
265
+ }
266
+
267
+ .stickyHeader::after {
268
+ content: '';
269
+ position: absolute;
270
+ bottom: calc(borderWidthSecondary * -1);
271
+ left: spaceNone;
272
+ width: sizeFluid;
273
+ height: calc(size2 / 2);
274
+ background: colorBorderPrimary;
275
+ }
@@ -1,7 +1,7 @@
1
1
  @value (spaceNone, spaceXXSmall, spaceXSmall, spaceSmall, spaceMedium, spaceHalfFluid, spaceNegHalfFluid) from '../../styles/variables/_space.css';
2
- @value (size2, size22, size48, size60, size240, size300, sizeFluid) from '../../styles/variables/_size.css';
2
+ @value (size2, size22, size48, size50, size60, size240, size300, sizeFluid) from '../../styles/variables/_size.css';
3
3
  @value (borderRadiusMedium, borderRadiusNone) from '../../styles/variables/_border.css';
4
- @value (colorBackgroundTertiary) from '../../styles/variables/_color.css';
4
+ @value (colorBackgroundTertiary, colorFillPrimary) from '../../styles/variables/_color.css';
5
5
  @value (elevationMenu) from '../../styles/variables/_elevation.css';
6
6
 
7
7
  .tableBar {
@@ -30,19 +30,12 @@
30
30
  }
31
31
 
32
32
  .tableActionBar {
33
- composes: borderPrimary from '../../styles/border.module.css';
34
- composes: boxShadow4 from '../../styles/shadow.module.css';
35
- position: absolute;
36
- left: spaceHalfFluid;
37
- z-index: elevationMenu;
38
- transform: translateX(spaceNegHalfFluid);
39
- bottom: calc(spaceMedium * -1);
40
33
  display: flex;
34
+ height: size50;
35
+ background-color: colorFillPrimary;
36
+ composes: boxShadow3 from '../../styles/shadow.module.css';
41
37
  align-items: center;
42
- min-height: calc(size60 - size2);
43
- width: fit-content;
44
- padding: spaceSmall;
45
- background-color: colorBackgroundTertiary;
46
- border-radius: borderRadiusMedium;
47
- width: max-content;
38
+ justify-content: space-between;
39
+ width: sizeFluid;
40
+ padding: spaceXSmall spaceSmall spaceXSmall spaceMedium;
48
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {