@ampath/esm-reports-app 1.0.0-next.103 → 1.0.0-next.104

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.
@@ -1,29 +1,8 @@
1
- @use 'sass:list';
2
- @use '@carbon/colors';
3
1
  @use '@carbon/layout';
4
2
  @use '@carbon/motion';
5
3
  @use '@carbon/type';
6
4
  @use '@openmrs/esm-styleguide/src/vars' as *;
7
5
 
8
- $tones: (
9
- 'violet': (
10
- colors.$purple-60,
11
- colors.$purple-10,
12
- ),
13
- 'magenta': (
14
- colors.$magenta-60,
15
- colors.$magenta-10,
16
- ),
17
- 'teal': (
18
- colors.$teal-60,
19
- colors.$teal-10,
20
- ),
21
- 'blue': (
22
- colors.$blue-60,
23
- colors.$blue-10,
24
- ),
25
- );
26
-
27
6
  .dashboard {
28
7
  /* `.page` in root.scss gives every route this side gutter. The dashboard
29
8
  reaches over it so its grey runs edge to edge, then pads it back. */
@@ -76,157 +55,265 @@ $tones: (
76
55
  white-space: nowrap;
77
56
  }
78
57
 
79
- /* Toolbar */
58
+ /* The row over each tab's sheet: the report groups as a plain text
59
+ sub-navigation (or the registers' count) at the left, the search at the
60
+ right, over a hairline; the open group is underlined in the brand colour */
80
61
 
81
- .toolbar {
82
- /* the tiles' columns, so the search box is exactly one tile wide and the
83
- count ends at the grid's right edge */
84
- display: grid;
85
- grid-template-columns: repeat(3, 1fr);
62
+ .groupBar {
63
+ display: flex;
86
64
  align-items: center;
87
- gap: layout.$spacing-04;
65
+ justify-content: space-between;
66
+ gap: layout.$spacing-05;
88
67
  margin-bottom: layout.$spacing-05;
68
+ border-bottom: 1px solid $ui-03;
69
+ }
70
+
71
+ /* without group links (Registers) there is nothing to underline, so no hairline */
72
+ .plainBar {
73
+ border-bottom: none;
74
+
75
+ /* the count and search level with each other */
76
+ .barCount {
77
+ padding: 0;
78
+ }
79
+
80
+ .groupSearch {
81
+ margin-bottom: 0;
82
+ }
83
+ }
84
+
85
+ .groupNav {
86
+ display: flex;
87
+ gap: layout.$spacing-07;
88
+ /* the links' underline sits on the bar's hairline */
89
+ margin-bottom: -1px;
90
+ }
91
+
92
+ .groupLink {
93
+ @include type.type-style('body-compact-01');
94
+ display: inline-flex;
95
+ align-items: center;
96
+ gap: layout.$spacing-03;
97
+ padding: layout.$spacing-05 0 layout.$spacing-04;
98
+ font-family: inherit;
99
+ color: $text-02;
100
+ white-space: nowrap;
101
+ cursor: pointer;
102
+ background: none;
103
+ border: none;
104
+ border-bottom: 2px solid transparent;
105
+ transition: all motion.$duration-fast-02 motion.motion(standard, productive);
106
+
107
+ &:hover {
108
+ color: $color-gray-100;
109
+ border-bottom-color: $ui-04;
110
+ }
111
+
112
+ &:focus-visible {
113
+ outline: 2px solid var(--brand-01);
114
+ outline-offset: -2px;
115
+ }
116
+
117
+ &[aria-pressed='true'] {
118
+ font-weight: 600;
119
+ color: $color-gray-100;
120
+ border-bottom-color: var(--brand-01);
121
+
122
+ .countBadge {
123
+ color: $ui-02;
124
+ background-color: var(--brand-01);
125
+ }
126
+ }
127
+ }
128
+
129
+ /* the count in place of the group links, e.g. on the Registers tab */
130
+ .barCount {
131
+ @include type.type-style('body-compact-01');
132
+ padding: layout.$spacing-05 0 layout.$spacing-04;
133
+ color: $text-02;
134
+ white-space: nowrap;
135
+ }
136
+
137
+ /* the short title only on a phone */
138
+ .groupLinkShort {
139
+ display: none;
140
+ }
141
+
142
+ /* a count as a small rounded badge: grey, the brand colour on the open
143
+ group or tab */
144
+ .countBadge {
145
+ @include type.type-style('label-01');
146
+ min-width: 1.5rem;
147
+ padding: 0 layout.$spacing-02;
148
+ font-weight: 600;
149
+ line-height: 1.25rem;
150
+ text-align: center;
151
+ color: $color-gray-100;
152
+ background-color: $ui-03;
153
+ border-radius: 0.625rem;
154
+ transition: all motion.$duration-fast-02 motion.motion(standard, productive);
155
+
156
+ /* outlined: nothing in the group (or nothing matching the search) */
157
+ &[data-empty='true'] {
158
+ font-weight: 400;
159
+ color: $text-02;
160
+ background-color: transparent;
161
+ box-shadow: inset 0 0 0 1px $ui-03;
162
+ }
89
163
  }
90
164
 
91
- .searchLayer {
92
- /* two tiles wide, edges lined up with the first two tiles */
93
- grid-column: 1 / span 2;
165
+ .groupSearch {
166
+ flex: 0 1 20rem;
167
+ min-width: 12rem;
168
+ /* level with the links' text, clear of the hairline */
169
+ margin-bottom: layout.$spacing-03;
94
170
 
95
- /* a white field with a thin outline, and the brand colour on focus */
171
+ /* a small, quiet field: white with a hairline, grey icon and placeholder,
172
+ both darkening on hover and focus */
96
173
  :global(.cds--search-input) {
174
+ @include type.type-style('body-compact-01');
97
175
  background-color: $ui-02;
98
176
  border: 1px solid $ui-03;
177
+ border-bottom-color: $ui-03;
178
+ transition: border-color motion.$duration-fast-02 motion.motion(standard, productive);
179
+
180
+ &::placeholder {
181
+ color: $text-02;
182
+ }
99
183
 
100
184
  &:hover {
101
185
  border-color: $ui-04;
102
186
  }
103
187
 
104
188
  &:focus {
105
- outline: 2px solid var(--brand-01);
189
+ border-color: var(--brand-01);
190
+ outline: 1px solid var(--brand-01);
106
191
  outline-offset: -2px;
107
192
  }
108
193
  }
194
+
195
+ :global(.cds--search-magnifier-icon) {
196
+ fill: $text-02;
197
+ }
198
+
199
+ :global(.cds--search:focus-within .cds--search-magnifier-icon) {
200
+ fill: $color-gray-100;
201
+ }
109
202
  }
110
203
 
111
- .resultCount {
112
- @include type.type-style('label-01');
113
- grid-column: -2 / -1;
114
- justify-self: end;
115
- color: $text-02;
116
- white-space: nowrap;
204
+ /* Each tab's list: one white sheet holding a table of two sides, each
205
+ category's name in one merged cell at the left, its items as rows at the
206
+ right */
207
+ .sheet {
208
+ background-color: $ui-02;
209
+ border: 1px solid $ui-03;
117
210
  }
118
211
 
119
- /* Categories */
212
+ .categoryTable {
213
+ width: 100%;
214
+ border-collapse: collapse;
120
215
 
121
- .category {
122
- margin-bottom: layout.$spacing-06;
123
- }
216
+ /* a firmer rule between categories */
217
+ tbody + tbody {
218
+ border-top: 1px solid $ui-03;
219
+ }
124
220
 
125
- .categoryHeader {
126
- display: flex;
127
- align-items: center;
128
- gap: layout.$spacing-03;
129
- padding-left: layout.$spacing-03;
130
- margin-bottom: layout.$spacing-04;
131
- border-left: layout.$spacing-02 solid $ui-04;
221
+ /* a faint one between the items of a category */
222
+ tbody tr + tr .itemCell {
223
+ border-top: 1px solid $ui-01;
224
+ }
132
225
  }
133
226
 
134
- .categoryTitle {
227
+ /* the merged cell: the category's name, centred on its rows, on a faint grey
228
+ so the two sides read as label and list */
229
+ .categoryCell {
135
230
  @include type.type-style('productive-heading-01');
231
+ width: 14rem;
232
+ padding: layout.$spacing-04 layout.$spacing-05;
233
+ text-align: left;
234
+ vertical-align: middle;
136
235
  color: $color-gray-100;
236
+ background-color: color-mix(in srgb, #{$ui-01} 60%, #{$ui-02});
237
+ border-right: 1px solid $ui-03;
137
238
  }
138
239
 
139
- .grid {
140
- display: grid;
141
- grid-template-columns: repeat(3, 1fr);
142
- gap: layout.$spacing-04;
143
- }
240
+ .itemCell {
241
+ padding: 0;
144
242
 
145
- /* Report tiles. Selectors are nested under `.grid` so they win over the
146
- Carbon tile styles the app shell loads globally. */
243
+ .sheetRow {
244
+ padding-right: layout.$spacing-05;
245
+ padding-left: layout.$spacing-05;
246
+ }
247
+ }
147
248
 
148
- .grid .tile {
149
- position: relative;
150
- display: flex;
249
+ .sheetRow {
250
+ display: grid;
251
+ /* the codes in one column, wide enough for the longest, MOH/REG/DNTLDP/02 */
252
+ grid-template-columns: 9rem minmax(0, 1fr) auto;
151
253
  align-items: center;
152
254
  gap: layout.$spacing-04;
153
- min-height: 0;
154
- padding: layout.$spacing-04;
155
- background-color: $ui-02;
156
- border: 1px solid $ui-03;
157
- border-left: layout.$spacing-02 solid $ui-04;
158
- text-decoration: none;
255
+ width: 100%;
256
+ padding: layout.$spacing-04 layout.$spacing-03;
257
+ font: inherit;
258
+ text-align: left;
259
+ color: inherit;
260
+ cursor: pointer;
261
+ background: none;
262
+ border: none;
159
263
  transition: all motion.$duration-fast-02 motion.motion(standard, productive);
160
264
 
161
265
  &:hover {
162
- background-color: $ui-02;
163
- border-color: $ui-04;
164
- box-shadow: 0 layout.$spacing-02 layout.$spacing-05 rgba(0, 0, 0, 0.1);
266
+ background-color: $ui-01;
267
+ /* a thin brand bar at the row's left edge */
268
+ box-shadow: inset 2px 0 0 var(--brand-01);
269
+
270
+ .sheetName {
271
+ color: var(--brand-01);
272
+ }
165
273
 
166
- .tileArrow {
167
- transform: translateX(layout.$spacing-02);
274
+ .sheetArrow {
275
+ opacity: 1;
168
276
  }
169
277
  }
170
- }
171
278
 
172
- .tileIcon {
173
- display: flex;
174
- align-items: center;
175
- justify-content: center;
176
- flex-shrink: 0;
177
- width: layout.$spacing-07;
178
- height: layout.$spacing-07;
179
- background-color: $ui-01;
180
- }
279
+ &:focus-visible {
280
+ outline: 2px solid var(--brand-01);
281
+ outline-offset: -2px;
181
282
 
182
- .tileCopy {
183
- min-width: 0;
283
+ .sheetArrow {
284
+ opacity: 1;
285
+ }
286
+ }
184
287
  }
185
288
 
186
- .tileCode {
187
- @include type.type-style('label-01');
289
+ /* the form number as a small grey chip, in mono so the numbers line up */
290
+ .sheetCode {
291
+ @include type.type-style('code-01');
292
+ justify-self: start;
293
+ padding: 0 layout.$spacing-02;
188
294
  color: $text-02;
189
- letter-spacing: 0.04em;
295
+ white-space: nowrap;
296
+ background-color: $ui-01;
297
+ border-radius: 2px;
298
+ transition: all motion.$duration-fast-02 motion.motion(standard, productive);
190
299
  }
191
300
 
192
- .tileName {
193
- @include type.type-style('productive-heading-01');
301
+ .sheetRow:hover .sheetCode {
194
302
  color: $color-gray-100;
303
+ background-color: $ui-03;
195
304
  }
196
305
 
197
- .tileArrow {
198
- flex-shrink: 0;
199
- margin-left: auto;
200
- fill: $text-02;
201
- transition: transform motion.$duration-fast-02 motion.motion(standard, productive);
306
+ .sheetName {
307
+ @include type.type-style('body-compact-01');
308
+ color: $color-gray-100;
309
+ transition: color motion.$duration-fast-02 motion.motion(standard, productive);
202
310
  }
203
311
 
204
- /* Tone accents, applied per category */
205
-
206
- @each $name, $tone in $tones {
207
- $accent: list.nth($tone, 1);
208
- $tint: list.nth($tone, 2);
209
-
210
- .categoryHeader[data-tone='#{$name}'] {
211
- border-left-color: $accent;
212
- }
213
-
214
- .grid .tile[data-tone='#{$name}'] {
215
- border-left-color: $accent;
216
-
217
- .tileIcon {
218
- color: $accent;
219
- background-color: $tint;
220
- }
221
-
222
- &:hover {
223
- border-color: $accent;
224
-
225
- .tileArrow {
226
- fill: $accent;
227
- }
228
- }
229
- }
312
+ /* shown on hover and focus only */
313
+ .sheetArrow {
314
+ fill: var(--brand-01);
315
+ opacity: 0;
316
+ transition: opacity motion.$duration-fast-02 motion.motion(standard, productive);
230
317
  }
231
318
 
232
319
  /* Empty state */
@@ -270,8 +357,10 @@ $tones: (
270
357
  }
271
358
  }
272
359
 
273
- .tabCount {
274
- margin: 0;
360
+ /* the open tab's count, as the open group's */
361
+ .tabList :global(.cds--tabs__nav-item--selected) .countBadge {
362
+ color: $ui-02;
363
+ background-color: var(--brand-01);
275
364
  }
276
365
 
277
366
  /* Each panel keeps the spacing its content already brings */
@@ -311,17 +400,6 @@ $tones: (
311
400
 
312
401
  padding-bottom: layout.$spacing-05;
313
402
  }
314
-
315
- .toolbar,
316
- .grid {
317
- grid-template-columns: repeat(2, 1fr);
318
- }
319
-
320
- /* two columns: one and a half tiles, leaving the count room beside it */
321
- .searchLayer {
322
- grid-column: 1;
323
- width: 150%;
324
- }
325
403
  }
326
404
 
327
405
  @media (max-width: $breakpoint-phone-max) {
@@ -340,18 +418,96 @@ $tones: (
340
418
  height: calc(#{layout.$spacing-05} + 1.125rem + #{layout.$spacing-03} + #{layout.$spacing-08});
341
419
  }
342
420
 
343
- .toolbar,
344
- .grid {
345
- grid-template-columns: 1fr;
421
+ /* the group links (or count) over the search box, both full width; the
422
+ links scroll sideways if they do not fit */
423
+ .groupBar {
424
+ flex-direction: column;
425
+ align-items: stretch;
426
+ gap: 0;
427
+ border-bottom: none;
428
+ }
429
+
430
+ .plainBar {
431
+ gap: layout.$spacing-03;
346
432
  }
347
433
 
348
- /* one column: full width, with the count under the search box */
349
- .searchLayer {
434
+ .groupNav {
435
+ gap: layout.$spacing-05;
436
+ margin-bottom: layout.$spacing-04;
437
+ overflow-x: auto;
438
+ border-bottom: 1px solid $ui-03;
439
+ }
440
+
441
+ .groupSearch {
442
+ flex-basis: auto;
443
+ min-width: 0;
444
+ }
445
+
446
+ .barCount {
447
+ padding: 0 0 layout.$spacing-03;
448
+ }
449
+
450
+ .groupLinkTitle {
451
+ display: none;
452
+ }
453
+
454
+ .groupLinkShort {
455
+ display: inline;
456
+ }
457
+
458
+ /* the code chip over the name, so names have the full width */
459
+ .sheetRow {
460
+ grid-template-columns: minmax(0, 1fr) auto;
461
+ row-gap: layout.$spacing-02;
462
+ }
463
+
464
+ .sheetCode,
465
+ .sheetName {
350
466
  grid-column: 1;
351
- width: 100%;
352
467
  }
353
468
 
354
- .resultCount {
355
- justify-self: start;
469
+ .sheetArrow {
470
+ grid-row: 1 / span 2;
471
+ grid-column: 2;
472
+ }
473
+
474
+ /* the table: each category a grey band over its items, full width */
475
+ .categoryTable {
476
+ tbody,
477
+ tr,
478
+ th,
479
+ td {
480
+ display: block;
481
+ }
482
+ }
483
+
484
+ .categoryTable .categoryCell {
485
+ width: auto;
486
+ padding: layout.$spacing-03 layout.$spacing-04;
487
+ background-color: $ui-01;
488
+ border-right: none;
489
+ border-bottom: 1px solid $ui-03;
490
+ }
491
+
492
+ .itemCell .sheetRow {
493
+ padding-right: layout.$spacing-04;
494
+ padding-left: layout.$spacing-04;
495
+ }
496
+ }
497
+
498
+ /* the smallest phones (360px and narrower): the three group links fit on one
499
+ line with slightly smaller text and tighter spacing */
500
+ @media (max-width: 360px) {
501
+ .groupNav {
502
+ gap: layout.$spacing-04;
503
+ }
504
+
505
+ .groupLink {
506
+ gap: layout.$spacing-02;
507
+ font-size: 0.8125rem;
508
+ }
509
+
510
+ .groupLink .countBadge {
511
+ min-width: 1.25rem;
356
512
  }
357
513
  }
@@ -21,6 +21,7 @@ export const registerCategories: ReportCategory[] = [
21
21
  {
22
22
  id: 'hiv-testing',
23
23
  title: 'HIV Testing Services & Pre-Exposure Prophylaxis',
24
+ label: 'HIV & PrEP',
24
25
  description: 'HTS and PrEP daily registers',
25
26
  tone: 'violet',
26
27
  reports: [
@@ -45,6 +46,7 @@ export const registerCategories: ReportCategory[] = [
45
46
  {
46
47
  id: 'tb',
47
48
  title: 'Tuberculosis',
49
+ label: 'TB',
48
50
  description: 'TB case finding registers',
49
51
  tone: 'teal',
50
52
  reports: [
@@ -71,6 +73,7 @@ export const registerCategories: ReportCategory[] = [
71
73
  {
72
74
  id: 'outpatient-and-workload',
73
75
  title: 'Outpatient & workload',
76
+ label: 'Outpatient',
74
77
  description: 'Outpatient morbidity registers',
75
78
  tone: 'teal',
76
79
  reports: [
@@ -95,6 +98,7 @@ export const registerCategories: ReportCategory[] = [
95
98
  {
96
99
  id: 'diabetes-and-hypertension',
97
100
  title: 'Diabetes and Hypertension services',
101
+ label: 'Diabetes & hypertension',
98
102
  description: 'Diabetes and Hypertension comprehensive care',
99
103
  tone: 'violet',
100
104
  reports: [
@@ -119,6 +123,7 @@ export const registerCategories: ReportCategory[] = [
119
123
  {
120
124
  id: 'laboratory',
121
125
  title: 'Laboratory',
126
+ label: 'Laboratory',
122
127
  description: 'Laboratory specimen and testing registers',
123
128
  tone: 'blue',
124
129
  reports: [
@@ -145,6 +150,7 @@ export const registerCategories: ReportCategory[] = [
145
150
  {
146
151
  id: 'radiology',
147
152
  title: 'Radiology',
153
+ label: 'Radiology',
148
154
  description: 'Radiology examination register',
149
155
  tone: 'blue',
150
156
  reports: [
@@ -161,6 +167,7 @@ export const registerCategories: ReportCategory[] = [
161
167
  {
162
168
  id: 'cancer-screening',
163
169
  title: 'Cancer Screening services',
170
+ label: 'Cancer screening',
164
171
  description: 'Cancer Screening Summary',
165
172
  tone: 'violet',
166
173
  reports: [
@@ -177,6 +184,7 @@ export const registerCategories: ReportCategory[] = [
177
184
  {
178
185
  id: 'MOH 711',
179
186
  title: 'MOH 711',
187
+ label: 'Maternal & child health',
180
188
  description: 'MOH 711 Summary',
181
189
  tone: 'violet',
182
190
  reports: [
@@ -225,6 +233,7 @@ export const registerCategories: ReportCategory[] = [
225
233
  {
226
234
  id: 'MOH 710',
227
235
  title: 'MOH 710',
236
+ label: 'Immunization',
228
237
  description: 'MOH 710',
229
238
  tone: 'violet',
230
239
  reports: [