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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Merges a list of class names into a class name, intelligently handling spaces
|
|
3
3
|
* @author Gabe Abrams
|
|
4
|
-
* @param classNames the list of class names to merge
|
|
4
|
+
* @param classNames the list of class names to merge (or falsey values to
|
|
5
|
+
* ignore)
|
|
5
6
|
* @returns the merged class name
|
|
6
7
|
*/
|
|
7
|
-
declare const combineClassNames: (classNames: string[]) => string;
|
|
8
|
+
declare const combineClassNames: (classNames: (string | undefined | null | false)[]) => string;
|
|
8
9
|
export default combineClassNames;
|
package/dist/esm/index.js
CHANGED
|
@@ -41147,10 +41147,40 @@ 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 (or falsey values to
|
|
41154
|
+
* ignore)
|
|
41155
|
+
* @returns the merged class name
|
|
41156
|
+
*/
|
|
41157
|
+
const combineClassNames = (classNames) => {
|
|
41158
|
+
return (classNames
|
|
41159
|
+
// Turn falsey values into empty strings
|
|
41160
|
+
.map((className) => {
|
|
41161
|
+
return className || '';
|
|
41162
|
+
})
|
|
41163
|
+
// Trim whitespace
|
|
41164
|
+
.map((className) => {
|
|
41165
|
+
return className.trim();
|
|
41166
|
+
})
|
|
41167
|
+
// Remove empty class names
|
|
41168
|
+
.filter((className) => {
|
|
41169
|
+
return className.length > 0;
|
|
41170
|
+
})
|
|
41171
|
+
// Change multiple spaces for just one space
|
|
41172
|
+
.map((className) => {
|
|
41173
|
+
return className.replace(/\s+/g, ' ');
|
|
41174
|
+
})
|
|
41175
|
+
// Join with spaces
|
|
41176
|
+
.join(' '));
|
|
41177
|
+
};
|
|
41178
|
+
|
|
41150
41179
|
/**
|
|
41151
41180
|
* A switch with multiple options for selection
|
|
41152
41181
|
* @author Alessandra De Lucas
|
|
41153
41182
|
* @author Gabe Abrams
|
|
41183
|
+
* @author Austen Money
|
|
41154
41184
|
*/
|
|
41155
41185
|
/* ------------- Actions ------------ */
|
|
41156
41186
|
// Types of actions
|
|
@@ -41309,7 +41339,14 @@ const MultiSwitch = (props) => {
|
|
|
41309
41339
|
/* --------------- Main UI -------------- */
|
|
41310
41340
|
/*----------------------------------------*/
|
|
41311
41341
|
const optionElements = options.map((option) => {
|
|
41312
|
-
|
|
41342
|
+
const isSelected = (option.id === selectedOptionId);
|
|
41343
|
+
const isHovered = (option.id === hoveredOptionId);
|
|
41344
|
+
return (React__default.createElement("button", { type: "button", key: option.id, className: combineClassNames([
|
|
41345
|
+
'MultiSwitch-option-button',
|
|
41346
|
+
(isHovered ? 'MultiSwitch-option-button-hovered' : ''),
|
|
41347
|
+
`MultiSwitch-option-button-with-id-${idify(option.id)}`,
|
|
41348
|
+
`MultiSwitch-option-button-is${isSelected ? '' : '-not'}-selected`,
|
|
41349
|
+
]), "aria-label": (isSelected
|
|
41313
41350
|
? `option "${option.label}", currently selected`
|
|
41314
41351
|
: `click to select option "${option.label}"`), onClick: () => {
|
|
41315
41352
|
// Remove hover
|
|
@@ -43278,30 +43315,6 @@ const makeLinksClickable = (text, opts) => {
|
|
|
43278
43315
|
return elements;
|
|
43279
43316
|
};
|
|
43280
43317
|
|
|
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
43318
|
/**
|
|
43306
43319
|
* Days of the week
|
|
43307
43320
|
* @author Gabe Abrams
|