dce-reactkit 3.2.2-beta.6 → 3.2.2-beta.7

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.
@@ -7,6 +7,7 @@ declare type Props = {
7
7
  label: string;
8
8
  minLabelWidth?: string;
9
9
  children: React.ReactNode;
10
+ className?: string;
10
11
  };
11
12
  declare const ButtonInputGroup: React.FC<Props>;
12
13
  export default ButtonInputGroup;
package/dist/index.d.ts CHANGED
@@ -242,6 +242,7 @@ declare type Props$a = {
242
242
  label: string;
243
243
  minLabelWidth?: string;
244
244
  children: React.ReactNode;
245
+ className?: string;
245
246
  };
246
247
  declare const ButtonInputGroup: React.FC<Props$a>;
247
248
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.2.2-beta.6",
3
+ "version": "3.2.2-beta.7",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -18,6 +18,8 @@ type Props = {
18
18
  minLabelWidth?: string,
19
19
  // Buttons
20
20
  children: React.ReactNode,
21
+ // Additional class names to add to the outer container
22
+ className?: string,
21
23
  };
22
24
 
23
25
  /*------------------------------------------------------------------------*/
@@ -36,6 +38,7 @@ const ButtonInputGroup: React.FC<Props> = (props) => {
36
38
  label,
37
39
  minLabelWidth,
38
40
  children,
41
+ className,
39
42
  } = props;
40
43
 
41
44
  /*------------------------------------------------------------------------*/
@@ -47,7 +50,7 @@ const ButtonInputGroup: React.FC<Props> = (props) => {
47
50
  /*----------------------------------------*/
48
51
 
49
52
  return (
50
- <div className="input-group">
53
+ <div className={`input-group ${className ?? ''}`}>
51
54
  <div className="input-group-prepend d-flex w-100">
52
55
  {/* Label */}
53
56
  <span
@@ -302,14 +302,14 @@ const IntelliTable: React.FC<Props> = (props) => {
302
302
  >
303
303
  <div className="d-flex align-items-center justify-content-center flex-row h-100">
304
304
  {/* Title */}
305
- <h4 className="m-0">
305
+ <span className="text-nowrap">
306
306
  {column.title}
307
- </h4>
307
+ </span>
308
308
  {/* Buttons */}
309
309
  <div>
310
310
  <button
311
311
  type="button"
312
- className="btn btn-light"
312
+ className="btn btn-light btn-sm ms-1"
313
313
  aria-label={sortButtonAriaLabel}
314
314
  onClick={() => {
315
315
  dispatch({
@@ -567,7 +567,7 @@ const IntelliTable: React.FC<Props> = (props) => {
567
567
  {/* Show/Hide Columns */}
568
568
  <button
569
569
  type="button"
570
- className="btn btn-secondary"
570
+ className="btn btn-secondary ms-2"
571
571
  aria-label={`show panel for customizing which columns show in table ${title}`}
572
572
  id={`IntelliTable-${id}-show-column-customization-modal`}
573
573
  onClick={() => {
@@ -207,6 +207,10 @@ const style = `
207
207
  border-radius: 0.5rem;
208
208
  overflow: hidden;
209
209
 
210
+ /* Solid background */
211
+ background-color: white;
212
+ color: black;
213
+
210
214
  /* Place contents in flex column */
211
215
  flex-direction: column;
212
216
 
@@ -254,7 +258,7 @@ const genHumanReadableName = (machineReadableName: string) => {
254
258
  // Uppercase! Add a space before
255
259
  humanReadableName += ' ';
256
260
  }
257
- humanReadableName += chars;
261
+ humanReadableName += char;
258
262
  });
259
263
 
260
264
  // Trim and return
@@ -727,7 +731,7 @@ const LogReviewer: React.FC<Props> = (props) => {
727
731
 
728
732
  // Filter toggle
729
733
  const filterToggles = (
730
- <div className="LogReviewer-filter-toggles d-flex align-items-center justify-content-center">
734
+ <div className="LogReviewer-filter-toggles mb-2">
731
735
  <h3 className="m-0">
732
736
  Filters:
733
737
  </h3>
@@ -771,24 +775,27 @@ const LogReviewer: React.FC<Props> = (props) => {
771
775
  Context
772
776
  </button>
773
777
  {/* Tag */}
774
- <button
775
- type="button"
776
- id="LogReviewer-toggle-tag-filter-drawer"
777
- className={`btn btn-${FilterDrawer.Tag === expandedFilterDrawer} me-2`}
778
- aria-label="toggle tag filter drawer"
779
- onClick={() => {
780
- dispatch({
781
- type: ActionType.ToggleFilterDrawer,
782
- filterDrawer: FilterDrawer.Tag,
783
- });
784
- }}
785
- >
786
- <FontAwesomeIcon
787
- icon={faTag}
788
- className="me-2"
789
- />
790
- Tag
791
- </button>
778
+ {/* Skip if no tags are used */}
779
+ {(LogMetadata.Tag && Object.keys(LogMetadata.Tag).length > 0) && (
780
+ <button
781
+ type="button"
782
+ id="LogReviewer-toggle-tag-filter-drawer"
783
+ className={`btn btn-${FilterDrawer.Tag === expandedFilterDrawer} me-2`}
784
+ aria-label="toggle tag filter drawer"
785
+ onClick={() => {
786
+ dispatch({
787
+ type: ActionType.ToggleFilterDrawer,
788
+ filterDrawer: FilterDrawer.Tag,
789
+ });
790
+ }}
791
+ >
792
+ <FontAwesomeIcon
793
+ icon={faTag}
794
+ className="me-2"
795
+ />
796
+ Tag
797
+ </button>
798
+ )}
792
799
  {/* Action */}
793
800
  <button
794
801
  type="button"
@@ -1023,7 +1030,10 @@ const LogReviewer: React.FC<Props> = (props) => {
1023
1030
  ) && (
1024
1031
  <TabBox title="Action Log Details">
1025
1032
  {/* Action */}
1026
- <ButtonInputGroup label="Action">
1033
+ <ButtonInputGroup
1034
+ label="Action"
1035
+ className="mb-2"
1036
+ >
1027
1037
  {
1028
1038
  Object.keys(LogAction)
1029
1039
  .map((action, i) => {
@@ -1048,6 +1058,13 @@ const LogReviewer: React.FC<Props> = (props) => {
1048
1058
  </ButtonInputGroup>
1049
1059
  {/* Target */}
1050
1060
  <ButtonInputGroup label="Target">
1061
+ {/* Nothing here */}
1062
+ {(Object.keys(LogMetadata.Target ?? {})) && (
1063
+ <div>
1064
+ This app does not have any targets yet.
1065
+ </div>
1066
+ )}
1067
+ {/* List of targets */}
1051
1068
  {
1052
1069
  Object.keys(LogMetadata.Target ?? {})
1053
1070
  .map((target, i) => {
@@ -1974,12 +1991,26 @@ const LogReviewer: React.FC<Props> = (props) => {
1974
1991
 
1975
1992
  // Create intelliTable
1976
1993
  const dataTable = (
1977
- <IntelliTable
1978
- title="Matching Logs"
1979
- id="logs"
1980
- data={logs}
1981
- columns={columns}
1982
- />
1994
+ logs.length === 0
1995
+ ? (
1996
+ <div className="alert alert-warning">
1997
+ <h4 className="m-1">
1998
+ No Logs to Show
1999
+ </h4>
2000
+ <div>
2001
+ Either your filters are too strict or no matching logs have been
2002
+ created yet.
2003
+ </div>
2004
+ </div>
2005
+ )
2006
+ : (
2007
+ <IntelliTable
2008
+ title="Matching Logs"
2009
+ id="logs"
2010
+ data={logs}
2011
+ columns={columns}
2012
+ />
2013
+ )
1983
2014
  );
1984
2015
 
1985
2016
  // Main body
@@ -2001,13 +2032,13 @@ const LogReviewer: React.FC<Props> = (props) => {
2001
2032
  <div className="LogReviewer-inner-container">
2002
2033
  <div className="LogReviewer-header">
2003
2034
  <div className="LogReviewer-header-title">
2004
- <h1 className="m-0">
2035
+ <h3 className="m-0">
2005
2036
  Log Review Dashboard
2006
- </h1>
2037
+ </h3>
2007
2038
  </div>
2008
2039
  <button
2009
2040
  type="button"
2010
- className="LogReviewer-header-close-button btn btn-lg"
2041
+ className="LogReviewer-header-close-button btn btn-dark btn-lg"
2011
2042
  aria-label="close log reviewer panel"
2012
2043
  onClick={onClose}
2013
2044
  style={{