@carbon/react 1.16.0 → 1.17.0-rc.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/es/components/Checkbox/Checkbox.Skeleton.d.ts +18 -0
- package/es/components/Checkbox/Checkbox.Skeleton.js +1 -2
- package/es/components/Checkbox/Checkbox.d.ts +47 -0
- package/es/components/Checkbox/Checkbox.js +6 -7
- package/es/components/Checkbox/index.d.ts +10 -0
- package/es/components/Checkbox/index.js +10 -0
- package/es/components/ComposedModal/ComposedModal.js +4 -3
- package/es/components/DataTable/TableToolbarSearch.js +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
- package/es/components/Grid/Grid.js +0 -5
- package/es/components/Modal/Modal.js +5 -4
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +8 -2
- package/es/components/Search/Search.js +160 -184
- package/es/components/Search/index.js +2 -8
- package/es/components/Tab/index.js +1 -1
- package/es/components/Tabs/Tabs.Skeleton.js +6 -6
- package/es/components/Tabs/Tabs.js +582 -508
- package/es/components/Tabs/index.js +2 -12
- package/es/components/Tabs/{next/usePressable.js → usePressable.js} +1 -1
- package/es/components/Text/Text.d.ts +33 -0
- package/es/components/Text/Text.js +8 -5
- package/es/components/Text/TextDirection.d.ts +35 -0
- package/es/components/Text/TextDirectionContext.js +2 -0
- package/es/components/Text/createTextComponent.d.ts +18 -0
- package/es/components/Text/index.d.ts +18 -0
- package/es/components/Text/index.js +2 -0
- package/es/components/TextArea/TextArea.js +19 -2
- package/es/components/Tile/Tile.js +339 -502
- package/es/index.js +9 -9
- package/es/internal/usePrefix.d.ts +9 -0
- package/lib/components/Checkbox/Checkbox.Skeleton.d.ts +18 -0
- package/lib/components/Checkbox/Checkbox.Skeleton.js +1 -2
- package/lib/components/Checkbox/Checkbox.d.ts +47 -0
- package/lib/components/Checkbox/Checkbox.js +6 -7
- package/lib/components/Checkbox/index.d.ts +10 -0
- package/lib/components/Checkbox/index.js +18 -0
- package/lib/components/ComposedModal/ComposedModal.js +4 -3
- package/lib/components/DataTable/TableToolbarSearch.js +2 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.js +3 -3
- package/lib/components/Grid/Grid.js +0 -5
- package/lib/components/Modal/Modal.js +5 -4
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +8 -2
- package/lib/components/Search/Search.js +159 -183
- package/lib/components/Search/index.js +2 -25
- package/lib/components/Tab/index.js +1 -1
- package/lib/components/Tabs/Tabs.Skeleton.js +6 -6
- package/lib/components/Tabs/Tabs.js +586 -507
- package/lib/components/Tabs/index.js +7 -33
- package/lib/components/Tabs/{next/usePressable.js → usePressable.js} +1 -1
- package/lib/components/Text/Text.d.ts +33 -0
- package/lib/components/Text/Text.js +8 -5
- package/lib/components/Text/TextDirection.d.ts +35 -0
- package/lib/components/Text/TextDirectionContext.js +2 -0
- package/lib/components/Text/createTextComponent.d.ts +18 -0
- package/lib/components/Text/index.d.ts +18 -0
- package/lib/components/Text/index.js +4 -0
- package/lib/components/TextArea/TextArea.js +18 -1
- package/lib/components/Tile/Tile.js +336 -499
- package/lib/index.js +76 -76
- package/lib/internal/usePrefix.d.ts +9 -0
- package/package.json +8 -4
- package/es/components/Search/next/Search.js +0 -265
- package/es/components/Tabs/next/Tabs.Skeleton.js +0 -53
- package/es/components/Tabs/next/Tabs.js +0 -692
- package/es/components/Tile/index.js +0 -19
- package/es/components/Tile/next/Tile.js +0 -604
- package/lib/components/Search/next/Search.js +0 -275
- package/lib/components/Tabs/next/Tabs.Skeleton.js +0 -63
- package/lib/components/Tabs/next/Tabs.js +0 -708
- package/lib/components/Tile/index.js +0 -48
- package/lib/components/Tile/next/Tile.js +0 -619
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2018
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { HTMLAttributes } from 'react';
|
|
9
|
+
declare const CheckboxSkeleton: {
|
|
10
|
+
({ className, ...rest }: HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
11
|
+
propTypes: {
|
|
12
|
+
/**
|
|
13
|
+
* Specify an optional className to add.
|
|
14
|
+
*/
|
|
15
|
+
className: PropTypes.Requireable<string>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default CheckboxSkeleton;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2018
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { ReactNodeLike } from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
declare type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type';
|
|
10
|
+
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
11
|
+
/**
|
|
12
|
+
* Provide an `id` to uniquely identify the Checkbox input
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* Provide a label to provide a description of the Checkbox input that you are
|
|
17
|
+
* exposing to the user
|
|
18
|
+
*/
|
|
19
|
+
labelText: NonNullable<ReactNodeLike>;
|
|
20
|
+
/**
|
|
21
|
+
* Specify whether the underlying input should be checked by default
|
|
22
|
+
*/
|
|
23
|
+
defaultChecked?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Specify whether the Checkbox should be disabled
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Specify whether the label should be hidden, or not
|
|
30
|
+
*/
|
|
31
|
+
hideLabel?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Specify whether the Checkbox is in an indeterminate state
|
|
34
|
+
*/
|
|
35
|
+
indeterminate?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Provide an optional handler that is called when the internal state of
|
|
38
|
+
* Checkbox changes. This handler is called with event and state info.
|
|
39
|
+
* `(event, { checked, id }) => void`
|
|
40
|
+
*/
|
|
41
|
+
onChange?: (evt: React.ChangeEvent<HTMLInputElement>, data: {
|
|
42
|
+
checked: boolean;
|
|
43
|
+
id: string;
|
|
44
|
+
}) => void;
|
|
45
|
+
}
|
|
46
|
+
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<unknown>>;
|
|
47
|
+
export default Checkbox;
|
|
@@ -14,7 +14,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
14
14
|
import { Text } from '../Text/Text.js';
|
|
15
15
|
|
|
16
16
|
var _excluded = ["className", "id", "labelText", "onChange", "indeterminate", "hideLabel", "title"];
|
|
17
|
-
var Checkbox = /*#__PURE__*/React__default.forwardRef(function
|
|
17
|
+
var Checkbox = /*#__PURE__*/React__default.forwardRef(function (_ref, _ref2) {
|
|
18
18
|
var className = _ref.className,
|
|
19
19
|
id = _ref.id,
|
|
20
20
|
labelText = _ref.labelText,
|
|
@@ -33,7 +33,7 @@ var Checkbox = /*#__PURE__*/React__default.forwardRef(function Checkbox(_ref, _r
|
|
|
33
33
|
}, /*#__PURE__*/React__default.createElement("input", _extends({}, other, {
|
|
34
34
|
type: "checkbox",
|
|
35
35
|
onChange: function onChange(evt) {
|
|
36
|
-
_onChange(evt, {
|
|
36
|
+
_onChange && _onChange(evt, {
|
|
37
37
|
checked: evt.target.checked,
|
|
38
38
|
id: id
|
|
39
39
|
});
|
|
@@ -41,20 +41,20 @@ var Checkbox = /*#__PURE__*/React__default.forwardRef(function Checkbox(_ref, _r
|
|
|
41
41
|
className: "".concat(prefix, "--checkbox"),
|
|
42
42
|
id: id,
|
|
43
43
|
ref: function ref(el) {
|
|
44
|
-
if (el) {
|
|
44
|
+
if (el && indeterminate) {
|
|
45
45
|
el.indeterminate = indeterminate;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
if (typeof _ref2 === 'function') {
|
|
49
49
|
_ref2(el);
|
|
50
|
-
} else if (Object(_ref2) === _ref2) {
|
|
50
|
+
} else if (_ref2 && Object(_ref2) === _ref2) {
|
|
51
51
|
_ref2.current = el;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
})), /*#__PURE__*/React__default.createElement("label", {
|
|
55
55
|
htmlFor: id,
|
|
56
56
|
className: "".concat(prefix, "--checkbox-label"),
|
|
57
|
-
title: title
|
|
57
|
+
title: title
|
|
58
58
|
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
59
59
|
className: innerLabelClasses
|
|
60
60
|
}, labelText)));
|
|
@@ -118,6 +118,5 @@ Checkbox.defaultProps = {
|
|
|
118
118
|
indeterminate: false
|
|
119
119
|
};
|
|
120
120
|
Checkbox.displayName = 'Checkbox';
|
|
121
|
-
var Checkbox$1 = Checkbox;
|
|
122
121
|
|
|
123
|
-
export { Checkbox
|
|
122
|
+
export { Checkbox as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2018
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export { default as CheckboxSkeleton } from './Checkbox.Skeleton';
|
|
8
|
+
import Checkbox, { CheckboxProps } from './Checkbox';
|
|
9
|
+
export type { CheckboxProps };
|
|
10
|
+
export default Checkbox;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { default as CheckboxSkeleton } from './Checkbox.Skeleton.js';
|
|
9
|
+
import Checkbox from './Checkbox.js';
|
|
10
|
+
export { default } from './Checkbox.js';
|
|
@@ -19,7 +19,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
19
19
|
var _ModalBody$propTypes, _ComposedModal$propTy;
|
|
20
20
|
|
|
21
21
|
var _excluded = ["className", "children", "hasForm", "hasScrollingContent"],
|
|
22
|
-
_excluded2 = ["aria-labelledby", "aria-label", "children", "className", "containerClassName", "danger", "onClose", "onKeyDown", "open", "preventCloseOnClickOutside", "selectorPrimaryFocus", "selectorsFloatingMenus", "size"];
|
|
22
|
+
_excluded2 = ["aria-labelledby", "aria-label", "children", "className", "containerClassName", "danger", "isFullWidth", "onClose", "onKeyDown", "open", "preventCloseOnClickOutside", "selectorPrimaryFocus", "selectorsFloatingMenus", "size"];
|
|
23
23
|
var ModalBody = /*#__PURE__*/React__default.forwardRef(function ModalBody(_ref, ref) {
|
|
24
24
|
var _cx;
|
|
25
25
|
|
|
@@ -53,6 +53,7 @@ var ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedModa
|
|
|
53
53
|
customClassName = _ref2.className,
|
|
54
54
|
containerClassName = _ref2.containerClassName,
|
|
55
55
|
danger = _ref2.danger,
|
|
56
|
+
isFullWidth = _ref2.isFullWidth,
|
|
56
57
|
onClose = _ref2.onClose,
|
|
57
58
|
onKeyDown = _ref2.onKeyDown,
|
|
58
59
|
open = _ref2.open,
|
|
@@ -129,7 +130,7 @@ var ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedModa
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
var modalClass = cx((_cx2 = {}, _defineProperty(_cx2, "".concat(prefix, "--modal"), true), _defineProperty(_cx2, 'is-visible', isOpen), _defineProperty(_cx2, customClassName, customClassName), _defineProperty(_cx2, "".concat(prefix, "--modal--danger"), danger), _cx2));
|
|
132
|
-
var containerClass = cx((_cx3 = {}, _defineProperty(_cx3, "".concat(prefix, "--modal-container"), true), _defineProperty(_cx3, "".concat(prefix, "--modal-container--").concat(size), size), _defineProperty(_cx3, containerClassName, containerClassName), _cx3)); // Generate aria-label based on Modal Header label if one is not provided (L253)
|
|
133
|
+
var containerClass = cx((_cx3 = {}, _defineProperty(_cx3, "".concat(prefix, "--modal-container"), true), _defineProperty(_cx3, "".concat(prefix, "--modal-container--").concat(size), size), _defineProperty(_cx3, "".concat(prefix, "--modal-container--full-width"), isFullWidth), _defineProperty(_cx3, containerClassName, containerClassName), _cx3)); // Generate aria-label based on Modal Header label if one is not provided (L253)
|
|
133
134
|
|
|
134
135
|
var generatedAriaLabel;
|
|
135
136
|
var childrenWithProps = React__default.Children.toArray(children).map(function (child) {
|
|
@@ -216,7 +217,7 @@ var ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedModa
|
|
|
216
217
|
className: "".concat(prefix, "--visually-hidden")
|
|
217
218
|
}, "Focus sentinel")));
|
|
218
219
|
});
|
|
219
|
-
ComposedModal.propTypes = (_ComposedModal$propTy = {}, _defineProperty(_ComposedModal$propTy, 'aria-label', PropTypes.string), _defineProperty(_ComposedModal$propTy, 'aria-labelledby', PropTypes.string), _defineProperty(_ComposedModal$propTy, "children", PropTypes.node), _defineProperty(_ComposedModal$propTy, "className", PropTypes.string), _defineProperty(_ComposedModal$propTy, "containerClassName", PropTypes.string), _defineProperty(_ComposedModal$propTy, "danger", PropTypes.bool), _defineProperty(_ComposedModal$propTy, "onClose", PropTypes.func), _defineProperty(_ComposedModal$propTy, "onKeyDown", PropTypes.func), _defineProperty(_ComposedModal$propTy, "open", PropTypes.bool), _defineProperty(_ComposedModal$propTy, "preventCloseOnClickOutside", PropTypes.bool), _defineProperty(_ComposedModal$propTy, "selectorPrimaryFocus", PropTypes.string), _defineProperty(_ComposedModal$propTy, "selectorsFloatingMenus", PropTypes.arrayOf(PropTypes.string)), _defineProperty(_ComposedModal$propTy, "size", PropTypes.oneOf(['xs', 'sm', 'md', 'lg'])), _ComposedModal$propTy);
|
|
220
|
+
ComposedModal.propTypes = (_ComposedModal$propTy = {}, _defineProperty(_ComposedModal$propTy, 'aria-label', PropTypes.string), _defineProperty(_ComposedModal$propTy, 'aria-labelledby', PropTypes.string), _defineProperty(_ComposedModal$propTy, "children", PropTypes.node), _defineProperty(_ComposedModal$propTy, "className", PropTypes.string), _defineProperty(_ComposedModal$propTy, "containerClassName", PropTypes.string), _defineProperty(_ComposedModal$propTy, "danger", PropTypes.bool), _defineProperty(_ComposedModal$propTy, "isFullWidth", PropTypes.bool), _defineProperty(_ComposedModal$propTy, "onClose", PropTypes.func), _defineProperty(_ComposedModal$propTy, "onKeyDown", PropTypes.func), _defineProperty(_ComposedModal$propTy, "open", PropTypes.bool), _defineProperty(_ComposedModal$propTy, "preventCloseOnClickOutside", PropTypes.bool), _defineProperty(_ComposedModal$propTy, "selectorPrimaryFocus", PropTypes.string), _defineProperty(_ComposedModal$propTy, "selectorsFloatingMenus", PropTypes.arrayOf(PropTypes.string)), _defineProperty(_ComposedModal$propTy, "size", PropTypes.oneOf(['xs', 'sm', 'md', 'lg'])), _ComposedModal$propTy);
|
|
220
221
|
ComposedModal.defaultProps = {
|
|
221
222
|
onKeyDown: function onKeyDown() {},
|
|
222
223
|
selectorPrimaryFocus: '[data-modal-primary-focus]'
|
|
@@ -9,7 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default, { useRef, useState, useMemo, useEffect } from 'react';
|
|
12
|
-
import Search from '../Search/
|
|
12
|
+
import Search from '../Search/Search.js';
|
|
13
13
|
import setupGetInstanceId from './tools/instanceId.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import React__default, { useState, useRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
|
-
import Search from '../Search/
|
|
11
|
+
import Search from '../Search/Search.js';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
14
14
|
|
|
@@ -37,11 +37,6 @@ Grid.propTypes = {
|
|
|
37
37
|
*/
|
|
38
38
|
className: PropTypes.string,
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* Specify how many columns wide the Grid should span
|
|
42
|
-
*/
|
|
43
|
-
columns: PropTypes.number,
|
|
44
|
-
|
|
45
40
|
/**
|
|
46
41
|
* Collapse the gutter to 1px. Useful for fluid layouts.
|
|
47
42
|
* Rows have 1px of margin between them to match gutter.
|
|
@@ -20,10 +20,10 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
20
20
|
|
|
21
21
|
var _Modal$propTypes;
|
|
22
22
|
|
|
23
|
-
var _excluded = ["children", "className", "modalHeading", "modalLabel", "modalAriaLabel", "passiveModal", "secondaryButtonText", "primaryButtonText", "open", "onRequestClose", "onRequestSubmit", "onSecondarySubmit", "primaryButtonDisabled", "danger", "alert", "secondaryButtons", "selectorPrimaryFocus", "selectorsFloatingMenus", "shouldSubmitOnEnter", "size", "hasScrollingContent", "closeButtonLabel", "preventCloseOnClickOutside"];
|
|
23
|
+
var _excluded = ["children", "className", "modalHeading", "modalLabel", "modalAriaLabel", "passiveModal", "secondaryButtonText", "primaryButtonText", "open", "onRequestClose", "onRequestSubmit", "onSecondarySubmit", "primaryButtonDisabled", "danger", "alert", "secondaryButtons", "selectorPrimaryFocus", "selectorsFloatingMenus", "shouldSubmitOnEnter", "size", "hasScrollingContent", "closeButtonLabel", "preventCloseOnClickOutside", "isFullWidth"];
|
|
24
24
|
var getInstanceId = setupGetInstanceId();
|
|
25
25
|
var Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
26
|
-
var _classNames;
|
|
26
|
+
var _classNames, _classNames2;
|
|
27
27
|
|
|
28
28
|
var children = _ref.children,
|
|
29
29
|
className = _ref.className,
|
|
@@ -48,6 +48,7 @@ var Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
48
48
|
hasScrollingContent = _ref.hasScrollingContent,
|
|
49
49
|
closeButtonLabel = _ref.closeButtonLabel,
|
|
50
50
|
preventCloseOnClickOutside = _ref.preventCloseOnClickOutside,
|
|
51
|
+
isFullWidth = _ref.isFullWidth,
|
|
51
52
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
52
53
|
|
|
53
54
|
var prefix = usePrefix();
|
|
@@ -105,7 +106,7 @@ var Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
105
106
|
|
|
106
107
|
var onSecondaryButtonClick = onSecondarySubmit ? onSecondarySubmit : onRequestClose;
|
|
107
108
|
var modalClasses = cx("".concat(prefix, "--modal"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--modal-tall"), !passiveModal), _defineProperty(_classNames, 'is-visible', open), _defineProperty(_classNames, "".concat(prefix, "--modal--danger"), danger), _defineProperty(_classNames, className, className), _classNames));
|
|
108
|
-
var containerClasses = cx("".concat(prefix, "--modal-container"),
|
|
109
|
+
var containerClasses = cx("".concat(prefix, "--modal-container"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "--modal-container--").concat(size), size), _defineProperty(_classNames2, "".concat(prefix, "--modal-container--full-width"), isFullWidth), _classNames2));
|
|
109
110
|
var contentClasses = cx("".concat(prefix, "--modal-content"), _defineProperty({}, "".concat(prefix, "--modal-scroll-content"), hasScrollingContent));
|
|
110
111
|
var footerClasses = cx("".concat(prefix, "--modal-footer"), _defineProperty({}, "".concat(prefix, "--modal-footer--three-button"), Array.isArray(secondaryButtons) && secondaryButtons.length === 2));
|
|
111
112
|
var modalButton = /*#__PURE__*/React__default.createElement("button", {
|
|
@@ -240,7 +241,7 @@ Modal.propTypes = (_Modal$propTypes = {
|
|
|
240
241
|
* Should go hand in hand with the danger prop.
|
|
241
242
|
*/
|
|
242
243
|
alert: PropTypes.bool
|
|
243
|
-
}, _defineProperty(_Modal$propTypes, 'aria-label', requiredIfGivenPropIsTruthy('hasScrollingContent', PropTypes.string)), _defineProperty(_Modal$propTypes, "children", PropTypes.node), _defineProperty(_Modal$propTypes, "className", PropTypes.string), _defineProperty(_Modal$propTypes, "closeButtonLabel", PropTypes.string), _defineProperty(_Modal$propTypes, "danger", PropTypes.bool), _defineProperty(_Modal$propTypes, "hasScrollingContent", PropTypes.bool), _defineProperty(_Modal$propTypes, "id", PropTypes.string), _defineProperty(_Modal$propTypes, "modalAriaLabel", PropTypes.string), _defineProperty(_Modal$propTypes, "modalHeading", PropTypes.node), _defineProperty(_Modal$propTypes, "modalLabel", PropTypes.node), _defineProperty(_Modal$propTypes, "onKeyDown", PropTypes.func), _defineProperty(_Modal$propTypes, "onRequestClose", PropTypes.func), _defineProperty(_Modal$propTypes, "onRequestSubmit", PropTypes.func), _defineProperty(_Modal$propTypes, "onSecondarySubmit", PropTypes.func), _defineProperty(_Modal$propTypes, "open", PropTypes.bool), _defineProperty(_Modal$propTypes, "passiveModal", PropTypes.bool), _defineProperty(_Modal$propTypes, "preventCloseOnClickOutside", PropTypes.bool), _defineProperty(_Modal$propTypes, "primaryButtonDisabled", PropTypes.bool), _defineProperty(_Modal$propTypes, "primaryButtonText", PropTypes.node), _defineProperty(_Modal$propTypes, "secondaryButtonText", PropTypes.node), _defineProperty(_Modal$propTypes, "secondaryButtons", function secondaryButtons(props, propName, componentName) {
|
|
244
|
+
}, _defineProperty(_Modal$propTypes, 'aria-label', requiredIfGivenPropIsTruthy('hasScrollingContent', PropTypes.string)), _defineProperty(_Modal$propTypes, "children", PropTypes.node), _defineProperty(_Modal$propTypes, "className", PropTypes.string), _defineProperty(_Modal$propTypes, "closeButtonLabel", PropTypes.string), _defineProperty(_Modal$propTypes, "danger", PropTypes.bool), _defineProperty(_Modal$propTypes, "hasScrollingContent", PropTypes.bool), _defineProperty(_Modal$propTypes, "id", PropTypes.string), _defineProperty(_Modal$propTypes, "isFullWidth", PropTypes.bool), _defineProperty(_Modal$propTypes, "modalAriaLabel", PropTypes.string), _defineProperty(_Modal$propTypes, "modalHeading", PropTypes.node), _defineProperty(_Modal$propTypes, "modalLabel", PropTypes.node), _defineProperty(_Modal$propTypes, "onKeyDown", PropTypes.func), _defineProperty(_Modal$propTypes, "onRequestClose", PropTypes.func), _defineProperty(_Modal$propTypes, "onRequestSubmit", PropTypes.func), _defineProperty(_Modal$propTypes, "onSecondarySubmit", PropTypes.func), _defineProperty(_Modal$propTypes, "open", PropTypes.bool), _defineProperty(_Modal$propTypes, "passiveModal", PropTypes.bool), _defineProperty(_Modal$propTypes, "preventCloseOnClickOutside", PropTypes.bool), _defineProperty(_Modal$propTypes, "primaryButtonDisabled", PropTypes.bool), _defineProperty(_Modal$propTypes, "primaryButtonText", PropTypes.node), _defineProperty(_Modal$propTypes, "secondaryButtonText", PropTypes.node), _defineProperty(_Modal$propTypes, "secondaryButtons", function secondaryButtons(props, propName, componentName) {
|
|
244
245
|
if (props.secondaryButtons) {
|
|
245
246
|
if (!Array.isArray(props.secondaryButtons) || props.secondaryButtons.length !== 2) {
|
|
246
247
|
return new Error("".concat(propName, " needs to be an array of two button config objects"));
|
|
@@ -53,13 +53,19 @@ var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function RadioButt
|
|
|
53
53
|
function getRadioButtons() {
|
|
54
54
|
var mappedChildren = React__default.Children.map(children, function (radioButton) {
|
|
55
55
|
var value = radioButton.props.value;
|
|
56
|
-
|
|
56
|
+
var newProps = {
|
|
57
57
|
name: name,
|
|
58
58
|
key: value,
|
|
59
59
|
value: value,
|
|
60
60
|
onChange: handleOnChange,
|
|
61
61
|
checked: value === selected
|
|
62
|
-
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if (!selected && radioButton.props.checked) {
|
|
65
|
+
newProps.checked = true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/React__default.cloneElement(radioButton, newProps);
|
|
63
69
|
});
|
|
64
70
|
return mappedChildren;
|
|
65
71
|
}
|