dce-reactkit 3.6.9 → 3.6.10

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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Merges a list of class names into a class name, intelligently handling spaces
3
+ * @author Gabe Abrams
4
+ * @param classNames the list of class names to merge
5
+ * @returns the merged class name
6
+ */
7
+ declare const combineClassNames: (classNames: string[]) => string;
8
+ export default combineClassNames;
@@ -67,6 +67,7 @@ import validatePhoneNumber from './helpers/validators/validatePhoneNumber';
67
67
  import validateString from './helpers/validators/validateString';
68
68
  import idify from './helpers/idify';
69
69
  import makeLinksClickable from './helpers/makeLinksClickable';
70
+ import combineClassNames from './helpers/combineClassNames';
70
71
  import ModalButtonType from './types/ModalButtonType';
71
72
  import ModalSize from './types/ModalSize';
72
73
  import ModalType from './types/ModalType';
@@ -85,4 +86,4 @@ import PickableItem from './components/ItemPicker/types/PickableItem';
85
86
  import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
86
87
  import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
87
88
  import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
88
- export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, IntelliTableColumn, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
89
+ export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, IntelliTableColumn, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
package/dist/index.d.ts CHANGED
@@ -1416,6 +1416,14 @@ declare const makeLinksClickable: (text: string, opts?: {
1416
1416
  inheritColor?: boolean;
1417
1417
  }) => React.ReactNode;
1418
1418
 
1419
+ /**
1420
+ * Merges a list of class names into a class name, intelligently handling spaces
1421
+ * @author Gabe Abrams
1422
+ * @param classNames the list of class names to merge
1423
+ * @returns the merged class name
1424
+ */
1425
+ declare const combineClassNames: (classNames: string[]) => string;
1426
+
1419
1427
  /**
1420
1428
  * List of error codes built into the react kit
1421
1429
  * @author Gabe Abrams
@@ -1466,4 +1474,4 @@ declare const LogBuiltInMetadata: {
1466
1474
  };
1467
1475
  };
1468
1476
 
1469
- export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, ceilToNumDecimals, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
1477
+ export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.6.9",
3
+ "version": "3.6.10",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Merges a list of class names into a class name, intelligently handling spaces
3
+ * @author Gabe Abrams
4
+ * @param classNames the list of class names to merge
5
+ * @returns the merged class name
6
+ */
7
+ const combineClassNames = (classNames: string[]): string => {
8
+ return (
9
+ classNames
10
+ // Trim whitespace
11
+ .map((className) => {
12
+ return className.trim();
13
+ })
14
+ // Remove empty class names
15
+ .filter((className) => {
16
+ return className.length > 0;
17
+ })
18
+ // Change multiple spaces for just one space
19
+ .map((className) => {
20
+ return className.replace(/\s+/g, ' ');
21
+ })
22
+ // Join with spaces
23
+ .join(' ')
24
+ );
25
+ };
26
+
27
+ export default combineClassNames;
package/src/index.ts CHANGED
@@ -82,6 +82,7 @@ import validatePhoneNumber from './helpers/validators/validatePhoneNumber';
82
82
  import validateString from './helpers/validators/validateString';
83
83
  import idify from './helpers/idify';
84
84
  import makeLinksClickable from './helpers/makeLinksClickable';
85
+ import combineClassNames from './helpers/combineClassNames';
85
86
 
86
87
  // Import types
87
88
  import ModalButtonType from './types/ModalButtonType';
@@ -182,6 +183,7 @@ export {
182
183
  logClientEvent,
183
184
  addFatalErrorHandler,
184
185
  leaveToURL,
186
+ combineClassNames,
185
187
  // Server helpers
186
188
  initServer,
187
189
  genRouteHandler,