dce-reactkit 3.11.0 → 3.11.1-beta.tooltip.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.
@@ -19,12 +19,6 @@ type SendRequestFunction = (opts: {
19
19
  [x: string]: any;
20
20
  };
21
21
  }>;
22
- declare let noServer: boolean;
23
- /**
24
- * Check if there is no server for this app
25
- * @author Gabe Abrams
26
- */
27
- export declare const appHasNoServer: () => boolean;
28
22
  /**
29
23
  * Get the send request function
30
24
  * @author Gabe Abrams
@@ -50,18 +44,10 @@ export declare const isDarkModeOn: () => boolean;
50
44
  * @param opts object containing all arguments
51
45
  * @param opts.sendRequest caccl send request functions
52
46
  * @param [opts.sessionExpiredMessage] a custom session expired message
53
- * @param [opts.darkModeOn] if true, dark mode is enabled
54
- * @param [opts.noServer] if true, there is no server for this app
55
47
  */
56
- declare const initClient: (opts: ({
48
+ declare const initClient: (opts: {
57
49
  sendRequest: SendRequestFunction;
58
50
  sessionExpiredMessage?: string;
59
51
  darkModeOn?: boolean;
60
- noServer?: false;
61
- } | {
62
- darkModeOn?: boolean;
63
- noServer: true;
64
- sendRequest?: undefined;
65
- sessionExpiredMessage?: undefined;
66
- })) => void;
52
+ }) => void;
67
53
  export default initClient;
@@ -2,5 +2,5 @@
2
2
  * Universal stylesheet
3
3
  * @author Gabe Abrams
4
4
  */
5
- declare const shared = "\n/* Button with no style */\n.btn-nostyle {\n border: 0 !important;\n background: transparent !important;\n outline: 0 !important;\n font-size: inherit !important;\n color: inherit !important;\n padding: 0 !important;\n margin: 0 !important;\n}\n\n/* Tooltip on Very Top */\n.tooltip {\n z-index: 9000000000 !important;\n}\n\n/* Tooltip White Text */\n.tooltip .tooltip-inner {\n color: white !important;\n}\n";
5
+ declare const shared = "\n/* Button with no style */\n.btn-nostyle {\n border: 0 !important;\n background: transparent !important;\n outline: 0 !important;\n font-size: inherit !important;\n color: inherit !important;\n padding: 0 !important;\n margin: 0 !important;\n}\n\n/* Tooltip on Very Top */\n.tooltip {\n z-index: 9000000000 !important;\n}\n";
6
6
  export default shared;
package/dist/index.d.ts CHANGED
@@ -810,20 +810,12 @@ type SendRequestFunction = (opts: {
810
810
  * @param opts object containing all arguments
811
811
  * @param opts.sendRequest caccl send request functions
812
812
  * @param [opts.sessionExpiredMessage] a custom session expired message
813
- * @param [opts.darkModeOn] if true, dark mode is enabled
814
- * @param [opts.noServer] if true, there is no server for this app
815
813
  */
816
- declare const initClient: (opts: ({
814
+ declare const initClient: (opts: {
817
815
  sendRequest: SendRequestFunction;
818
816
  sessionExpiredMessage?: string;
819
817
  darkModeOn?: boolean;
820
- noServer?: false;
821
- } | {
822
- darkModeOn?: boolean;
823
- noServer: true;
824
- sendRequest?: undefined;
825
- sessionExpiredMessage?: undefined;
826
- })) => void;
818
+ }) => void;
827
819
 
828
820
  /**
829
821
  * Shorten text so it fits into a certain number of chars
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.11.0",
3
+ "version": "3.11.1-beta.tooltip.1",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -47,18 +47,6 @@ const initialized = new Promise((resolve) => {
47
47
  onInitialized = resolve;
48
48
  });
49
49
 
50
- /* ------------ No Server ----------- */
51
-
52
- let noServer = false;
53
-
54
- /**
55
- * Check if there is no server for this app
56
- * @author Gabe Abrams
57
- */
58
- export const appHasNoServer = () => {
59
- return noServer;
60
- };
61
-
62
50
  /* ---------- Send Request ---------- */
63
51
 
64
52
  let storedSendRequest: SendRequestFunction;
@@ -131,46 +119,20 @@ export const isDarkModeOn = () => {
131
119
  * @param opts object containing all arguments
132
120
  * @param opts.sendRequest caccl send request functions
133
121
  * @param [opts.sessionExpiredMessage] a custom session expired message
134
- * @param [opts.darkModeOn] if true, dark mode is enabled
135
- * @param [opts.noServer] if true, there is no server for this app
136
122
  */
137
123
  const initClient = (
138
- opts: (
139
- | {
140
- // Copy of CACCL's send request function
141
- sendRequest: SendRequestFunction,
142
- // Custom session expired message
143
- sessionExpiredMessage?: string,
144
- // If true, dark mode is enabled
145
- darkModeOn?: boolean,
146
- // If true, there is no server for this app
147
- noServer?: false,
148
- }
149
- | {
150
- // If true, dark mode is enabled
151
- darkModeOn?: boolean,
152
- // If true, there is no server for this app
153
- noServer: true
154
- // Copy of CACCL's send request function
155
- sendRequest?: undefined,
156
- // Custom session expired message
157
- sessionExpiredMessage?: undefined,
158
- }
159
- ),
124
+ opts: {
125
+ // Copy of CACCL's send request function
126
+ sendRequest: SendRequestFunction,
127
+ // Custom session expired message
128
+ sessionExpiredMessage?: string,
129
+ // If true, dark mode is enabled
130
+ darkModeOn?: boolean,
131
+ },
160
132
  ) => {
161
- // Handle separately if there is no server
162
- if (opts.noServer) {
163
- // Store values
164
- storedSendRequest = async () => {
165
- throw new Error('Cannot send requests because there is no server');
166
- };
167
- } else {
168
- // Store values
169
- storedSendRequest = opts.sendRequest;
170
- sessionExpiredMessage = opts.sessionExpiredMessage;
171
- }
172
-
173
- // Handle universal parts
133
+ // Store values
134
+ storedSendRequest = opts.sendRequest;
135
+ sessionExpiredMessage = opts.sessionExpiredMessage;
174
136
  darkModeOn = !!opts.darkModeOn;
175
137
 
176
138
  // Mark as initialized
@@ -608,23 +608,23 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
608
608
 
609
609
  // Prompt
610
610
  const [promptInfo, setPromptInfoInner] = useState<
611
- | undefined
612
- | {
613
- title: string,
614
- currentInputFieldText: string,
615
- opts: {
616
- textAboveInputField?: string,
617
- placeholder?: string,
618
- defaultText?: string,
619
- confirmButtonText?: string,
620
- confirmButtonVariant?: Variant,
621
- cancelButtonText?: string,
622
- cancelButtonVariant?: Variant,
623
- minNumChars?: number,
624
- findValidationError?: (text: string) => string | undefined,
625
- ariaLabel?: string,
626
- }
611
+ | undefined
612
+ | {
613
+ title: string,
614
+ currentInputFieldText: string,
615
+ opts: {
616
+ textAboveInputField?: string,
617
+ placeholder?: string,
618
+ defaultText?: string,
619
+ confirmButtonText?: string,
620
+ confirmButtonVariant?: Variant,
621
+ cancelButtonText?: string,
622
+ cancelButtonVariant?: Variant,
623
+ minNumChars?: number,
624
+ findValidationError?: (text: string) => string | undefined,
625
+ ariaLabel?: string,
627
626
  }
627
+ }
628
628
  >(undefined);
629
629
  setPromptInfo = setPromptInfoInner;
630
630
 
@@ -918,7 +918,7 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
918
918
  ? `
919
919
  .tooltip-inner {
920
920
  background-color: white;
921
- color: black;
921
+ color: black !important;
922
922
  border: 0.1rem solid black;
923
923
  pointer-events: none;
924
924
  }
@@ -931,7 +931,7 @@ const AppWrapper: React.FC<Props> = (props: Props): React.ReactElement => {
931
931
  : `
932
932
  .tooltip-inner {
933
933
  background-color: black;
934
- color: white;
934
+ color: white !important;
935
935
  border: 0.1rem solid white;
936
936
  pointer-events: none;
937
937
  }
@@ -130,7 +130,6 @@ const CheckboxButton: React.FC<Props> = (props) => {
130
130
  className="ps-1 text-start text-break"
131
131
  style={{
132
132
  whiteSpace: 'pre-wrap',
133
- tabSize: 2,
134
133
  }}
135
134
  >
136
135
  {text}
@@ -114,7 +114,6 @@ const RadioButton: React.FC<Props> = (props) => {
114
114
  className="ps-1 text-start text-break"
115
115
  style={{
116
116
  whiteSpace: 'pre-wrap',
117
- tabSize: 2,
118
117
  }}
119
118
  >
120
119
  {text}
@@ -7,9 +7,6 @@ import LogLevel from '../types/LogLevel';
7
7
  // Import shared functions
8
8
  import visitServerEndpoint from './visitServerEndpoint';
9
9
 
10
- // Import status
11
- import { appHasNoServer } from '../client/initClient';
12
-
13
10
  /* ------- Metadata Populator ------- */
14
11
 
15
12
  // Type of a metadata populator function
@@ -39,11 +36,6 @@ export const setClientEventMetadataPopulator = (
39
36
  * @author Gabe Abrams
40
37
  */
41
38
  const logClientEvent: LogFunction = async (opts) => {
42
- // Don't write to the server if there is none
43
- if (appHasNoServer()) {
44
- return;
45
- }
46
-
47
39
  // Populate metadata
48
40
  let metadata = (opts.metadata ?? {});
49
41
  if (metadataPopulator) {
@@ -102,7 +102,6 @@ const visitServerEndpoint = async (
102
102
  params?: { [key in string]: any },
103
103
  },
104
104
  ): Promise<any> => {
105
- // Set default method
106
105
  const method = (opts.method ?? 'GET');
107
106
  // Handle stubs
108
107
  const stubResponse = stubResponses[method]?.[opts.path];
@@ -18,11 +18,6 @@ const shared = `
18
18
  .tooltip {
19
19
  z-index: 9000000000 !important;
20
20
  }
21
-
22
- /* Tooltip White Text */
23
- .tooltip .tooltip-inner {
24
- color: white !important;
25
- }
26
21
  `;
27
22
 
28
23
  export default shared;