react-bootstrap 2.0.0-rc.1 → 2.0.3
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/cjs/ElementChildren.d.ts +6 -1
- package/cjs/ElementChildren.js +10 -0
- package/cjs/FormCheck.js +4 -2
- package/cjs/FormSelect.d.ts +1 -1
- package/dist/react-bootstrap.js +17 -7
- package/dist/react-bootstrap.min.js +1 -1
- package/esm/ElementChildren.d.ts +6 -1
- package/esm/ElementChildren.js +10 -1
- package/esm/FormCheck.js +3 -2
- package/esm/FormSelect.d.ts +1 -1
- package/package.json +2 -2
- package/cjs/AbstractNav.d.ts +0 -15
- package/cjs/AbstractNavItem.d.ts +0 -19
- package/cjs/AccordionToggle.d.ts +0 -11
- package/cjs/CardColumns.d.ts +0 -2
- package/cjs/CardContext.d.ts +0 -6
- package/cjs/CardDeck.d.ts +0 -2
- package/cjs/FormFile.d.ts +0 -23
- package/cjs/FormFileInput.d.ts +0 -10
- package/cjs/FormFileLabel.d.ts +0 -7
- package/cjs/Jumbotron.d.ts +0 -7
- package/cjs/Media.d.ts +0 -8
- package/cjs/PopoverContent.d.ts +0 -5
- package/cjs/PopoverTitle.d.ts +0 -5
- package/cjs/ResponsiveEmbed.d.ts +0 -9
- package/cjs/SafeAnchor.d.ts +0 -17
- package/cjs/SelectableContext.d.ts +0 -5
- package/cjs/TabContext.d.ts +0 -12
- package/cjs/usePopperMarginModifiers.d.ts +0 -4
- package/esm/AbstractNav.d.ts +0 -15
- package/esm/AbstractNavItem.d.ts +0 -19
- package/esm/AccordionToggle.d.ts +0 -11
- package/esm/CardColumns.d.ts +0 -2
- package/esm/CardContext.d.ts +0 -6
- package/esm/CardDeck.d.ts +0 -2
- package/esm/FormFile.d.ts +0 -23
- package/esm/FormFileInput.d.ts +0 -10
- package/esm/FormFileLabel.d.ts +0 -7
- package/esm/Jumbotron.d.ts +0 -7
- package/esm/Media.d.ts +0 -8
- package/esm/PopoverContent.d.ts +0 -5
- package/esm/PopoverTitle.d.ts +0 -5
- package/esm/ResponsiveEmbed.d.ts +0 -9
- package/esm/SafeAnchor.d.ts +0 -17
- package/esm/SelectableContext.d.ts +0 -5
- package/esm/TabContext.d.ts +0 -12
- package/esm/usePopperMarginModifiers.d.ts +0 -4
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ See the below table on which version of React-Bootstrap you should be using in y
|
|
|
17
17
|
|
|
18
18
|
| Bootstrap Version | React-Bootstrap Version | Documentation |
|
|
19
19
|
| ------------- |:-------------:| -----:|
|
|
20
|
-
| v5.x | 2.x
|
|
20
|
+
| v5.x | 2.x | [Link][v5-documentation] |
|
|
21
21
|
| v4.x | 1.x | [Link][v4-documentation] |
|
|
22
22
|
| v3.x | 0.33.x (not maintained) | [Link][v3-documentation] |
|
|
23
23
|
|
package/cjs/ElementChildren.d.ts
CHANGED
|
@@ -15,4 +15,9 @@ declare function map<P = any>(children: any, func: (el: React.ReactElement<P>, i
|
|
|
15
15
|
* leaf child with the index reflecting the position relative to "valid components".
|
|
16
16
|
*/
|
|
17
17
|
declare function forEach<P = any>(children: any, func: (el: React.ReactElement<P>, index: number) => void): void;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Finds whether a component's `children` prop includes a React element of the
|
|
20
|
+
* specified type.
|
|
21
|
+
*/
|
|
22
|
+
declare function hasChildOfType<P = any>(children: React.ReactNode, type: string | React.JSXElementConstructor<P>): boolean;
|
|
23
|
+
export { map, forEach, hasChildOfType };
|
package/cjs/ElementChildren.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.forEach = forEach;
|
|
5
|
+
exports.hasChildOfType = hasChildOfType;
|
|
5
6
|
exports.map = map;
|
|
6
7
|
|
|
7
8
|
var React = _interopRequireWildcard(require("react"));
|
|
@@ -35,4 +36,13 @@ function forEach(children, func) {
|
|
|
35
36
|
React.Children.forEach(children, child => {
|
|
36
37
|
if ( /*#__PURE__*/React.isValidElement(child)) func(child, index++);
|
|
37
38
|
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Finds whether a component's `children` prop includes a React element of the
|
|
42
|
+
* specified type.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
function hasChildOfType(children, type) {
|
|
47
|
+
return React.Children.toArray(children).some(child => /*#__PURE__*/React.isValidElement(child) && child.type === type);
|
|
38
48
|
}
|
package/cjs/FormCheck.js
CHANGED
|
@@ -19,6 +19,8 @@ var _FormContext = _interopRequireDefault(require("./FormContext"));
|
|
|
19
19
|
|
|
20
20
|
var _ThemeProvider = require("./ThemeProvider");
|
|
21
21
|
|
|
22
|
+
var _ElementChildren = require("./ElementChildren");
|
|
23
|
+
|
|
22
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
25
|
|
|
24
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -54,7 +56,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
54
56
|
const innerFormContext = (0, React.useMemo)(() => ({
|
|
55
57
|
controlId: id || controlId
|
|
56
58
|
}), [controlId, id]);
|
|
57
|
-
const hasLabel = label != null && label !== false
|
|
59
|
+
const hasLabel = !children && label != null && label !== false || (0, _ElementChildren.hasChildOfType)(children, _FormCheckLabel.default);
|
|
58
60
|
const input = /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormCheckInput.default, { ...props,
|
|
59
61
|
type: type === 'switch' ? 'checkbox' : type,
|
|
60
62
|
ref: ref,
|
|
@@ -67,7 +69,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
67
69
|
value: innerFormContext,
|
|
68
70
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
69
71
|
style: style,
|
|
70
|
-
className: (0, _classnames.default)(className,
|
|
72
|
+
className: (0, _classnames.default)(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, type === 'switch' && bsSwitchPrefix),
|
|
71
73
|
children: children || /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
72
74
|
children: [input, hasLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormCheckLabel.default, {
|
|
73
75
|
title: title,
|
package/cjs/FormSelect.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BsPrefixOnlyProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
3
|
-
export interface FormSelectProps extends BsPrefixOnlyProps, React.
|
|
3
|
+
export interface FormSelectProps extends BsPrefixOnlyProps, Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
4
4
|
htmlSize?: number;
|
|
5
5
|
size?: 'sm' | 'lg';
|
|
6
6
|
isValid?: boolean;
|
package/dist/react-bootstrap.js
CHANGED
|
@@ -4995,6 +4995,15 @@ function forEach(children, func) {
|
|
|
4995
4995
|
if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(child)) func(child, index++);
|
|
4996
4996
|
});
|
|
4997
4997
|
}
|
|
4998
|
+
/**
|
|
4999
|
+
* Finds whether a component's `children` prop includes a React element of the
|
|
5000
|
+
* specified type.
|
|
5001
|
+
*/
|
|
5002
|
+
|
|
5003
|
+
|
|
5004
|
+
function hasChildOfType(children, type) {
|
|
5005
|
+
return external_root_React_commonjs2_react_commonjs_react_amd_react_.Children.toArray(children).some(child => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(child) && child.type === type);
|
|
5006
|
+
}
|
|
4998
5007
|
|
|
4999
5008
|
|
|
5000
5009
|
;// CONCATENATED MODULE: ./src/Carousel.tsx
|
|
@@ -9469,6 +9478,7 @@ var FormCheck_jsxFileName = "/Users/kyletsang/Documents/Kyle/Code/react-bootstra
|
|
|
9469
9478
|
|
|
9470
9479
|
|
|
9471
9480
|
|
|
9481
|
+
|
|
9472
9482
|
const FormCheck_propTypes = {
|
|
9473
9483
|
/**
|
|
9474
9484
|
* @default 'form-check'
|
|
@@ -9586,7 +9596,7 @@ const FormCheck = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_reac
|
|
|
9586
9596
|
const innerFormContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => ({
|
|
9587
9597
|
controlId: id || controlId
|
|
9588
9598
|
}), [controlId, id]);
|
|
9589
|
-
const hasLabel = label != null && label !== false
|
|
9599
|
+
const hasLabel = !children && label != null && label !== false || hasChildOfType(children, src_FormCheckLabel);
|
|
9590
9600
|
|
|
9591
9601
|
const input = /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(src_FormCheckInput, { ...props,
|
|
9592
9602
|
type: type === 'switch' ? 'checkbox' : type,
|
|
@@ -9597,7 +9607,7 @@ const FormCheck = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_reac
|
|
|
9597
9607
|
as: as
|
|
9598
9608
|
}, void 0, false, {
|
|
9599
9609
|
fileName: FormCheck_jsxFileName,
|
|
9600
|
-
lineNumber:
|
|
9610
|
+
lineNumber: 161,
|
|
9601
9611
|
columnNumber: 9
|
|
9602
9612
|
}, undefined);
|
|
9603
9613
|
|
|
@@ -9605,14 +9615,14 @@ const FormCheck = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_reac
|
|
|
9605
9615
|
value: innerFormContext,
|
|
9606
9616
|
children: /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)("div", {
|
|
9607
9617
|
style: style,
|
|
9608
|
-
className: classnames_default()(className,
|
|
9618
|
+
className: classnames_default()(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, type === 'switch' && bsSwitchPrefix),
|
|
9609
9619
|
children: children || /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(jsx_dev_runtime.Fragment, {
|
|
9610
9620
|
children: [input, hasLabel && /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(src_FormCheckLabel, {
|
|
9611
9621
|
title: title,
|
|
9612
9622
|
children: label
|
|
9613
9623
|
}, void 0, false, {
|
|
9614
9624
|
fileName: FormCheck_jsxFileName,
|
|
9615
|
-
lineNumber:
|
|
9625
|
+
lineNumber: 187,
|
|
9616
9626
|
columnNumber: 19
|
|
9617
9627
|
}, undefined), feedback && /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(src_Feedback, {
|
|
9618
9628
|
type: feedbackType,
|
|
@@ -9620,18 +9630,18 @@ const FormCheck = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_reac
|
|
|
9620
9630
|
children: feedback
|
|
9621
9631
|
}, void 0, false, {
|
|
9622
9632
|
fileName: FormCheck_jsxFileName,
|
|
9623
|
-
lineNumber:
|
|
9633
|
+
lineNumber: 190,
|
|
9624
9634
|
columnNumber: 19
|
|
9625
9635
|
}, undefined)]
|
|
9626
9636
|
}, void 0, true)
|
|
9627
9637
|
}, void 0, false, {
|
|
9628
9638
|
fileName: FormCheck_jsxFileName,
|
|
9629
|
-
lineNumber:
|
|
9639
|
+
lineNumber: 174,
|
|
9630
9640
|
columnNumber: 11
|
|
9631
9641
|
}, undefined)
|
|
9632
9642
|
}, void 0, false, {
|
|
9633
9643
|
fileName: FormCheck_jsxFileName,
|
|
9634
|
-
lineNumber:
|
|
9644
|
+
lineNumber: 173,
|
|
9635
9645
|
columnNumber: 9
|
|
9636
9646
|
}, undefined);
|
|
9637
9647
|
});
|