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.
package/dist/cjs/index.js CHANGED
@@ -41173,10 +41173,35 @@ const AutoscrollToBottomContainer = (props) => {
41173
41173
  messageAfterItems)));
41174
41174
  };
41175
41175
 
41176
+ /**
41177
+ * Merges a list of class names into a class name, intelligently handling spaces
41178
+ * @author Gabe Abrams
41179
+ * @param classNames the list of class names to merge
41180
+ * @returns the merged class name
41181
+ */
41182
+ const combineClassNames = (classNames) => {
41183
+ return (classNames
41184
+ // Trim whitespace
41185
+ .map((className) => {
41186
+ return className.trim();
41187
+ })
41188
+ // Remove empty class names
41189
+ .filter((className) => {
41190
+ return className.length > 0;
41191
+ })
41192
+ // Change multiple spaces for just one space
41193
+ .map((className) => {
41194
+ return className.replace(/\s+/g, ' ');
41195
+ })
41196
+ // Join with spaces
41197
+ .join(' '));
41198
+ };
41199
+
41176
41200
  /**
41177
41201
  * A switch with multiple options for selection
41178
41202
  * @author Alessandra De Lucas
41179
41203
  * @author Gabe Abrams
41204
+ * @author Austen Money
41180
41205
  */
41181
41206
  /* ------------- Actions ------------ */
41182
41207
  // Types of actions
@@ -41335,7 +41360,14 @@ const MultiSwitch = (props) => {
41335
41360
  /* --------------- Main UI -------------- */
41336
41361
  /*----------------------------------------*/
41337
41362
  const optionElements = options.map((option) => {
41338
- return (React__default["default"].createElement("button", { type: "button", className: `MultiSwitch-option-button${option.id === hoveredOptionId ? ' MultiSwitch-option-button-hovered' : ''}`, "aria-label": (option.id === selectedOptionId
41363
+ const isSelected = (option.id === selectedOptionId);
41364
+ const isHovered = (option.id === hoveredOptionId);
41365
+ return (React__default["default"].createElement("button", { type: "button", key: option.id, className: combineClassNames([
41366
+ 'MultiSwitch-option-button',
41367
+ (isHovered ? 'MultiSwitch-option-button-hovered' : ''),
41368
+ `MultiSwitch-option-button-with-id-${idify(option.id)}`,
41369
+ `MultiSwitch-option-button-is${isSelected ? '' : '-not'}-selected`,
41370
+ ]), "aria-label": (isSelected
41339
41371
  ? `option "${option.label}", currently selected`
41340
41372
  : `click to select option "${option.label}"`), onClick: () => {
41341
41373
  // Remove hover
@@ -43367,6 +43399,7 @@ exports.alert = alert;
43367
43399
  exports.avg = avg;
43368
43400
  exports.canReviewLogs = canReviewLogs;
43369
43401
  exports.ceilToNumDecimals = ceilToNumDecimals;
43402
+ exports.combineClassNames = combineClassNames;
43370
43403
  exports.compareArraysByProp = compareArraysByProp;
43371
43404
  exports.confirm = confirm;
43372
43405
  exports.extractProp = extractProp;