dce-reactkit 3.6.9 → 3.6.11

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.
@@ -2,6 +2,7 @@
2
2
  * A switch with multiple options for selection
3
3
  * @author Alessandra De Lucas
4
4
  * @author Gabe Abrams
5
+ * @author Austen Money
5
6
  */
6
7
  import React from 'react';
7
8
  import { IconProp } from '@fortawesome/fontawesome-svg-core';
@@ -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/esm/index.js CHANGED
@@ -41147,10 +41147,35 @@ const AutoscrollToBottomContainer = (props) => {
41147
41147
  messageAfterItems)));
41148
41148
  };
41149
41149
 
41150
+ /**
41151
+ * Merges a list of class names into a class name, intelligently handling spaces
41152
+ * @author Gabe Abrams
41153
+ * @param classNames the list of class names to merge
41154
+ * @returns the merged class name
41155
+ */
41156
+ const combineClassNames = (classNames) => {
41157
+ return (classNames
41158
+ // Trim whitespace
41159
+ .map((className) => {
41160
+ return className.trim();
41161
+ })
41162
+ // Remove empty class names
41163
+ .filter((className) => {
41164
+ return className.length > 0;
41165
+ })
41166
+ // Change multiple spaces for just one space
41167
+ .map((className) => {
41168
+ return className.replace(/\s+/g, ' ');
41169
+ })
41170
+ // Join with spaces
41171
+ .join(' '));
41172
+ };
41173
+
41150
41174
  /**
41151
41175
  * A switch with multiple options for selection
41152
41176
  * @author Alessandra De Lucas
41153
41177
  * @author Gabe Abrams
41178
+ * @author Austen Money
41154
41179
  */
41155
41180
  /* ------------- Actions ------------ */
41156
41181
  // Types of actions
@@ -41309,7 +41334,14 @@ const MultiSwitch = (props) => {
41309
41334
  /* --------------- Main UI -------------- */
41310
41335
  /*----------------------------------------*/
41311
41336
  const optionElements = options.map((option) => {
41312
- return (React__default.createElement("button", { type: "button", className: `MultiSwitch-option-button${option.id === hoveredOptionId ? ' MultiSwitch-option-button-hovered' : ''}`, "aria-label": (option.id === selectedOptionId
41337
+ const isSelected = (option.id === selectedOptionId);
41338
+ const isHovered = (option.id === hoveredOptionId);
41339
+ return (React__default.createElement("button", { type: "button", key: option.id, className: combineClassNames([
41340
+ 'MultiSwitch-option-button',
41341
+ (isHovered ? 'MultiSwitch-option-button-hovered' : ''),
41342
+ `MultiSwitch-option-button-with-id-${idify(option.id)}`,
41343
+ `MultiSwitch-option-button-is${isSelected ? '' : '-not'}-selected`,
41344
+ ]), "aria-label": (isSelected
41313
41345
  ? `option "${option.label}", currently selected`
41314
41346
  : `click to select option "${option.label}"`), onClick: () => {
41315
41347
  // Remove hover
@@ -43294,5 +43326,5 @@ var DayOfWeek;
43294
43326
  })(DayOfWeek || (DayOfWeek = {}));
43295
43327
  var DayOfWeek$1 = DayOfWeek;
43296
43328
 
43297
- export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, DayOfWeek$1 as DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, MultiSwitch, ParamType$1 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$1 as ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant$1 as 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 };
43329
+ export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, DayOfWeek$1 as DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, MultiSwitch, ParamType$1 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$1 as ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant$1 as 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 };
43298
43330
  //# sourceMappingURL=index.js.map