@laerdal/life-react-components 1.3.2-dev.7 → 1.4.1-dev.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 (72) hide show
  1. package/dist/esm/Button/DualFunctionButton.js +4 -0
  2. package/dist/esm/Button/DualFunctionButton.js.map +1 -1
  3. package/dist/esm/Dropdown/DropdownContent.js +6 -6
  4. package/dist/esm/Dropdown/DropdownContent.js.map +1 -1
  5. package/dist/esm/Modals/ModalContainer.js +0 -5
  6. package/dist/esm/Modals/ModalContainer.js.map +1 -1
  7. package/dist/esm/Modals/ModalDialog.js +23 -4
  8. package/dist/esm/Modals/ModalDialog.js.map +1 -1
  9. package/dist/esm/Modals/ModalNote.js +1 -1
  10. package/dist/esm/Modals/ModalNote.js.map +1 -1
  11. package/dist/esm/Table/Table.js +22 -6
  12. package/dist/esm/Table/Table.js.map +1 -1
  13. package/dist/esm/Table/TableBody.js +14 -24
  14. package/dist/esm/Table/TableBody.js.map +1 -1
  15. package/dist/esm/Table/TableFooter.js +13 -12
  16. package/dist/esm/Table/TableFooter.js.map +1 -1
  17. package/dist/esm/Table/TableHeaders.js +8 -19
  18. package/dist/esm/Table/TableHeaders.js.map +1 -1
  19. package/dist/esm/Table/TableStyles.js +226 -180
  20. package/dist/esm/Table/TableStyles.js.map +1 -1
  21. package/dist/esm/Table/__tests__/Table.test.js +162 -0
  22. package/dist/esm/Table/__tests__/Table.test.js.map +1 -1
  23. package/dist/js/Button/DualFunctionButton.js +4 -0
  24. package/dist/js/Button/DualFunctionButton.js.map +1 -1
  25. package/dist/js/Dropdown/DropdownContent.js +8 -8
  26. package/dist/js/Dropdown/DropdownContent.js.map +1 -1
  27. package/dist/js/Modals/ModalContainer.js +1 -1
  28. package/dist/js/Modals/ModalContainer.js.map +1 -1
  29. package/dist/js/Modals/ModalDialog.d.ts +3 -1
  30. package/dist/js/Modals/ModalDialog.js +21 -4
  31. package/dist/js/Modals/ModalDialog.js.map +1 -1
  32. package/dist/js/Modals/ModalNote.d.ts +1 -1
  33. package/dist/js/Modals/ModalNote.js +1 -1
  34. package/dist/js/Modals/ModalNote.js.map +1 -1
  35. package/dist/js/Table/Table.js +32 -11
  36. package/dist/js/Table/Table.js.map +1 -1
  37. package/dist/js/Table/TableBody.js +16 -25
  38. package/dist/js/Table/TableBody.js.map +1 -1
  39. package/dist/js/Table/TableFooter.d.ts +2 -0
  40. package/dist/js/Table/TableFooter.js +19 -12
  41. package/dist/js/Table/TableFooter.js.map +1 -1
  42. package/dist/js/Table/TableHeaders.js +9 -19
  43. package/dist/js/Table/TableHeaders.js.map +1 -1
  44. package/dist/js/Table/TableStyles.d.ts +19 -0
  45. package/dist/js/Table/TableStyles.js +79 -3
  46. package/dist/js/Table/TableStyles.js.map +1 -1
  47. package/dist/js/Table/TableTypes.d.ts +4 -1
  48. package/dist/js/Table/__tests__/Table.test.js +164 -0
  49. package/dist/js/Table/__tests__/Table.test.js.map +1 -1
  50. package/dist/umd/Button/DualFunctionButton.js +4 -0
  51. package/dist/umd/Button/DualFunctionButton.js.map +1 -1
  52. package/dist/umd/Dropdown/DropdownContent.js +6 -6
  53. package/dist/umd/Dropdown/DropdownContent.js.map +1 -1
  54. package/dist/umd/Modals/ModalContainer.js +0 -5
  55. package/dist/umd/Modals/ModalContainer.js.map +1 -1
  56. package/dist/umd/Modals/ModalDialog.js +23 -4
  57. package/dist/umd/Modals/ModalDialog.js.map +1 -1
  58. package/dist/umd/Modals/ModalNote.js +1 -1
  59. package/dist/umd/Modals/ModalNote.js.map +1 -1
  60. package/dist/umd/Table/Table.js +21 -5
  61. package/dist/umd/Table/Table.js.map +1 -1
  62. package/dist/umd/Table/TableBody.js +17 -28
  63. package/dist/umd/Table/TableBody.js.map +1 -1
  64. package/dist/umd/Table/TableFooter.js +15 -16
  65. package/dist/umd/Table/TableFooter.js.map +1 -1
  66. package/dist/umd/Table/TableHeaders.js +11 -23
  67. package/dist/umd/Table/TableHeaders.js.map +1 -1
  68. package/dist/umd/Table/TableStyles.js +226 -180
  69. package/dist/umd/Table/TableStyles.js.map +1 -1
  70. package/dist/umd/Table/__tests__/Table.test.js +164 -4
  71. package/dist/umd/Table/__tests__/Table.test.js.map +1 -1
  72. package/package.json +1 -1
@@ -16,7 +16,7 @@
16
16
  Object.defineProperty(exports, "__esModule", {
17
17
  value: true
18
18
  });
19
- exports.TableWrapper = undefined;
19
+ exports.StyledTableFooterCollapseButton = exports.StyledTableSpinner = exports.StyledTableFooterControls = exports.StyledTableFooterCurrentInfo = exports.StyledTableFooterContent = exports.StyledTableFooter = exports.StyledTableCellText = exports.StyledTableCellIcon = exports.StyledTableCellContent = exports.StyledTableCell = exports.StyledTableBody = exports.StyledTableBodyRow = exports.StyledTableHeaderColumn = exports.StyledTableHeaderColumnContent = exports.StyledTableHeaderColumns = exports.StyledTableHeaderTitleContent = exports.StyledTableHeaderTitle = exports.StyledTableHeader = exports.StyledTable = exports.TableWrapper = undefined;
20
20
 
21
21
  var _styledComponents2 = _interopRequireDefault(_styledComponents);
22
22
 
@@ -39,195 +39,241 @@
39
39
  */
40
40
  const TableWrapper = exports.TableWrapper = _styledComponents2.default.div`
41
41
  position: relative;
42
+ `;
43
+ const StyledTable = exports.StyledTable = _styledComponents2.default.table`
44
+ background: transparent;
45
+ width: 100%;
46
+ table-layout: fixed;
47
+ `;
48
+ const StyledTableHeader = exports.StyledTableHeader = _styledComponents2.default.thead`
49
+ `;
50
+ const StyledTableHeaderTitle = exports.StyledTableHeaderTitle = _styledComponents2.default.tr`
51
+ `;
52
+ const StyledTableHeaderTitleContent = exports.StyledTableHeaderTitleContent = _styledComponents2.default.div`
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: space-between;
56
+ width: 100%;
57
+ box-sizing: border-box;
58
+ min-height: 56px;
59
+ border-bottom: 1px solid ${_styles.COLORS.neutral_200};
60
+ border-top: 2px solid ${_styles.COLORS.neutral_200};
61
+ padding: 0 16px;
62
+
63
+ ${(0, _typography.ComponentLStyling)(_typography.ComponentTextStyle.Bold, _styles.COLORS.black)}
64
+ .title-menu {
65
+ margin-right: -16px;
66
+ }
67
+ `;
68
+ const StyledTableHeaderColumns = exports.StyledTableHeaderColumns = _styledComponents2.default.tr`
69
+ `;
70
+ const StyledTableHeaderColumnContent = exports.StyledTableHeaderColumnContent = _styledComponents2.default.div`
71
+ box-sizing: border-box;
72
+ min-height: 56px;
73
+ padding: 0 16px;
74
+ height: 100%;
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: space-between;
78
+ border-top: 1px solid ${_styles.COLORS.neutral_200};
79
+ border-bottom: 1px solid ${_styles.COLORS.neutral_200};
80
+ `;
81
+ const StyledTableHeaderColumn = exports.StyledTableHeaderColumn = _styledComponents2.default.th`
82
+ ${(0, _typography.ComponentSStyling)(_typography.ComponentTextStyle.Bold, _styles.COLORS.neutral_600)}
83
+ position: relative;
42
84
 
43
- .table {
44
-
45
- background: transparent;
46
- width: 100%;
47
-
48
- .table-header {
49
- .table-header-title .title-content {
50
- display: flex;
51
- align-items: center;
52
- justify-content: space-between;
53
- width: 100%;
54
- box-sizing: border-box;
55
- min-height: 56px;
56
- border-bottom: 1px solid ${_styles.COLORS.neutral_200};
57
- border-top: 2px solid ${_styles.COLORS.neutral_200};
58
- padding: 0 16px;
59
-
60
- ${(0, _typography.ComponentLStyling)(_typography.ComponentTextStyle.Bold, _styles.COLORS.black)}
61
- .title-menu {
62
- margin-right: -16px;
63
- }
64
- }
65
-
66
- .table-header-columns {
67
-
68
- .table-header-column {
69
- ${(0, _typography.ComponentSStyling)(_typography.ComponentTextStyle.Bold, _styles.COLORS.neutral_600)}
70
- position: relative;
71
-
72
- background-color: ${_styles.COLORS.white};
73
-
74
- //fixes header heights no idea why
75
- height: 1px;
76
-
77
- .header-content {
78
- box-sizing: border-box;
79
- min-height: 56px;
80
- padding: 0 16px;
81
- height: 100%;
82
- display: flex;
83
- align-items: center;
84
- justify-content: space-between;
85
- border-top: 1px solid ${_styles.COLORS.neutral_200};
86
- border-bottom: 1px solid ${_styles.COLORS.neutral_200};
87
- }
88
-
89
- &.sortable {
90
- cursor: pointer;
91
-
92
- &:hover {
93
- background-color: ${_styles.COLORS.primary_20};
94
- color: ${_styles.COLORS.primary_700};
95
- z-index: ${_zIndexes.Z_INDEXES.hover};
96
- }
97
-
98
- &:active {
99
- background-color: ${_styles.COLORS.primary_100};
100
- color: ${_styles.COLORS.primary_800};
101
- box-shadow: none !important;
102
- z-index: ${_zIndexes.Z_INDEXES.active};
103
- }
104
-
105
- &:focus {
106
- outline: none;
107
- box-shadow: 0 4px 12px ${_styles.COLORS.focus_25}, 0 0 8px ${_styles.COLORS.focus};
108
- z-index: ${_zIndexes.Z_INDEXES.focus};
109
- }
110
- }
111
-
112
- &.sortable .header-content > svg {
113
- opacity: 0;
114
- }
115
-
116
- &.sortable.sorted .header-content > svg {
117
- opacity: 1;
118
- }
119
- }
120
- }
121
- }
85
+ background-color: ${_styles.COLORS.white};
122
86
 
123
- .table-body {
124
- .table-row {
125
- position: relative;
126
-
127
- outline: none;
128
-
129
- .table-cell {
130
- .table-cell-content {
131
- min-height: 48px;
132
-
133
- padding: 0 16px;
134
- ${(0, _typography.ComponentSStyling)(_typography.ComponentTextStyle.Regular, null)}
135
-
136
- display: flex;
137
- align-items: center;
138
- gap: 8px;
139
-
140
- &.truncate-text,
141
- &.truncate-text span {
142
- overflow: hidden;
143
- text-overflow: ellipsis;
144
- white-space: nowrap;
145
- }
146
-
147
- &.left {
148
- justify-content: left;
149
- }
150
-
151
- &.right {
152
- justify-content: right;
153
- }
154
-
155
- &.center {
156
- justify-content: center;
157
- }
158
- }
159
-
160
- .table-cell-icon,
161
- .table-cell-icon svg {
162
- color: ${_styles.COLORS.neutral_700};
163
- width: 24px;
164
- height: 24px;
165
- }
166
- }
167
- }
168
-
169
- .table-row:nth-child(odd) {
170
- background-color: ${_styles.COLORS.neutral_100};
171
- }
172
-
173
- .table-row:nth-child(even) {
174
- background-color: ${_styles.COLORS.white};
175
- }
176
-
177
- .table-row {
178
- cursor: pointer;
179
-
180
- &:hover {
181
- background-color: ${_styles.COLORS.primary_200};
182
- z-index: ${_zIndexes.Z_INDEXES.hover};
183
- }
184
-
185
- &:active {
186
- box-shadow: none !important;
187
- z-index: ${_zIndexes.Z_INDEXES.active};
188
- }
189
-
190
- &:focus {
191
- background-color: ${_styles.COLORS.primary_200};
192
- box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;
193
- z-index: ${_zIndexes.Z_INDEXES.focus};
194
- outline: none;
195
- }
196
- }
87
+ //fixes header heights no idea why
88
+ height: 1px;
197
89
 
90
+ &.sortable {
91
+ cursor: pointer;
92
+
93
+ &:hover {
94
+ background-color: ${_styles.COLORS.primary_20};
95
+ color: ${_styles.COLORS.primary_700};
96
+ z-index: ${_zIndexes.Z_INDEXES.hover};
198
97
  }
199
98
 
200
- .table-footer {
201
- .footer-content {
202
- border-top: 2px solid ${_styles.COLORS.neutral_200};
203
- border-bottom: 1px solid ${_styles.COLORS.neutral_200};
204
- box-sizing: border-box;
205
- min-height: 56px;
206
-
207
- display: flex;
208
- align-items: center;
209
- justify-content: right;
210
-
211
- .current-page-info {
212
- padding: 0 16px;
213
- ${(0, _typography.ComponentXSStyling)(_typography.ComponentTextStyle.Regular, _styles.COLORS.black)}
214
- }
215
-
216
- .controls {
217
- display: flex;
218
- }
219
- }
99
+ &:active {
100
+ background-color: ${_styles.COLORS.primary_100};
101
+ color: ${_styles.COLORS.primary_800};
102
+ box-shadow: none !important;
103
+ z-index: ${_zIndexes.Z_INDEXES.active};
220
104
  }
221
105
 
106
+ &:focus {
107
+ outline: none;
108
+ box-shadow: 0 4px 12px ${_styles.COLORS.focus_25}, 0 0 8px ${_styles.COLORS.focus};
109
+ z-index: ${_zIndexes.Z_INDEXES.focus};
110
+ }
111
+ }
112
+
113
+ &.sortable ${StyledTableHeaderColumnContent} > svg {
114
+ opacity: 0;
115
+ }
116
+
117
+ &.sortable.sorted ${StyledTableHeaderColumnContent} > svg {
118
+ opacity: 1;
119
+ }
120
+
121
+ &.sorted {
122
+ background-color: ${_styles.COLORS.neutral_20};
123
+ }
124
+
125
+ `;
126
+ const StyledTableBodyRow = exports.StyledTableBodyRow = _styledComponents2.default.tr`
127
+ cursor: pointer;
128
+ position: relative;
129
+ outline: none;
130
+
131
+ &:hover {
132
+ background-color: ${_styles.COLORS.primary_200};
133
+ z-index: ${_zIndexes.Z_INDEXES.hover};
134
+ }
135
+
136
+ &:focus {
137
+ background-color: ${_styles.COLORS.primary_200};
138
+ box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;
139
+ z-index: ${_zIndexes.Z_INDEXES.focus};
140
+ outline: none;
141
+ }
142
+
143
+ &:active {
144
+ box-shadow: none;
145
+ z-index: ${_zIndexes.Z_INDEXES.active};
146
+ }
147
+
148
+ `;
149
+ const StyledTableBody = exports.StyledTableBody = _styledComponents2.default.tbody`
150
+ ${StyledTableBodyRow}:nth-child(odd):not(:hover):not(:focus):not(:active) {
151
+ background-color: ${_styles.COLORS.neutral_100};
152
+ }
153
+
154
+ ${StyledTableBodyRow}:nth-child(even):not(:hover):not(:focus):not(:active) {
155
+ background-color: ${_styles.COLORS.neutral_20};
156
+ }
157
+ `;
158
+ const StyledTableCell = exports.StyledTableCell = _styledComponents2.default.td``;
159
+ const StyledTableCellContent = exports.StyledTableCellContent = _styledComponents2.default.div`
160
+ min-height: 48px;
161
+
162
+ padding: 0 16px;
163
+ ${(0, _typography.ComponentSStyling)(_typography.ComponentTextStyle.Regular, _styles.COLORS.black)}
164
+
165
+ display: flex;
166
+ align-items: center;
167
+ justify-content: left;
168
+ gap: 8px;
169
+
170
+ &.truncate-text,
171
+ &.truncate-text span {
172
+ overflow: hidden;
173
+ text-overflow: ellipsis;
174
+ white-space: nowrap;
175
+ }
176
+
177
+ &.left {
178
+ justify-content: left;
179
+ }
180
+
181
+ &.right {
182
+ justify-content: right;
183
+ }
184
+
185
+ &.center {
186
+ justify-content: center;
187
+ }
188
+
189
+ a:first-letter,
190
+ span:first-letter {
191
+ text-transform: uppercase;
192
+ }
193
+ `;
194
+ const StyledTableCellIcon = exports.StyledTableCellIcon = _styledComponents2.default.div`
195
+ color: ${_styles.COLORS.neutral_700};
196
+ width: 24px;
197
+ height: 24px;
198
+
199
+ svg {
200
+ color: ${_styles.COLORS.neutral_700};
201
+ width: 24px;
202
+ height: 24px;
203
+ }
204
+ `;
205
+ const StyledTableCellText = exports.StyledTableCellText = _styledComponents2.default.span`
206
+ padding: 12px 0;
207
+ `;
208
+ const StyledTableFooter = exports.StyledTableFooter = _styledComponents2.default.tfoot`
209
+ `;
210
+ const StyledTableFooterContent = exports.StyledTableFooterContent = _styledComponents2.default.div`
211
+ border-top: 2px solid ${_styles.COLORS.neutral_200};
212
+ border-bottom: 1px solid ${_styles.COLORS.neutral_200};
213
+ box-sizing: border-box;
214
+ min-height: 56px;
215
+
216
+ display: flex;
217
+ align-items: center;
218
+ justify-content: right;
219
+
220
+ `;
221
+ const StyledTableFooterCurrentInfo = exports.StyledTableFooterCurrentInfo = _styledComponents2.default.span`
222
+ padding: 0 16px;
223
+ ${(0, _typography.ComponentXSStyling)(_typography.ComponentTextStyle.Regular, _styles.COLORS.black)}
224
+ `;
225
+ const StyledTableFooterControls = exports.StyledTableFooterControls = _styledComponents2.default.div`
226
+ display: flex;
227
+ `;
228
+ const StyledTableSpinner = exports.StyledTableSpinner = _styledComponents2.default.div`
229
+ height: 100%;
230
+ width: 100%;
231
+ position: absolute;
232
+ background-color: rgba(0, 0, 0, 0.5);
233
+ top: 0;
234
+ `;
235
+ const StyledTableFooterCollapseButton = exports.StyledTableFooterCollapseButton = _styledComponents2.default.button`
236
+ position: relative;
237
+ border-bottom: 1px solid ${_styles.COLORS.neutral_200};
238
+ border-top: 1px solid ${_styles.COLORS.neutral_200};
239
+ border-left: none;
240
+ border-right: none;
241
+ box-sizing: border-box;
242
+ min-height: 48px;
243
+ display: flex;
244
+ width: 100%;
245
+ align-items: center;
246
+ justify-content: center;
247
+ gap: 4px;
248
+ background: ${_styles.COLORS.white};
249
+
250
+ cursor: pointer;
251
+
252
+ ${(0, _typography.ComponentMStyling)(_typography.ComponentTextStyle.Bold, _styles.COLORS.neutral_800)}
253
+ &:focus {
254
+ outline: none;
255
+ z-index: ${_zIndexes.Z_INDEXES.focus};
256
+ color: ${_styles.COLORS.neutral_600};
257
+ box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;
258
+ }
259
+
260
+ &:hover {
261
+ z-index: ${_zIndexes.Z_INDEXES.hover};
262
+ background: ${_styles.COLORS.primary_20};
263
+ color: ${_styles.COLORS.primary_700};
222
264
  }
223
265
 
224
- .table-spinner {
225
- height: 100%;
226
- width: 100%;
227
- position: absolute;
228
- background-color: rgba(0, 0, 0, 0.5);
229
- top: 0;
266
+ &:active {
267
+ box-shadow: none;
268
+ z-index: ${_zIndexes.Z_INDEXES.active};
269
+ background: ${_styles.COLORS.primary_100};
270
+ color: ${_styles.COLORS.primary_800};
230
271
  }
272
+
273
+ &:disabled {
274
+ display: none;
275
+ }
276
+
231
277
  `;
232
278
  });
233
279
  //# sourceMappingURL=TableStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Table/TableStyles.ts"],"names":["TableWrapper","styled","div","COLORS","neutral_200","ComponentLStyling","ComponentTextStyle","ComponentSStyling","white","primary_20","primary_700","Z_INDEXES","hover","primary_100","primary_800","active","focus_25","focus","neutral_700","neutral_100","primary_200","ComponentXSStyling"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;AAEO,QAAMA,YAAY,WAAZA,YAAY,GAAGC,2BAAOC,GAAI;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmCC,eAAOC,WAAY;AACtD,gCAAgCD,eAAOC,WAAY;AACnD;AACA;AACA,UAAUC,mCAAkBC,+BAAD,IAAjBD,EAA2CF,eAA1B,KAAjBE,CAAyD;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAYE,mCAAkBD,+BAAD,IAAjBC,EAA2CJ,eAA1B,WAAjBI,CAA+D;AAC3E;AACA;AACA,8BAA8BJ,eAAOK,KAAM;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoCL,eAAOC,WAAY;AACvD,uCAAuCD,eAAOC,WAAY;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkCD,eAAOM,UAAW;AACpD,uBAAuBN,eAAOO,WAAY;AAC1C,yBAAyBC,oBAAUC,KAAM;AACzC;AACA;AACA;AACA,kCAAkCT,eAAOU,WAAY;AACrD,uBAAuBV,eAAOW,WAAY;AAC1C;AACA,yBAAyBH,oBAAUI,MAAO;AAC1C;AACA;AACA;AACA;AACA,uCAAuCZ,eAAOa,QAAS,aAAYb,eAAOc,KAAM;AAChF,yBAAyBN,oBAAUM,KAAM;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcV,mCAAkBD,+BAAD,OAAjBC,EAAiB,IAAjBA,CAAoD;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqBJ,eAAOe,WAAY;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4Bf,eAAOgB,WAAY;AAC/C;AACA;AACA;AACA,4BAA4BhB,eAAOK,KAAM;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8BL,eAAOiB,WAAY;AACjD,qBAAqBT,oBAAUC,KAAM;AACrC;AACA;AACA;AACA;AACA,qBAAqBD,oBAAUI,MAAO;AACtC;AACA;AACA;AACA,8BAA8BZ,eAAOiB,WAAY;AACjD;AACA,qBAAqBT,oBAAUM,KAAM;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgCd,eAAOC,WAAY;AACnD,mCAAmCD,eAAOC,WAAY;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAYiB,oCAAmBf,+BAAD,OAAlBe,EAA+ClB,eAA7B,KAAlBkB,CAA6D;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9LO,CAAA","sourcesContent":["/**\n * Import third-party libraries.\n */\nimport styled from 'styled-components';\n\n/**\n * Import custom style properties.\n */\nimport {COLORS} from '../styles';\nimport {\n ComponentLStyling,\n ComponentMStyling,\n ComponentSStyling,\n ComponentTextStyle,\n ComponentXSStyling\n} from '../styles/typography';\nimport {Z_INDEXES} from '../styles/z-indexes';\n\n/**\n * Table styles\n */\n\nexport const TableWrapper = styled.div`\n position: relative;\n\n .table {\n\n background: transparent;\n width: 100%;\n\n .table-header {\n .table-header-title .title-content {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n box-sizing: border-box;\n min-height: 56px;\n border-bottom: 1px solid ${COLORS.neutral_200};\n border-top: 2px solid ${COLORS.neutral_200};\n padding: 0 16px;\n\n ${ComponentLStyling(ComponentTextStyle.Bold, COLORS.black)}\n .title-menu {\n margin-right: -16px;\n }\n }\n\n .table-header-columns {\n\n .table-header-column {\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n position: relative;\n\n background-color: ${COLORS.white};\n\n //fixes header heights no idea why\n height: 1px;\n\n .header-content {\n box-sizing: border-box;\n min-height: 56px;\n padding: 0 16px;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-top: 1px solid ${COLORS.neutral_200};\n border-bottom: 1px solid ${COLORS.neutral_200};\n }\n\n &.sortable {\n cursor: pointer;\n\n &:hover {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n z-index: ${Z_INDEXES.hover};\n }\n\n &:active {\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n box-shadow: none !important;\n z-index: ${Z_INDEXES.active};\n }\n\n &:focus {\n outline: none;\n box-shadow: 0 4px 12px ${COLORS.focus_25}, 0 0 8px ${COLORS.focus};\n z-index: ${Z_INDEXES.focus};\n }\n }\n\n &.sortable .header-content > svg {\n opacity: 0;\n }\n\n &.sortable.sorted .header-content > svg {\n opacity: 1;\n }\n }\n }\n }\n\n .table-body {\n .table-row {\n position: relative;\n\n outline: none;\n\n .table-cell {\n .table-cell-content {\n min-height: 48px;\n\n padding: 0 16px;\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\n\n display: flex;\n align-items: center;\n gap: 8px;\n\n &.truncate-text,\n &.truncate-text span {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &.left {\n justify-content: left;\n }\n\n &.right {\n justify-content: right;\n }\n\n &.center {\n justify-content: center;\n }\n }\n\n .table-cell-icon,\n .table-cell-icon svg {\n color: ${COLORS.neutral_700};\n width: 24px;\n height: 24px;\n }\n }\n }\n\n .table-row:nth-child(odd) {\n background-color: ${COLORS.neutral_100};\n }\n\n .table-row:nth-child(even) {\n background-color: ${COLORS.white};\n }\n\n .table-row {\n cursor: pointer;\n\n &:hover {\n background-color: ${COLORS.primary_200};\n z-index: ${Z_INDEXES.hover};\n }\n\n &:active {\n box-shadow: none !important;\n z-index: ${Z_INDEXES.active};\n }\n\n &:focus {\n background-color: ${COLORS.primary_200};\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;\n z-index: ${Z_INDEXES.focus};\n outline: none;\n }\n }\n\n }\n\n .table-footer {\n .footer-content {\n border-top: 2px solid ${COLORS.neutral_200};\n border-bottom: 1px solid ${COLORS.neutral_200};\n box-sizing: border-box;\n min-height: 56px;\n\n display: flex;\n align-items: center;\n justify-content: right;\n\n .current-page-info {\n padding: 0 16px;\n ${ComponentXSStyling(ComponentTextStyle.Regular, COLORS.black)}\n }\n\n .controls {\n display: flex;\n }\n }\n }\n\n }\n\n .table-spinner {\n height: 100%;\n width: 100%;\n position: absolute;\n background-color: rgba(0, 0, 0, 0.5);\n top: 0;\n }\n`;\n"],"file":"TableStyles.js"}
1
+ {"version":3,"sources":["../../../src/Table/TableStyles.ts"],"names":["TableWrapper","styled","div","StyledTable","table","StyledTableHeader","thead","StyledTableHeaderTitle","tr","StyledTableHeaderTitleContent","COLORS","neutral_200","ComponentLStyling","ComponentTextStyle","StyledTableHeaderColumns","StyledTableHeaderColumnContent","StyledTableHeaderColumn","th","ComponentSStyling","white","primary_20","primary_700","Z_INDEXES","hover","primary_100","primary_800","active","focus_25","focus","neutral_20","StyledTableBodyRow","primary_200","StyledTableBody","tbody","neutral_100","StyledTableCell","td","StyledTableCellContent","StyledTableCellIcon","neutral_700","StyledTableCellText","span","StyledTableFooter","tfoot","StyledTableFooterContent","StyledTableFooterCurrentInfo","ComponentXSStyling","StyledTableFooterControls","StyledTableSpinner","StyledTableFooterCollapseButton","button","ComponentMStyling","neutral_600"],"mappings":"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","sourcesContent":["/**\n * Import third-party libraries.\n */\nimport styled from 'styled-components';\n\n/**\n * Import custom style properties.\n */\nimport {COLORS} from '../styles';\nimport {\n ComponentLStyling,\n ComponentMStyling,\n ComponentSStyling,\n ComponentTextStyle,\n ComponentXSStyling\n} from '../styles/typography';\nimport {Z_INDEXES} from '../styles/z-indexes';\n\n/**\n * Table styles\n */\n\nexport const TableWrapper = styled.div`\n position: relative;\n`;\n\n\nexport const StyledTable = styled.table`\n background: transparent;\n width: 100%;\n table-layout: fixed;\n`;\n\nexport const StyledTableHeader = styled.thead`\n`;\n\nexport const StyledTableHeaderTitle = styled.tr`\n`;\n\nexport const StyledTableHeaderTitleContent = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n box-sizing: border-box;\n min-height: 56px;\n border-bottom: 1px solid ${COLORS.neutral_200};\n border-top: 2px solid ${COLORS.neutral_200};\n padding: 0 16px;\n\n ${ComponentLStyling(ComponentTextStyle.Bold, COLORS.black)}\n .title-menu {\n margin-right: -16px;\n }\n`;\n\nexport const StyledTableHeaderColumns = styled.tr`\n`;\n\nexport const StyledTableHeaderColumnContent = styled.div`\n box-sizing: border-box;\n min-height: 56px;\n padding: 0 16px;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-top: 1px solid ${COLORS.neutral_200};\n border-bottom: 1px solid ${COLORS.neutral_200};\n`;\n\nexport const StyledTableHeaderColumn = styled.th`\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n position: relative;\n\n background-color: ${COLORS.white};\n\n //fixes header heights no idea why\n height: 1px;\n\n &.sortable {\n cursor: pointer;\n\n &:hover {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n z-index: ${Z_INDEXES.hover};\n }\n\n &:active {\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n box-shadow: none !important;\n z-index: ${Z_INDEXES.active};\n }\n\n &:focus {\n outline: none;\n box-shadow: 0 4px 12px ${COLORS.focus_25}, 0 0 8px ${COLORS.focus};\n z-index: ${Z_INDEXES.focus};\n }\n }\n\n &.sortable ${StyledTableHeaderColumnContent} > svg {\n opacity: 0;\n }\n\n &.sortable.sorted ${StyledTableHeaderColumnContent} > svg {\n opacity: 1;\n }\n\n &.sorted {\n background-color: ${COLORS.neutral_20};\n }\n\n`;\n\nexport const StyledTableBodyRow = styled.tr`\n cursor: pointer;\n position: relative;\n outline: none;\n\n &:hover {\n background-color: ${COLORS.primary_200};\n z-index: ${Z_INDEXES.hover};\n }\n\n &:focus {\n background-color: ${COLORS.primary_200};\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;\n z-index: ${Z_INDEXES.focus};\n outline: none;\n }\n\n &:active {\n box-shadow: none;\n z-index: ${Z_INDEXES.active};\n }\n\n`;\n\nexport const StyledTableBody = styled.tbody`\n ${StyledTableBodyRow}:nth-child(odd):not(:hover):not(:focus):not(:active) {\n background-color: ${COLORS.neutral_100};\n }\n\n ${StyledTableBodyRow}:nth-child(even):not(:hover):not(:focus):not(:active) {\n background-color: ${COLORS.neutral_20};\n }\n`;\n\n\nexport const StyledTableCell = styled.td``;\n\nexport const StyledTableCellContent = styled.div`\n min-height: 48px;\n\n padding: 0 16px;\n ${ComponentSStyling(ComponentTextStyle.Regular, COLORS.black)}\n\n display: flex;\n align-items: center;\n justify-content: left;\n gap: 8px;\n\n &.truncate-text,\n &.truncate-text span {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &.left {\n justify-content: left;\n }\n\n &.right {\n justify-content: right;\n }\n\n &.center {\n justify-content: center;\n }\n\n a:first-letter,\n span:first-letter {\n text-transform: uppercase;\n }\n`;\n\nexport const StyledTableCellIcon = styled.div`\n color: ${COLORS.neutral_700};\n width: 24px;\n height: 24px;\n\n svg {\n color: ${COLORS.neutral_700};\n width: 24px;\n height: 24px;\n }\n`;\n\nexport const StyledTableCellText = styled.span`\n padding: 12px 0;\n`;\n\n\nexport const StyledTableFooter = styled.tfoot`\n`;\n\nexport const StyledTableFooterContent = styled.div`\n border-top: 2px solid ${COLORS.neutral_200};\n border-bottom: 1px solid ${COLORS.neutral_200};\n box-sizing: border-box;\n min-height: 56px;\n\n display: flex;\n align-items: center;\n justify-content: right;\n\n`;\n\nexport const StyledTableFooterCurrentInfo = styled.span`\n padding: 0 16px;\n ${ComponentXSStyling(ComponentTextStyle.Regular, COLORS.black)}\n`;\n\nexport const StyledTableFooterControls = styled.div`\n display: flex;\n`;\n\nexport const StyledTableSpinner = styled.div`\n height: 100%;\n width: 100%;\n position: absolute;\n background-color: rgba(0, 0, 0, 0.5);\n top: 0;\n`;\n\nexport const StyledTableFooterCollapseButton = styled.button`\n position: relative;\n border-bottom: 1px solid ${COLORS.neutral_200};\n border-top: 1px solid ${COLORS.neutral_200};\n border-left: none;\n border-right: none;\n box-sizing: border-box;\n min-height: 48px;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n gap: 4px;\n background: ${COLORS.white};\n\n cursor: pointer;\n\n ${ComponentMStyling(ComponentTextStyle.Bold, COLORS.neutral_800)}\n &:focus {\n outline: none;\n z-index: ${Z_INDEXES.focus};\n color: ${COLORS.neutral_600};\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;\n }\n\n &:hover {\n z-index: ${Z_INDEXES.hover};\n background: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n }\n\n &:active {\n box-shadow: none;\n z-index: ${Z_INDEXES.active};\n background: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n\n &:disabled {\n display: none;\n }\n\n`;\n"],"file":"TableStyles.js"}
@@ -1,16 +1,16 @@
1
1
  (function (global, factory) {
2
2
  if (typeof define === "function" && define.amd) {
3
- define(["react", "@testing-library/react", "../index", "jest-styled-components"], factory);
3
+ define(["react", "@testing-library/react", "../index", "../TableStyles", "react-dom/test-utils", "jest-styled-components"], factory);
4
4
  } else if (typeof exports !== "undefined") {
5
- factory(require("react"), require("@testing-library/react"), require("../index"), require("jest-styled-components"));
5
+ factory(require("react"), require("@testing-library/react"), require("../index"), require("../TableStyles"), require("react-dom/test-utils"), require("jest-styled-components"));
6
6
  } else {
7
7
  var mod = {
8
8
  exports: {}
9
9
  };
10
- factory(global.react, global.react, global.index, global.jestStyledComponents);
10
+ factory(global.react, global.react, global.index, global.TableStyles, global.testUtils, global.jestStyledComponents);
11
11
  global.undefined = mod.exports;
12
12
  }
13
- })(this, function (_react, _react3, _index) {
13
+ })(this, function (_react, _react3, _index, _TableStyles, _testUtils) {
14
14
  "use strict";
15
15
 
16
16
  var _react2 = _interopRequireDefault(_react);
@@ -314,6 +314,166 @@
314
314
  }));
315
315
  expect(getByTestId('TestTableFooterRow')).toBeDefined();
316
316
  });
317
+ describe('Table Accordion tests', () => {
318
+ it('Should render collapse button when configured as accordion', () => {
319
+ const columns = [{
320
+ key: 'column1',
321
+ name: 'Column 1'
322
+ }, {
323
+ key: 'column2',
324
+ name: 'Column 2'
325
+ }];
326
+ const rows = [{
327
+ column1: 'Test content',
328
+ column2: 'Test content 2'
329
+ }, {
330
+ column1: 'Test content',
331
+ column2: 'Test content 2'
332
+ }, {
333
+ column1: 'Test content',
334
+ column2: 'Test content 2'
335
+ }, {
336
+ column1: 'Test content',
337
+ column2: 'Test content 2'
338
+ }];
339
+ const wrapper = (0, _react3.render)( /*#__PURE__*/_react2.default.createElement(_index.Table, {
340
+ rows: rows,
341
+ columns: columns,
342
+ accordion: true,
343
+ collapsedRows: 3
344
+ }));
345
+ expect(wrapper.container.querySelectorAll(`${_TableStyles.StyledTableFooterCollapseButton}`)).toHaveLength(1);
346
+ });
347
+ it('Should not render all items when collapsed', () => {
348
+ const columns = [{
349
+ key: 'column1',
350
+ name: 'Column 1'
351
+ }, {
352
+ key: 'column2',
353
+ name: 'Column 2'
354
+ }];
355
+ const rows = [{
356
+ column1: 'Test content',
357
+ column2: 'Test content 2'
358
+ }, {
359
+ column1: 'Test content',
360
+ column2: 'Test content 2'
361
+ }, {
362
+ column1: 'Test content',
363
+ column2: 'Test content 2'
364
+ }, {
365
+ column1: 'Test content',
366
+ column2: 'Test content 2'
367
+ }];
368
+ const wrapper = (0, _react3.render)( /*#__PURE__*/_react2.default.createElement(_index.Table, {
369
+ rows: rows,
370
+ columns: columns,
371
+ accordion: true,
372
+ collapsedRows: 3
373
+ }));
374
+ expect(wrapper.container.querySelectorAll(`${_TableStyles.StyledTableBodyRow}`)).toHaveLength(3);
375
+ });
376
+ it('Should render all items when not collapsed', () => {
377
+ const columns = [{
378
+ key: 'column1',
379
+ name: 'Column 1'
380
+ }, {
381
+ key: 'column2',
382
+ name: 'Column 2'
383
+ }];
384
+ const rows = [{
385
+ column1: 'Test content',
386
+ column2: 'Test content 2'
387
+ }, {
388
+ column1: 'Test content',
389
+ column2: 'Test content 2'
390
+ }, {
391
+ column1: 'Test content',
392
+ column2: 'Test content 2'
393
+ }, {
394
+ column1: 'Test content',
395
+ column2: 'Test content 2'
396
+ }];
397
+ const wrapper = (0, _react3.render)( /*#__PURE__*/_react2.default.createElement(_index.Table, {
398
+ rows: rows,
399
+ columns: columns,
400
+ accordion: true,
401
+ collapsedRows: 3,
402
+ collapsed: false
403
+ }));
404
+ expect(wrapper.container.querySelectorAll(`${_TableStyles.StyledTableBodyRow}`)).toHaveLength(4);
405
+ });
406
+ it('Should expand when show more button is clicked', () => {
407
+ const columns = [{
408
+ key: 'column1',
409
+ name: 'Column 1'
410
+ }, {
411
+ key: 'column2',
412
+ name: 'Column 2'
413
+ }];
414
+ const rows = [{
415
+ column1: 'Test content',
416
+ column2: 'Test content 2'
417
+ }, {
418
+ column1: 'Test content',
419
+ column2: 'Test content 2'
420
+ }, {
421
+ column1: 'Test content',
422
+ column2: 'Test content 2'
423
+ }, {
424
+ column1: 'Test content',
425
+ column2: 'Test content 2'
426
+ }];
427
+ const wrapper = (0, _react3.render)( /*#__PURE__*/_react2.default.createElement(_index.Table, {
428
+ rows: rows,
429
+ columns: columns,
430
+ accordion: true,
431
+ collapsedRows: 3,
432
+ collapsed: true
433
+ }));
434
+ expect(wrapper.container.querySelectorAll(`${_TableStyles.StyledTableBodyRow}`)).toHaveLength(3);
435
+ (0, _testUtils.act)(() => {
436
+ let button = wrapper.container.querySelectorAll(`${_TableStyles.StyledTableFooterCollapseButton}`)[0];
437
+ button.click();
438
+ });
439
+ expect(wrapper.container.querySelectorAll(`${_TableStyles.StyledTableBodyRow}`)).toHaveLength(4);
440
+ });
441
+ it('Should collapse when show less button is clicked', () => {
442
+ const columns = [{
443
+ key: 'column1',
444
+ name: 'Column 1'
445
+ }, {
446
+ key: 'column2',
447
+ name: 'Column 2'
448
+ }];
449
+ const rows = [{
450
+ column1: 'Test content',
451
+ column2: 'Test content 2'
452
+ }, {
453
+ column1: 'Test content',
454
+ column2: 'Test content 2'
455
+ }, {
456
+ column1: 'Test content',
457
+ column2: 'Test content 2'
458
+ }, {
459
+ column1: 'Test content',
460
+ column2: 'Test content 2'
461
+ }];
462
+ const wrapper = (0, _react3.render)( /*#__PURE__*/_react2.default.createElement(_index.Table, {
463
+ rows: rows,
464
+ columns: columns,
465
+ accordion: true,
466
+ collapsedRows: 3,
467
+ collapsed: false
468
+ }));
469
+ expect(wrapper.container.querySelectorAll(`${_TableStyles.StyledTableBodyRow}`)).toHaveLength(4);
470
+ (0, _testUtils.act)(() => {
471
+ let button = wrapper.container.querySelectorAll(`${_TableStyles.StyledTableFooterCollapseButton}`)[0];
472
+ button.click();
473
+ });
474
+ expect(wrapper.container.querySelectorAll(`${_TableStyles.StyledTableBodyRow}`)).toHaveLength(3);
475
+ });
476
+ });
317
477
  });
318
478
  });
319
479
  //# sourceMappingURL=Table.test.js.map