dce-reactkit 3.6.10 → 3.6.12
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 +38 -25
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/MultiSwitch.d.ts +1 -0
- package/dist/cjs/types/helpers/combineClassNames.d.ts +3 -2
- package/dist/esm/index.js +38 -25
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/MultiSwitch.d.ts +1 -0
- package/dist/esm/types/helpers/combineClassNames.d.ts +3 -2
- package/dist/index.d.ts +4 -2
- package/package.json +5 -5
- package/src/components/MultiSwitch.tsx +16 -2
- package/src/helpers/combineClassNames.ts +7 -2
package/dist/cjs/index.js
CHANGED
|
@@ -41173,10 +41173,40 @@ 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 (or falsey values to
|
|
41180
|
+
* ignore)
|
|
41181
|
+
* @returns the merged class name
|
|
41182
|
+
*/
|
|
41183
|
+
const combineClassNames = (classNames) => {
|
|
41184
|
+
return (classNames
|
|
41185
|
+
// Turn falsey values into empty strings
|
|
41186
|
+
.map((className) => {
|
|
41187
|
+
return className || '';
|
|
41188
|
+
})
|
|
41189
|
+
// Trim whitespace
|
|
41190
|
+
.map((className) => {
|
|
41191
|
+
return className.trim();
|
|
41192
|
+
})
|
|
41193
|
+
// Remove empty class names
|
|
41194
|
+
.filter((className) => {
|
|
41195
|
+
return className.length > 0;
|
|
41196
|
+
})
|
|
41197
|
+
// Change multiple spaces for just one space
|
|
41198
|
+
.map((className) => {
|
|
41199
|
+
return className.replace(/\s+/g, ' ');
|
|
41200
|
+
})
|
|
41201
|
+
// Join with spaces
|
|
41202
|
+
.join(' '));
|
|
41203
|
+
};
|
|
41204
|
+
|
|
41176
41205
|
/**
|
|
41177
41206
|
* A switch with multiple options for selection
|
|
41178
41207
|
* @author Alessandra De Lucas
|
|
41179
41208
|
* @author Gabe Abrams
|
|
41209
|
+
* @author Austen Money
|
|
41180
41210
|
*/
|
|
41181
41211
|
/* ------------- Actions ------------ */
|
|
41182
41212
|
// Types of actions
|
|
@@ -41335,7 +41365,14 @@ const MultiSwitch = (props) => {
|
|
|
41335
41365
|
/* --------------- Main UI -------------- */
|
|
41336
41366
|
/*----------------------------------------*/
|
|
41337
41367
|
const optionElements = options.map((option) => {
|
|
41338
|
-
|
|
41368
|
+
const isSelected = (option.id === selectedOptionId);
|
|
41369
|
+
const isHovered = (option.id === hoveredOptionId);
|
|
41370
|
+
return (React__default["default"].createElement("button", { type: "button", key: option.id, className: combineClassNames([
|
|
41371
|
+
'MultiSwitch-option-button',
|
|
41372
|
+
(isHovered ? 'MultiSwitch-option-button-hovered' : ''),
|
|
41373
|
+
`MultiSwitch-option-button-with-id-${idify(option.id)}`,
|
|
41374
|
+
`MultiSwitch-option-button-is${isSelected ? '' : '-not'}-selected`,
|
|
41375
|
+
]), "aria-label": (isSelected
|
|
41339
41376
|
? `option "${option.label}", currently selected`
|
|
41340
41377
|
: `click to select option "${option.label}"`), onClick: () => {
|
|
41341
41378
|
// Remove hover
|
|
@@ -43304,30 +43341,6 @@ const makeLinksClickable = (text, opts) => {
|
|
|
43304
43341
|
return elements;
|
|
43305
43342
|
};
|
|
43306
43343
|
|
|
43307
|
-
/**
|
|
43308
|
-
* Merges a list of class names into a class name, intelligently handling spaces
|
|
43309
|
-
* @author Gabe Abrams
|
|
43310
|
-
* @param classNames the list of class names to merge
|
|
43311
|
-
* @returns the merged class name
|
|
43312
|
-
*/
|
|
43313
|
-
const combineClassNames = (classNames) => {
|
|
43314
|
-
return (classNames
|
|
43315
|
-
// Trim whitespace
|
|
43316
|
-
.map((className) => {
|
|
43317
|
-
return className.trim();
|
|
43318
|
-
})
|
|
43319
|
-
// Remove empty class names
|
|
43320
|
-
.filter((className) => {
|
|
43321
|
-
return className.length > 0;
|
|
43322
|
-
})
|
|
43323
|
-
// Change multiple spaces for just one space
|
|
43324
|
-
.map((className) => {
|
|
43325
|
-
return className.replace(/\s+/g, ' ');
|
|
43326
|
-
})
|
|
43327
|
-
// Join with spaces
|
|
43328
|
-
.join(' '));
|
|
43329
|
-
};
|
|
43330
|
-
|
|
43331
43344
|
/**
|
|
43332
43345
|
* Days of the week
|
|
43333
43346
|
* @author Gabe Abrams
|