@coreui/react 4.9.0-alpha.1 → 4.9.0-beta.1
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/README.md +1 -1
- package/dist/components/accordion/index.d.ts +1 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/useColorModes.d.ts +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +68 -200
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +69 -199
- package/dist/index.js.map +1 -1
- package/dist/props.d.ts +1 -1
- package/package.json +9 -9
- package/src/components/accordion/index.ts +1 -7
- package/src/components/form/CFormSelect.tsx +3 -1
- package/src/components/modal/CModal.tsx +2 -0
- package/src/components/popover/CPopover.tsx +0 -1
- package/src/components/popover/__tests__/__snapshots__/CPopover.spec.tsx.snap +2 -1
- package/src/components/progress/CProgress.tsx +1 -0
- package/src/components/sidebar/CSidebar.tsx +2 -2
- package/src/components/spinner/CSpinner.tsx +4 -2
- package/src/components/spinner/__tests__/__snapshots__/CSpinner.spec.tsx.snap +2 -2
- package/src/components/table/CTable.tsx +2 -1
- package/src/components/tooltip/CTooltip.tsx +0 -1
- package/src/components/tooltip/__tests__/CTooltip.spec.tsx +1 -1
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useColorModes.ts +57 -0
- package/src/hooks/useForkedRef.ts +1 -1
- package/src/index.ts +1 -0
- package/src/props.ts +4 -1
- package/src/utils/isRTL.ts +1 -1
- package/src/components/accordion/__tests__/__snapshots__/CAccordionCollapse.spec.tsx.snap +0 -11
package/dist/index.js
CHANGED
|
@@ -2492,6 +2492,47 @@ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, T
|
|
|
2492
2492
|
}) : {};
|
|
2493
2493
|
var CSSTransition$1 = CSSTransition;
|
|
2494
2494
|
|
|
2495
|
+
var getStoredTheme = function (localStorageItemName) { return localStorage.getItem(localStorageItemName); };
|
|
2496
|
+
var setStoredTheme = function (localStorageItemName, colorMode) {
|
|
2497
|
+
return localStorage.setItem(localStorageItemName, colorMode);
|
|
2498
|
+
};
|
|
2499
|
+
var getPreferredColorScheme = function (localStorageItemName) {
|
|
2500
|
+
var storedTheme = getStoredTheme(localStorageItemName);
|
|
2501
|
+
if (storedTheme) {
|
|
2502
|
+
return storedTheme;
|
|
2503
|
+
}
|
|
2504
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
2505
|
+
};
|
|
2506
|
+
var setTheme = function (colorMode) {
|
|
2507
|
+
document.documentElement.dataset.coreuiTheme =
|
|
2508
|
+
colorMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
2509
|
+
? 'dark'
|
|
2510
|
+
: colorMode;
|
|
2511
|
+
var event = new Event('ColorSchemeChange');
|
|
2512
|
+
document.documentElement.dispatchEvent(event);
|
|
2513
|
+
};
|
|
2514
|
+
var useColorModes = function (localStorageItemName) {
|
|
2515
|
+
if (localStorageItemName === void 0) { localStorageItemName = 'coreui-react-color-scheme'; }
|
|
2516
|
+
var _a = React.useState(getPreferredColorScheme(localStorageItemName)), colorMode = _a[0], setColorMode = _a[1];
|
|
2517
|
+
React.useEffect(function () {
|
|
2518
|
+
setStoredTheme(localStorageItemName, colorMode);
|
|
2519
|
+
setTheme(colorMode);
|
|
2520
|
+
}, [colorMode]);
|
|
2521
|
+
React.useEffect(function () {
|
|
2522
|
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function () {
|
|
2523
|
+
var storedTheme = getStoredTheme(localStorageItemName);
|
|
2524
|
+
if (storedTheme !== 'light' && storedTheme !== 'dark') {
|
|
2525
|
+
setTheme(colorMode);
|
|
2526
|
+
}
|
|
2527
|
+
});
|
|
2528
|
+
}, []);
|
|
2529
|
+
return {
|
|
2530
|
+
getColorMode: function () { return colorMode; },
|
|
2531
|
+
isColorModeSet: function () { return Boolean(getStoredTheme(localStorageItemName)); },
|
|
2532
|
+
setColorMode: function (mode) { return setColorMode(mode); },
|
|
2533
|
+
};
|
|
2534
|
+
};
|
|
2535
|
+
|
|
2495
2536
|
// code borrowed from https://github.com/reach/reach-ui
|
|
2496
2537
|
// problem described https://github.com/facebook/react/issues/13029
|
|
2497
2538
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -2525,7 +2566,7 @@ value) {
|
|
|
2525
2566
|
try {
|
|
2526
2567
|
ref.current = value;
|
|
2527
2568
|
}
|
|
2528
|
-
catch (
|
|
2569
|
+
catch (_a) {
|
|
2529
2570
|
throw new Error("Cannot assign value \"".concat(value, "\" to ref \"").concat(ref, "\""));
|
|
2530
2571
|
}
|
|
2531
2572
|
}
|
|
@@ -2697,7 +2738,10 @@ var textColorsPropType = PropTypes.oneOfType([
|
|
|
2697
2738
|
PropTypes.oneOf(['white', 'muted']),
|
|
2698
2739
|
PropTypes.string,
|
|
2699
2740
|
]);
|
|
2700
|
-
var triggerPropType = PropTypes.
|
|
2741
|
+
var triggerPropType = PropTypes.oneOfType([
|
|
2742
|
+
PropTypes.arrayOf(PropTypes.oneOf(['hover', 'focus', 'click']).isRequired),
|
|
2743
|
+
PropTypes.oneOf(['hover', 'focus', 'click']),
|
|
2744
|
+
]);
|
|
2701
2745
|
|
|
2702
2746
|
var CAlert = React.forwardRef(function (_a, ref) {
|
|
2703
2747
|
var children = _a.children, className = _a.className, _b = _a.color, color = _b === void 0 ? 'primary' : _b, dismissible = _a.dismissible, variant = _a.variant, _c = _a.visible, visible = _c === void 0 ? true : _c, onClose = _a.onClose, rest = __rest(_a, ["children", "className", "color", "dismissible", "variant", "visible", "onClose"]);
|
|
@@ -3042,7 +3086,7 @@ var isInViewport = function (element) {
|
|
|
3042
3086
|
};
|
|
3043
3087
|
|
|
3044
3088
|
var isRTL = function (element) {
|
|
3045
|
-
if (document.documentElement.dir === 'rtl') {
|
|
3089
|
+
if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') {
|
|
3046
3090
|
return true;
|
|
3047
3091
|
}
|
|
3048
3092
|
if (element) {
|
|
@@ -3827,17 +3871,7 @@ function effect$1(_ref2) {
|
|
|
3827
3871
|
}
|
|
3828
3872
|
}
|
|
3829
3873
|
|
|
3830
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3831
|
-
if (!isHTMLElement(arrowElement)) {
|
|
3832
|
-
console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
|
|
3833
|
-
}
|
|
3834
|
-
}
|
|
3835
|
-
|
|
3836
3874
|
if (!contains(state.elements.popper, arrowElement)) {
|
|
3837
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3838
|
-
console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
|
|
3839
|
-
}
|
|
3840
|
-
|
|
3841
3875
|
return;
|
|
3842
3876
|
}
|
|
3843
3877
|
|
|
@@ -3979,17 +4013,6 @@ function computeStyles(_ref5) {
|
|
|
3979
4013
|
adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
|
|
3980
4014
|
_options$roundOffsets = options.roundOffsets,
|
|
3981
4015
|
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
|
3982
|
-
|
|
3983
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3984
|
-
var transitionProperty = getComputedStyle$1(state.elements.popper).transitionProperty || '';
|
|
3985
|
-
|
|
3986
|
-
if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
|
|
3987
|
-
return transitionProperty.indexOf(property) >= 0;
|
|
3988
|
-
})) {
|
|
3989
|
-
console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
|
|
3990
|
-
}
|
|
3991
|
-
}
|
|
3992
|
-
|
|
3993
4016
|
var commonStyles = {
|
|
3994
4017
|
placement: getBasePlacement(state.placement),
|
|
3995
4018
|
variation: getVariation(state.placement),
|
|
@@ -4430,10 +4453,6 @@ function computeAutoPlacement(state, options) {
|
|
|
4430
4453
|
|
|
4431
4454
|
if (allowedPlacements.length === 0) {
|
|
4432
4455
|
allowedPlacements = placements$1;
|
|
4433
|
-
|
|
4434
|
-
if (process.env.NODE_ENV !== "production") {
|
|
4435
|
-
console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
|
|
4436
|
-
}
|
|
4437
4456
|
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
|
|
4438
4457
|
|
|
4439
4458
|
|
|
@@ -4985,108 +5004,6 @@ function debounce(fn) {
|
|
|
4985
5004
|
};
|
|
4986
5005
|
}
|
|
4987
5006
|
|
|
4988
|
-
function format(str) {
|
|
4989
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
4990
|
-
args[_key - 1] = arguments[_key];
|
|
4991
|
-
}
|
|
4992
|
-
|
|
4993
|
-
return [].concat(args).reduce(function (p, c) {
|
|
4994
|
-
return p.replace(/%s/, c);
|
|
4995
|
-
}, str);
|
|
4996
|
-
}
|
|
4997
|
-
|
|
4998
|
-
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
|
|
4999
|
-
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
|
|
5000
|
-
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
|
|
5001
|
-
function validateModifiers(modifiers) {
|
|
5002
|
-
modifiers.forEach(function (modifier) {
|
|
5003
|
-
[].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
|
|
5004
|
-
.filter(function (value, index, self) {
|
|
5005
|
-
return self.indexOf(value) === index;
|
|
5006
|
-
}).forEach(function (key) {
|
|
5007
|
-
switch (key) {
|
|
5008
|
-
case 'name':
|
|
5009
|
-
if (typeof modifier.name !== 'string') {
|
|
5010
|
-
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
|
|
5011
|
-
}
|
|
5012
|
-
|
|
5013
|
-
break;
|
|
5014
|
-
|
|
5015
|
-
case 'enabled':
|
|
5016
|
-
if (typeof modifier.enabled !== 'boolean') {
|
|
5017
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
|
|
5018
|
-
}
|
|
5019
|
-
|
|
5020
|
-
break;
|
|
5021
|
-
|
|
5022
|
-
case 'phase':
|
|
5023
|
-
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
|
5024
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
|
|
5025
|
-
}
|
|
5026
|
-
|
|
5027
|
-
break;
|
|
5028
|
-
|
|
5029
|
-
case 'fn':
|
|
5030
|
-
if (typeof modifier.fn !== 'function') {
|
|
5031
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
|
|
5032
|
-
}
|
|
5033
|
-
|
|
5034
|
-
break;
|
|
5035
|
-
|
|
5036
|
-
case 'effect':
|
|
5037
|
-
if (modifier.effect != null && typeof modifier.effect !== 'function') {
|
|
5038
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
|
|
5039
|
-
}
|
|
5040
|
-
|
|
5041
|
-
break;
|
|
5042
|
-
|
|
5043
|
-
case 'requires':
|
|
5044
|
-
if (modifier.requires != null && !Array.isArray(modifier.requires)) {
|
|
5045
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
|
|
5046
|
-
}
|
|
5047
|
-
|
|
5048
|
-
break;
|
|
5049
|
-
|
|
5050
|
-
case 'requiresIfExists':
|
|
5051
|
-
if (!Array.isArray(modifier.requiresIfExists)) {
|
|
5052
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
|
|
5053
|
-
}
|
|
5054
|
-
|
|
5055
|
-
break;
|
|
5056
|
-
|
|
5057
|
-
case 'options':
|
|
5058
|
-
case 'data':
|
|
5059
|
-
break;
|
|
5060
|
-
|
|
5061
|
-
default:
|
|
5062
|
-
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
|
|
5063
|
-
return "\"" + s + "\"";
|
|
5064
|
-
}).join(', ') + "; but \"" + key + "\" was provided.");
|
|
5065
|
-
}
|
|
5066
|
-
|
|
5067
|
-
modifier.requires && modifier.requires.forEach(function (requirement) {
|
|
5068
|
-
if (modifiers.find(function (mod) {
|
|
5069
|
-
return mod.name === requirement;
|
|
5070
|
-
}) == null) {
|
|
5071
|
-
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
|
|
5072
|
-
}
|
|
5073
|
-
});
|
|
5074
|
-
});
|
|
5075
|
-
});
|
|
5076
|
-
}
|
|
5077
|
-
|
|
5078
|
-
function uniqueBy(arr, fn) {
|
|
5079
|
-
var identifiers = new Set();
|
|
5080
|
-
return arr.filter(function (item) {
|
|
5081
|
-
var identifier = fn(item);
|
|
5082
|
-
|
|
5083
|
-
if (!identifiers.has(identifier)) {
|
|
5084
|
-
identifiers.add(identifier);
|
|
5085
|
-
return true;
|
|
5086
|
-
}
|
|
5087
|
-
});
|
|
5088
|
-
}
|
|
5089
|
-
|
|
5090
5007
|
function mergeByName(modifiers) {
|
|
5091
5008
|
var merged = modifiers.reduce(function (merged, current) {
|
|
5092
5009
|
var existing = merged[current.name];
|
|
@@ -5102,8 +5019,6 @@ function mergeByName(modifiers) {
|
|
|
5102
5019
|
});
|
|
5103
5020
|
}
|
|
5104
5021
|
|
|
5105
|
-
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
|
|
5106
|
-
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
|
|
5107
5022
|
var DEFAULT_OPTIONS = {
|
|
5108
5023
|
placement: 'bottom',
|
|
5109
5024
|
modifiers: [],
|
|
@@ -5165,42 +5080,7 @@ function popperGenerator(generatorOptions) {
|
|
|
5165
5080
|
|
|
5166
5081
|
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
|
5167
5082
|
return m.enabled;
|
|
5168
|
-
});
|
|
5169
|
-
// if one of the modifiers is invalid for any reason
|
|
5170
|
-
|
|
5171
|
-
if (process.env.NODE_ENV !== "production") {
|
|
5172
|
-
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
|
|
5173
|
-
var name = _ref.name;
|
|
5174
|
-
return name;
|
|
5175
|
-
});
|
|
5176
|
-
validateModifiers(modifiers);
|
|
5177
|
-
|
|
5178
|
-
if (getBasePlacement(state.options.placement) === auto) {
|
|
5179
|
-
var flipModifier = state.orderedModifiers.find(function (_ref2) {
|
|
5180
|
-
var name = _ref2.name;
|
|
5181
|
-
return name === 'flip';
|
|
5182
|
-
});
|
|
5183
|
-
|
|
5184
|
-
if (!flipModifier) {
|
|
5185
|
-
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
|
|
5186
|
-
}
|
|
5187
|
-
}
|
|
5188
|
-
|
|
5189
|
-
var _getComputedStyle = getComputedStyle$1(popper),
|
|
5190
|
-
marginTop = _getComputedStyle.marginTop,
|
|
5191
|
-
marginRight = _getComputedStyle.marginRight,
|
|
5192
|
-
marginBottom = _getComputedStyle.marginBottom,
|
|
5193
|
-
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
|
|
5194
|
-
// cause bugs with positioning, so we'll warn the consumer
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
|
|
5198
|
-
return parseFloat(margin);
|
|
5199
|
-
})) {
|
|
5200
|
-
console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
|
|
5201
|
-
}
|
|
5202
|
-
}
|
|
5203
|
-
|
|
5083
|
+
});
|
|
5204
5084
|
runModifierEffects();
|
|
5205
5085
|
return instance.update();
|
|
5206
5086
|
},
|
|
@@ -5220,10 +5100,6 @@ function popperGenerator(generatorOptions) {
|
|
|
5220
5100
|
// anymore
|
|
5221
5101
|
|
|
5222
5102
|
if (!areValidElements(reference, popper)) {
|
|
5223
|
-
if (process.env.NODE_ENV !== "production") {
|
|
5224
|
-
console.error(INVALID_ELEMENT_ERROR);
|
|
5225
|
-
}
|
|
5226
|
-
|
|
5227
5103
|
return;
|
|
5228
5104
|
} // Store the reference and popper rects to be read by modifiers
|
|
5229
5105
|
|
|
@@ -5246,18 +5122,8 @@ function popperGenerator(generatorOptions) {
|
|
|
5246
5122
|
state.orderedModifiers.forEach(function (modifier) {
|
|
5247
5123
|
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
|
5248
5124
|
});
|
|
5249
|
-
var __debug_loops__ = 0;
|
|
5250
5125
|
|
|
5251
5126
|
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
|
5252
|
-
if (process.env.NODE_ENV !== "production") {
|
|
5253
|
-
__debug_loops__ += 1;
|
|
5254
|
-
|
|
5255
|
-
if (__debug_loops__ > 100) {
|
|
5256
|
-
console.error(INFINITE_LOOP_ERROR);
|
|
5257
|
-
break;
|
|
5258
|
-
}
|
|
5259
|
-
}
|
|
5260
|
-
|
|
5261
5127
|
if (state.reset === true) {
|
|
5262
5128
|
state.reset = false;
|
|
5263
5129
|
index = -1;
|
|
@@ -5295,10 +5161,6 @@ function popperGenerator(generatorOptions) {
|
|
|
5295
5161
|
};
|
|
5296
5162
|
|
|
5297
5163
|
if (!areValidElements(reference, popper)) {
|
|
5298
|
-
if (process.env.NODE_ENV !== "production") {
|
|
5299
|
-
console.error(INVALID_ELEMENT_ERROR);
|
|
5300
|
-
}
|
|
5301
|
-
|
|
5302
5164
|
return instance;
|
|
5303
5165
|
}
|
|
5304
5166
|
|
|
@@ -5313,11 +5175,11 @@ function popperGenerator(generatorOptions) {
|
|
|
5313
5175
|
// one.
|
|
5314
5176
|
|
|
5315
5177
|
function runModifierEffects() {
|
|
5316
|
-
state.orderedModifiers.forEach(function (
|
|
5317
|
-
var name =
|
|
5318
|
-
|
|
5319
|
-
options =
|
|
5320
|
-
effect =
|
|
5178
|
+
state.orderedModifiers.forEach(function (_ref) {
|
|
5179
|
+
var name = _ref.name,
|
|
5180
|
+
_ref$options = _ref.options,
|
|
5181
|
+
options = _ref$options === void 0 ? {} : _ref$options,
|
|
5182
|
+
effect = _ref.effect;
|
|
5321
5183
|
|
|
5322
5184
|
if (typeof effect === 'function') {
|
|
5323
5185
|
var cleanupFn = effect({
|
|
@@ -6199,7 +6061,8 @@ var CFormSelect = React.forwardRef(function (_a, ref) {
|
|
|
6199
6061
|
_b), className), size: htmlSize }, rest, { ref: ref }), options
|
|
6200
6062
|
? options.map(function (option, index) {
|
|
6201
6063
|
return (React.createElement("option", __assign({}, (typeof option === 'object' &&
|
|
6202
|
-
option.disabled && { disabled: option.disabled }), (typeof option === 'object' &&
|
|
6064
|
+
option.disabled && { disabled: option.disabled }), (typeof option === 'object' &&
|
|
6065
|
+
option.value !== undefined && { value: option.value }), { key: index }), typeof option === 'string' ? option : option.label));
|
|
6203
6066
|
})
|
|
6204
6067
|
: children)));
|
|
6205
6068
|
});
|
|
@@ -6627,6 +6490,7 @@ var CModal = React.forwardRef(function (_a, ref) {
|
|
|
6627
6490
|
if (backdrop === 'static') {
|
|
6628
6491
|
return setStaticBackdrop(true);
|
|
6629
6492
|
}
|
|
6493
|
+
setVisible(false);
|
|
6630
6494
|
return onClose && onClose();
|
|
6631
6495
|
};
|
|
6632
6496
|
React.useLayoutEffect(function () {
|
|
@@ -7173,6 +7037,7 @@ CProgressBar.propTypes = {
|
|
|
7173
7037
|
};
|
|
7174
7038
|
CProgressBar.displayName = 'CProgressBar';
|
|
7175
7039
|
|
|
7040
|
+
// TODO: update markup and add '.progress-stacked' in v5
|
|
7176
7041
|
var CProgress = React.forwardRef(function (_a, ref) {
|
|
7177
7042
|
var children = _a.children, className = _a.className, height = _a.height, thin = _a.thin, _b = _a.value, value = _b === void 0 ? 0 : _b, white = _a.white, rest = __rest(_a, ["children", "className", "height", "thin", "value", "white"]);
|
|
7178
7043
|
return (React.createElement("div", { className: classNames('progress', {
|
|
@@ -7191,7 +7056,6 @@ CProgress.propTypes = {
|
|
|
7191
7056
|
CProgress.displayName = 'CProgress';
|
|
7192
7057
|
|
|
7193
7058
|
var getPlacement$1 = function (placement, element) {
|
|
7194
|
-
console.log(element);
|
|
7195
7059
|
switch (placement) {
|
|
7196
7060
|
case 'right': {
|
|
7197
7061
|
return isRTL(element) ? 'left' : 'right';
|
|
@@ -7306,7 +7170,7 @@ var CSidebar = React.forwardRef(function (_a, ref) {
|
|
|
7306
7170
|
var _a, _b;
|
|
7307
7171
|
sidebarRef.current && setMobile(isOnMobile(sidebarRef.current));
|
|
7308
7172
|
sidebarRef.current && setInViewport(isInViewport(sidebarRef.current));
|
|
7309
|
-
window.addEventListener('resize',
|
|
7173
|
+
window.addEventListener('resize', handleResize);
|
|
7310
7174
|
window.addEventListener('mouseup', handleClickOutside);
|
|
7311
7175
|
window.addEventListener('keyup', handleKeyup);
|
|
7312
7176
|
(_a = sidebarRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseup', handleOnClick);
|
|
@@ -7315,7 +7179,7 @@ var CSidebar = React.forwardRef(function (_a, ref) {
|
|
|
7315
7179
|
});
|
|
7316
7180
|
return function () {
|
|
7317
7181
|
var _a, _b;
|
|
7318
|
-
window.removeEventListener('resize',
|
|
7182
|
+
window.removeEventListener('resize', handleResize);
|
|
7319
7183
|
window.removeEventListener('mouseup', handleClickOutside);
|
|
7320
7184
|
window.removeEventListener('keyup', handleKeyup);
|
|
7321
7185
|
(_a = sidebarRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', handleOnClick);
|
|
@@ -7424,8 +7288,12 @@ CSidebarHeader.propTypes = {
|
|
|
7424
7288
|
CSidebarHeader.displayName = 'CSidebarHeader';
|
|
7425
7289
|
|
|
7426
7290
|
var CSpinner = React.forwardRef(function (_a, ref) {
|
|
7427
|
-
var
|
|
7428
|
-
|
|
7291
|
+
var _b;
|
|
7292
|
+
var className = _a.className, color = _a.color, _c = _a.component, Component = _c === void 0 ? 'div' : _c, size = _a.size, _d = _a.variant, variant = _d === void 0 ? 'border' : _d, _e = _a.visuallyHiddenLabel, visuallyHiddenLabel = _e === void 0 ? 'Loading...' : _e, rest = __rest(_a, ["className", "color", "component", "size", "variant", "visuallyHiddenLabel"]);
|
|
7293
|
+
return (React.createElement(Component, __assign({ className: classNames("spinner-".concat(variant), (_b = {},
|
|
7294
|
+
_b["spinner-".concat(variant, "-").concat(size)] = size,
|
|
7295
|
+
_b["text-".concat(color)] = color,
|
|
7296
|
+
_b), className), role: "status" }, rest, { ref: ref }),
|
|
7429
7297
|
React.createElement("span", { className: "visually-hidden" }, visuallyHiddenLabel)));
|
|
7430
7298
|
});
|
|
7431
7299
|
CSpinner.propTypes = {
|
|
@@ -7596,7 +7464,8 @@ var CTable = React.forwardRef(function (_a, ref) {
|
|
|
7596
7464
|
React.createElement(CTableRow, null, columns.map(function (column, index) { return (React.createElement(CTableHeaderCell, __assign({}, (column._props && __assign({}, column._props)), (column._style && { style: __assign({}, column._style) }), { key: index }), getColumnLabel(column))); })))),
|
|
7597
7465
|
items && (React.createElement(CTableBody, null, items.map(function (item, index) { return (React.createElement(CTableRow, __assign({}, (item._props && __assign({}, item._props)), { key: index }), columnNames &&
|
|
7598
7466
|
columnNames.map(function (colName, index) {
|
|
7599
|
-
|
|
7467
|
+
// eslint-disable-next-line unicorn/no-negated-condition
|
|
7468
|
+
return item[colName] !== undefined ? (React.createElement(CTableDataCell, __assign({}, (item._cellProps && __assign(__assign({}, (item._cellProps['all'] && __assign({}, item._cellProps['all']))), (item._cellProps[colName] && __assign({}, item._cellProps[colName])))), { key: index }), item[colName])) : null;
|
|
7600
7469
|
}))); }))),
|
|
7601
7470
|
children,
|
|
7602
7471
|
footer && (React.createElement(CTableFoot, __assign({}, tableFootProps),
|
|
@@ -7795,7 +7664,6 @@ CToaster.propTypes = {
|
|
|
7795
7664
|
CToaster.displayName = 'CToaster';
|
|
7796
7665
|
|
|
7797
7666
|
var getPlacement = function (placement, element) {
|
|
7798
|
-
console.log(element);
|
|
7799
7667
|
switch (placement) {
|
|
7800
7668
|
case 'right': {
|
|
7801
7669
|
return isRTL(element) ? 'left' : 'right';
|
|
@@ -8133,4 +8001,6 @@ exports.CWidgetStatsC = CWidgetStatsC;
|
|
|
8133
8001
|
exports.CWidgetStatsD = CWidgetStatsD;
|
|
8134
8002
|
exports.CWidgetStatsE = CWidgetStatsE;
|
|
8135
8003
|
exports.CWidgetStatsF = CWidgetStatsF;
|
|
8004
|
+
exports.useColorModes = useColorModes;
|
|
8005
|
+
exports.useForkedRef = useForkedRef;
|
|
8136
8006
|
//# sourceMappingURL=index.js.map
|