dce-reactkit 3.6.10 → 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 +33 -25
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/MultiSwitch.d.ts +1 -0
- package/dist/esm/index.js +33 -25
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/MultiSwitch.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +5 -5
- package/src/components/MultiSwitch.tsx +16 -2
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
|
-
|
|
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
|
|
@@ -43278,30 +43310,6 @@ const makeLinksClickable = (text, opts) => {
|
|
|
43278
43310
|
return elements;
|
|
43279
43311
|
};
|
|
43280
43312
|
|
|
43281
|
-
/**
|
|
43282
|
-
* Merges a list of class names into a class name, intelligently handling spaces
|
|
43283
|
-
* @author Gabe Abrams
|
|
43284
|
-
* @param classNames the list of class names to merge
|
|
43285
|
-
* @returns the merged class name
|
|
43286
|
-
*/
|
|
43287
|
-
const combineClassNames = (classNames) => {
|
|
43288
|
-
return (classNames
|
|
43289
|
-
// Trim whitespace
|
|
43290
|
-
.map((className) => {
|
|
43291
|
-
return className.trim();
|
|
43292
|
-
})
|
|
43293
|
-
// Remove empty class names
|
|
43294
|
-
.filter((className) => {
|
|
43295
|
-
return className.length > 0;
|
|
43296
|
-
})
|
|
43297
|
-
// Change multiple spaces for just one space
|
|
43298
|
-
.map((className) => {
|
|
43299
|
-
return className.replace(/\s+/g, ' ');
|
|
43300
|
-
})
|
|
43301
|
-
// Join with spaces
|
|
43302
|
-
.join(' '));
|
|
43303
|
-
};
|
|
43304
|
-
|
|
43305
43313
|
/**
|
|
43306
43314
|
* Days of the week
|
|
43307
43315
|
* @author Gabe Abrams
|