@carbon/react 1.25.0 → 1.26.0-rc.0
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/Button/Button.js +2 -2
- package/es/components/DataTable/Table.d.ts +74 -0
- package/es/components/DataTable/Table.js +4 -2
- package/es/components/DataTable/TableCell.d.ts +10 -0
- package/es/components/DataTable/TableContext.d.ts +13 -0
- package/es/components/DataTable/TableContext.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +67 -0
- package/es/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/es/components/DataTable/TableHead.d.ts +10 -0
- package/es/components/DataTable/TableHeader.d.ts +64 -0
- package/es/components/DataTable/TableHeader.js +23 -28
- package/es/components/DataTable/TableRow.d.ts +32 -0
- package/es/components/DataTable/TableSelectAll.js +1 -1
- package/es/components/DataTable/TableSelectRow.js +1 -3
- package/es/components/DataTable/TableToolbarContent.d.ts +4 -6
- package/es/components/DataTable/TableToolbarSearch.js +1 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/es/components/FileUploader/FileUploaderButton.js +2 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/es/components/MultiSelect/FilterableMultiSelect.js +15 -7
- package/es/components/MultiSelect/MultiSelect.js +0 -2
- package/es/components/NumberInput/NumberInput.js +9 -1
- package/es/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/es/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/es/components/RadioButton/RadioButton.d.ts +64 -0
- package/es/components/RadioButton/RadioButton.js +19 -17
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +84 -25
- package/es/components/Search/Search.Skeleton.d.ts +36 -0
- package/es/components/Search/Search.js +3 -2
- package/es/components/Search/index.js +1 -0
- package/es/components/StructuredList/StructuredList.js +1 -1
- package/es/components/Tabs/Tabs.js +26 -5
- package/es/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/es/components/TextInput/index.js +1 -0
- package/es/components/Tile/Tile.js +15 -8
- package/es/components/UIShell/HeaderMenu.js +13 -4
- package/es/components/UIShell/HeaderMenuItem.js +17 -4
- package/es/tools/wrapComponent.js +9 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/DataTable/Table.d.ts +74 -0
- package/lib/components/DataTable/Table.js +4 -2
- package/lib/components/DataTable/TableCell.d.ts +10 -0
- package/lib/components/DataTable/TableContext.d.ts +13 -0
- package/lib/components/DataTable/TableContext.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +67 -0
- package/lib/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/lib/components/DataTable/TableHead.d.ts +10 -0
- package/lib/components/DataTable/TableHeader.d.ts +64 -0
- package/lib/components/DataTable/TableHeader.js +23 -28
- package/lib/components/DataTable/TableRow.d.ts +32 -0
- package/lib/components/DataTable/TableSelectAll.js +1 -1
- package/lib/components/DataTable/TableSelectRow.js +1 -3
- package/lib/components/DataTable/TableToolbarContent.d.ts +4 -6
- package/lib/components/DataTable/TableToolbarSearch.js +1 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/lib/components/FileUploader/FileUploaderButton.js +2 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/lib/components/MultiSelect/FilterableMultiSelect.js +14 -6
- package/lib/components/MultiSelect/MultiSelect.js +0 -2
- package/lib/components/NumberInput/NumberInput.js +9 -1
- package/lib/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/lib/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/lib/components/RadioButton/RadioButton.d.ts +64 -0
- package/lib/components/RadioButton/RadioButton.js +18 -16
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +83 -24
- package/lib/components/Search/Search.Skeleton.d.ts +36 -0
- package/lib/components/Search/Search.js +3 -2
- package/lib/components/Search/index.js +2 -0
- package/lib/components/StructuredList/StructuredList.js +1 -1
- package/lib/components/Tabs/Tabs.js +26 -5
- package/lib/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/lib/components/TextInput/index.js +2 -0
- package/lib/components/Tile/Tile.js +15 -8
- package/lib/components/UIShell/HeaderMenu.js +13 -4
- package/lib/components/UIShell/HeaderMenuItem.js +17 -4
- package/lib/tools/wrapComponent.js +9 -0
- package/package.json +3 -3
|
@@ -35,7 +35,6 @@ var _ref = useSelect.stateChangeTypes,
|
|
|
35
35
|
MenuBlur = _ref.MenuBlur,
|
|
36
36
|
MenuKeyDownArrowDown = _ref.MenuKeyDownArrowDown,
|
|
37
37
|
MenuKeyDownArrowUp = _ref.MenuKeyDownArrowUp,
|
|
38
|
-
MenuKeyDownEnter = _ref.MenuKeyDownEnter,
|
|
39
38
|
MenuKeyDownEscape = _ref.MenuKeyDownEscape,
|
|
40
39
|
MenuKeyDownSpaceButton = _ref.MenuKeyDownSpaceButton,
|
|
41
40
|
ToggleButtonClick = _ref.ToggleButtonClick;
|
|
@@ -235,7 +234,6 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
235
234
|
switch (type) {
|
|
236
235
|
case ItemClick:
|
|
237
236
|
case MenuKeyDownSpaceButton:
|
|
238
|
-
case MenuKeyDownEnter:
|
|
239
237
|
if (changes.selectedItem === undefined) {
|
|
240
238
|
break;
|
|
241
239
|
}
|
|
@@ -515,13 +515,21 @@ function disableWheel(e) {
|
|
|
515
515
|
}
|
|
516
516
|
/**
|
|
517
517
|
* Clamp the given value between the upper bound `max` and the lower bound `min`
|
|
518
|
+
*
|
|
519
|
+
* 16 digit min/max more precise than Infinity. Somewhere in 9 quadrillion,
|
|
520
|
+
* there will be integer display issues at runtime. 9quad is a safe cutoff.
|
|
518
521
|
* @param {number} max
|
|
519
522
|
* @param {number} min
|
|
520
523
|
* @param {number} value
|
|
521
524
|
*/
|
|
522
525
|
|
|
523
526
|
|
|
524
|
-
|
|
527
|
+
var boundLimit = 9000000000000000; // 16 digit, 9 quadrillion
|
|
528
|
+
|
|
529
|
+
function clamp() {
|
|
530
|
+
var max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : boundLimit;
|
|
531
|
+
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -boundLimit;
|
|
532
|
+
var value = arguments.length > 2 ? arguments[2] : undefined;
|
|
525
533
|
return Math.min(max, Math.max(min, value));
|
|
526
534
|
}
|
|
527
535
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 React from 'react';
|
|
9
|
+
export interface RadioButtonSkeletonProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to add.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
declare function RadioButtonSkeleton(props: RadioButtonSkeletonProps): JSX.Element;
|
|
16
|
+
declare namespace RadioButtonSkeleton {
|
|
17
|
+
var propTypes: {
|
|
18
|
+
/**
|
|
19
|
+
* Specify an optional className to add.
|
|
20
|
+
*/
|
|
21
|
+
className: PropTypes.Requireable<string>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default RadioButtonSkeleton;
|
|
25
|
+
export { RadioButtonSkeleton };
|
|
@@ -13,9 +13,9 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
13
13
|
|
|
14
14
|
var _excluded = ["className"];
|
|
15
15
|
|
|
16
|
-
function RadioButtonSkeleton(
|
|
17
|
-
var className =
|
|
18
|
-
rest = _objectWithoutProperties(
|
|
16
|
+
function RadioButtonSkeleton(props) {
|
|
17
|
+
var className = props.className,
|
|
18
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
19
19
|
|
|
20
20
|
var prefix = usePrefix();
|
|
21
21
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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
|
+
type ExcludedAttributes = 'onChange';
|
|
10
|
+
export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
11
|
+
/**
|
|
12
|
+
* Specify whether the `<RadioButton>` is currently checked
|
|
13
|
+
*/
|
|
14
|
+
checked?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Provide an optional className to be applied to the containing node
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specify whether the `<RadioButton>` should be checked by default
|
|
21
|
+
*/
|
|
22
|
+
defaultChecked?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Specify whether the control is disabled
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Specify whether the label should be hidden, or not
|
|
29
|
+
*/
|
|
30
|
+
hideLabel?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Provide a unique id for the underlying `<input>` node
|
|
33
|
+
*/
|
|
34
|
+
id?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Provide where label text should be placed
|
|
37
|
+
* NOTE: `top`/`bottom` are deprecated
|
|
38
|
+
*/
|
|
39
|
+
labelPosition?: 'left' | 'right';
|
|
40
|
+
/**
|
|
41
|
+
* Provide label text to be read by screen readers when interacting with the
|
|
42
|
+
* control
|
|
43
|
+
*/
|
|
44
|
+
labelText: ReactNodeLike;
|
|
45
|
+
/**
|
|
46
|
+
* Provide a name for the underlying `<input>` node
|
|
47
|
+
*/
|
|
48
|
+
name?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Provide an optional `onChange` hook that is called each time the value of
|
|
51
|
+
* the underlying `<input>` changes
|
|
52
|
+
*/
|
|
53
|
+
onChange?: (value: string | number, name: string | undefined, event: any) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Provide a handler that is invoked when a user clicks on the control
|
|
56
|
+
*/
|
|
57
|
+
onClick?: (evt: React.MouseEvent<HTMLInputElement>) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Specify the value of the `<RadioButton>`
|
|
60
|
+
*/
|
|
61
|
+
value?: string | number;
|
|
62
|
+
}
|
|
63
|
+
declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<unknown>>;
|
|
64
|
+
export default RadioButton;
|
|
@@ -7,29 +7,30 @@
|
|
|
7
7
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default from 'react';
|
|
10
|
+
import React__default, { useRef } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import '../Text/index.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import { useId } from '../../internal/useId.js';
|
|
15
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
15
16
|
import { Text } from '../Text/Text.js';
|
|
16
17
|
|
|
17
18
|
var _excluded = ["className", "disabled", "hideLabel", "id", "labelPosition", "labelText", "name", "onChange", "value"];
|
|
18
|
-
var RadioButton = /*#__PURE__*/React__default.forwardRef(function
|
|
19
|
-
var className =
|
|
20
|
-
disabled =
|
|
21
|
-
hideLabel =
|
|
22
|
-
id =
|
|
23
|
-
|
|
24
|
-
labelPosition =
|
|
25
|
-
|
|
26
|
-
labelText =
|
|
27
|
-
name =
|
|
28
|
-
|
|
29
|
-
onChange =
|
|
30
|
-
|
|
31
|
-
value =
|
|
32
|
-
rest = _objectWithoutProperties(
|
|
19
|
+
var RadioButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
20
|
+
var className = props.className,
|
|
21
|
+
disabled = props.disabled,
|
|
22
|
+
hideLabel = props.hideLabel,
|
|
23
|
+
id = props.id,
|
|
24
|
+
_props$labelPosition = props.labelPosition,
|
|
25
|
+
labelPosition = _props$labelPosition === void 0 ? 'right' : _props$labelPosition,
|
|
26
|
+
_props$labelText = props.labelText,
|
|
27
|
+
labelText = _props$labelText === void 0 ? '' : _props$labelText,
|
|
28
|
+
name = props.name,
|
|
29
|
+
_props$onChange = props.onChange,
|
|
30
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
31
|
+
_props$value = props.value,
|
|
32
|
+
value = _props$value === void 0 ? '' : _props$value,
|
|
33
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
33
34
|
|
|
34
35
|
var prefix = usePrefix();
|
|
35
36
|
var uid = useId('radio-button');
|
|
@@ -41,6 +42,7 @@ var RadioButton = /*#__PURE__*/React__default.forwardRef(function RadioButton(_r
|
|
|
41
42
|
|
|
42
43
|
var innerLabelClasses = cx("".concat(prefix, "--radio-button__label-text"), _defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLabel));
|
|
43
44
|
var wrapperClasses = cx(className, "".concat(prefix, "--radio-button-wrapper"), _defineProperty({}, "".concat(prefix, "--radio-button-wrapper--label-").concat(labelPosition), labelPosition !== 'right'));
|
|
45
|
+
var inputRef = useRef(null);
|
|
44
46
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
45
47
|
className: wrapperClasses
|
|
46
48
|
}, /*#__PURE__*/React__default.createElement("input", _extends({}, rest, {
|
|
@@ -48,7 +50,7 @@ var RadioButton = /*#__PURE__*/React__default.forwardRef(function RadioButton(_r
|
|
|
48
50
|
className: "".concat(prefix, "--radio-button"),
|
|
49
51
|
onChange: handleOnChange,
|
|
50
52
|
id: uniqueId,
|
|
51
|
-
ref: ref,
|
|
53
|
+
ref: mergeRefs(inputRef, ref),
|
|
52
54
|
disabled: disabled,
|
|
53
55
|
value: value,
|
|
54
56
|
name: name
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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
|
+
export declare const RadioButtonGroupContext: React.Context<null>;
|
|
10
|
+
type ExcludedAttributes = 'onChange';
|
|
11
|
+
export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HTMLFieldSetElement>, ExcludedAttributes> {
|
|
12
|
+
/**
|
|
13
|
+
* Provide a collection of `<RadioButton>` components to render in the group
|
|
14
|
+
*/
|
|
15
|
+
children?: ReactNodeLike;
|
|
16
|
+
/**
|
|
17
|
+
* Provide an optional className to be applied to the container node
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Specify the `<RadioButton>` to be selected by default
|
|
22
|
+
*/
|
|
23
|
+
defaultSelected?: string | number;
|
|
24
|
+
/**
|
|
25
|
+
* Specify whether the group is disabled
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Provide text that is used alongside the control label for additional help
|
|
30
|
+
*/
|
|
31
|
+
helperText?: ReactNodeLike;
|
|
32
|
+
/**
|
|
33
|
+
* Specify whether the control is currently invalid
|
|
34
|
+
*/
|
|
35
|
+
invalid?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
38
|
+
*/
|
|
39
|
+
invalidText?: ReactNodeLike;
|
|
40
|
+
/**
|
|
41
|
+
* Provide where label text should be placed
|
|
42
|
+
*/
|
|
43
|
+
labelPosition?: 'left' | 'right';
|
|
44
|
+
/**
|
|
45
|
+
* Provide a legend to the RadioButtonGroup input that you are
|
|
46
|
+
* exposing to the user
|
|
47
|
+
*/
|
|
48
|
+
legendText?: ReactNodeLike;
|
|
49
|
+
/**
|
|
50
|
+
* Specify the name of the underlying `<input>` nodes
|
|
51
|
+
*/
|
|
52
|
+
name: string;
|
|
53
|
+
/**
|
|
54
|
+
* Provide an optional `onChange` hook that is called whenever the value of
|
|
55
|
+
* the group changes
|
|
56
|
+
*/
|
|
57
|
+
onChange?: (selection: unknown, name: string, evt: unknown) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Provide where radio buttons should be placed
|
|
60
|
+
*/
|
|
61
|
+
orientation?: 'horizontal' | 'vertical';
|
|
62
|
+
/**
|
|
63
|
+
* Whether the RadioButtonGroup should be read-only
|
|
64
|
+
*/
|
|
65
|
+
readOnly?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Specify whether the control is currently in warning state
|
|
68
|
+
*/
|
|
69
|
+
warn?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Provide the text that is displayed when the control is in warning state
|
|
72
|
+
*/
|
|
73
|
+
warnText?: ReactNodeLike;
|
|
74
|
+
/**
|
|
75
|
+
* Specify the value that is currently selected in the group
|
|
76
|
+
*/
|
|
77
|
+
valueSelected?: string | number;
|
|
78
|
+
}
|
|
79
|
+
declare const RadioButtonGroup: React.ForwardRefExoticComponent<RadioButtonGroupProps & React.RefAttributes<unknown>>;
|
|
80
|
+
export default RadioButtonGroup;
|
|
@@ -7,30 +7,39 @@
|
|
|
7
7
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default, { useState } from 'react';
|
|
10
|
+
import React__default, { useState, useRef } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { Legend } from '../Text/index.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
15
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
14
16
|
|
|
15
|
-
var _excluded = ["children", "className", "defaultSelected", "disabled", "labelPosition", "legendText", "name", "onChange", "orientation", "readOnly", "valueSelected"];
|
|
16
|
-
var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function
|
|
17
|
+
var _excluded = ["children", "className", "defaultSelected", "disabled", "helperText", "invalid", "invalidText", "labelPosition", "legendText", "name", "onChange", "orientation", "readOnly", "valueSelected", "warn", "warnText"];
|
|
18
|
+
var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
17
19
|
var _classNames;
|
|
18
20
|
|
|
19
|
-
var children =
|
|
20
|
-
className =
|
|
21
|
-
defaultSelected =
|
|
22
|
-
disabled =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
var children = props.children,
|
|
22
|
+
className = props.className,
|
|
23
|
+
defaultSelected = props.defaultSelected,
|
|
24
|
+
disabled = props.disabled,
|
|
25
|
+
helperText = props.helperText,
|
|
26
|
+
_props$invalid = props.invalid,
|
|
27
|
+
invalid = _props$invalid === void 0 ? false : _props$invalid,
|
|
28
|
+
invalidText = props.invalidText,
|
|
29
|
+
_props$labelPosition = props.labelPosition,
|
|
30
|
+
labelPosition = _props$labelPosition === void 0 ? 'right' : _props$labelPosition,
|
|
31
|
+
legendText = props.legendText,
|
|
32
|
+
name = props.name,
|
|
33
|
+
_props$onChange = props.onChange,
|
|
34
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
35
|
+
_props$orientation = props.orientation,
|
|
36
|
+
orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
|
|
37
|
+
readOnly = props.readOnly,
|
|
38
|
+
valueSelected = props.valueSelected,
|
|
39
|
+
_props$warn = props.warn,
|
|
40
|
+
warn = _props$warn === void 0 ? false : _props$warn,
|
|
41
|
+
warnText = props.warnText,
|
|
42
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
34
43
|
|
|
35
44
|
var prefix = usePrefix();
|
|
36
45
|
|
|
@@ -56,7 +65,11 @@ var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function RadioButt
|
|
|
56
65
|
|
|
57
66
|
function getRadioButtons() {
|
|
58
67
|
var mappedChildren = React__default.Children.map(children, function (radioButton) {
|
|
59
|
-
var
|
|
68
|
+
var _props;
|
|
69
|
+
|
|
70
|
+
var _ref = (_props = radioButton === null || radioButton === void 0 ? void 0 : radioButton.props) !== null && _props !== void 0 ? _props : undefined,
|
|
71
|
+
value = _ref.value;
|
|
72
|
+
|
|
60
73
|
var newProps = {
|
|
61
74
|
name: name,
|
|
62
75
|
key: value,
|
|
@@ -65,11 +78,13 @@ var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function RadioButt
|
|
|
65
78
|
checked: value === selected
|
|
66
79
|
};
|
|
67
80
|
|
|
68
|
-
if (!selected && radioButton.props.checked) {
|
|
81
|
+
if (!selected && radioButton !== null && radioButton !== void 0 && radioButton.props.checked) {
|
|
69
82
|
newProps.checked = true;
|
|
70
83
|
}
|
|
71
84
|
|
|
72
|
-
|
|
85
|
+
if (radioButton) {
|
|
86
|
+
return /*#__PURE__*/React__default.cloneElement(radioButton, newProps);
|
|
87
|
+
}
|
|
73
88
|
});
|
|
74
89
|
return mappedChildren;
|
|
75
90
|
}
|
|
@@ -83,18 +98,36 @@ var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function RadioButt
|
|
|
83
98
|
}
|
|
84
99
|
}
|
|
85
100
|
|
|
86
|
-
var
|
|
101
|
+
var showWarning = !readOnly && !invalid && warn;
|
|
102
|
+
var showHelper = !invalid && !disabled && !warn;
|
|
87
103
|
var wrapperClasses = cx("".concat(prefix, "--form-item"), className);
|
|
104
|
+
var fieldsetClasses = cx("".concat(prefix, "--radio-button-group"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--").concat(orientation), orientation === 'vertical'), _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--label-").concat(labelPosition), labelPosition), _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--readonly"), readOnly), _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--invalid"), !readOnly && invalid), _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--warning"), showWarning), _classNames));
|
|
105
|
+
var helperClasses = cx("".concat(prefix, "--form__helper-text"), _defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), disabled));
|
|
106
|
+
var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
107
|
+
className: helperClasses
|
|
108
|
+
}, helperText) : null;
|
|
109
|
+
var divRef = useRef(null);
|
|
88
110
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
89
111
|
className: wrapperClasses,
|
|
90
|
-
ref: ref
|
|
112
|
+
ref: mergeRefs(divRef, ref)
|
|
91
113
|
}, /*#__PURE__*/React__default.createElement("fieldset", _extends({
|
|
92
114
|
className: fieldsetClasses,
|
|
93
115
|
disabled: disabled,
|
|
116
|
+
"data-invalid": invalid ? true : undefined,
|
|
94
117
|
"aria-readonly": readOnly
|
|
95
118
|
}, rest), legendText && /*#__PURE__*/React__default.createElement(Legend, {
|
|
96
119
|
className: "".concat(prefix, "--label")
|
|
97
|
-
}, legendText), getRadioButtons())
|
|
120
|
+
}, legendText), getRadioButtons()), /*#__PURE__*/React__default.createElement("div", {
|
|
121
|
+
className: "".concat(prefix, "--radio-button__validation-msg")
|
|
122
|
+
}, !readOnly && invalid && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
123
|
+
className: "".concat(prefix, "--radio-button__invalid-icon")
|
|
124
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
125
|
+
className: "".concat(prefix, "--form-requirement")
|
|
126
|
+
}, invalidText)), showWarning && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningAltFilled, {
|
|
127
|
+
className: "".concat(prefix, "--radio-button__invalid-icon ").concat(prefix, "--radio-button__invalid-icon--warning")
|
|
128
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
129
|
+
className: "".concat(prefix, "--form-requirement")
|
|
130
|
+
}, warnText)), showHelper && helper));
|
|
98
131
|
});
|
|
99
132
|
RadioButtonGroup.propTypes = {
|
|
100
133
|
/**
|
|
@@ -117,6 +150,21 @@ RadioButtonGroup.propTypes = {
|
|
|
117
150
|
*/
|
|
118
151
|
disabled: PropTypes.bool,
|
|
119
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Provide text that is used alongside the control label for additional help
|
|
155
|
+
*/
|
|
156
|
+
helperText: PropTypes.node,
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Specify whether the control is currently invalid
|
|
160
|
+
*/
|
|
161
|
+
invalid: PropTypes.bool,
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
165
|
+
*/
|
|
166
|
+
invalidText: PropTypes.node,
|
|
167
|
+
|
|
120
168
|
/**
|
|
121
169
|
* Provide where label text should be placed
|
|
122
170
|
*/
|
|
@@ -152,8 +200,19 @@ RadioButtonGroup.propTypes = {
|
|
|
152
200
|
/**
|
|
153
201
|
* Specify the value that is currently selected in the group
|
|
154
202
|
*/
|
|
155
|
-
valueSelected: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
203
|
+
valueSelected: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Specify whether the control is currently in warning state
|
|
207
|
+
*/
|
|
208
|
+
warn: PropTypes.bool,
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Provide the text that is displayed when the control is in warning state
|
|
212
|
+
*/
|
|
213
|
+
warnText: PropTypes.node
|
|
156
214
|
};
|
|
215
|
+
RadioButtonGroup.displayName = 'RadioButtonGroup';
|
|
157
216
|
var RadioButtonGroup$1 = RadioButtonGroup;
|
|
158
217
|
|
|
159
218
|
export { RadioButtonGroup$1 as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 React from 'react';
|
|
9
|
+
export interface SearchSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to add.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify whether the Search should be a small variant.
|
|
16
|
+
*/
|
|
17
|
+
small?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const SearchSkeleton: {
|
|
20
|
+
({ small, className, ...rest }: SearchSkeletonProps): JSX.Element;
|
|
21
|
+
propTypes: {
|
|
22
|
+
/**
|
|
23
|
+
* Specify an optional className to add.
|
|
24
|
+
*/
|
|
25
|
+
className: PropTypes.Requireable<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Specify whether the Search should be a small variant
|
|
28
|
+
*/
|
|
29
|
+
small: PropTypes.Requireable<boolean>;
|
|
30
|
+
};
|
|
31
|
+
defaultProps: {
|
|
32
|
+
small: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export default SearchSkeleton;
|
|
36
|
+
export { SearchSkeleton };
|
|
@@ -44,7 +44,7 @@ var Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwar
|
|
|
44
44
|
onKeyDown = _ref.onKeyDown,
|
|
45
45
|
onExpand = _ref.onExpand,
|
|
46
46
|
_ref$placeholder = _ref.placeholder,
|
|
47
|
-
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
47
|
+
placeholder = _ref$placeholder === void 0 ? 'Search' : _ref$placeholder,
|
|
48
48
|
renderIcon = _ref.renderIcon,
|
|
49
49
|
_ref$role = _ref.role,
|
|
50
50
|
role = _ref$role === void 0 ? 'searchbox' : _ref$role,
|
|
@@ -115,9 +115,10 @@ var Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwar
|
|
|
115
115
|
|
|
116
116
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
117
117
|
role: "search",
|
|
118
|
-
"aria-
|
|
118
|
+
"aria-label": placeholder,
|
|
119
119
|
className: searchClasses
|
|
120
120
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
121
|
+
"aria-labelledby": uniqueId,
|
|
121
122
|
role: onExpand ? 'button' : null,
|
|
122
123
|
className: "".concat(prefix, "--search-magnifier"),
|
|
123
124
|
onClick: onExpand
|
|
@@ -246,7 +246,7 @@ StructuredListInput.propTypes = {
|
|
|
246
246
|
/**
|
|
247
247
|
* Provide an optional hook that is called each time the input is updated
|
|
248
248
|
*/
|
|
249
|
-
onChange:
|
|
249
|
+
onChange: PropTypes.func,
|
|
250
250
|
|
|
251
251
|
/**
|
|
252
252
|
* Provide a `title` for the input
|
|
@@ -28,7 +28,7 @@ import { ArrowRight, ArrowLeft, Home, End } from '../../internal/keyboard/keys.j
|
|
|
28
28
|
var _ChevronLeft, _ChevronRight;
|
|
29
29
|
|
|
30
30
|
var _excluded = ["activation", "aria-label", "children", "className", "contained", "iconSize", "leftOverflowButtonProps", "light", "rightOverflowButtonProps", "scrollDebounceWait", "scrollIntoView"],
|
|
31
|
-
_excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown"],
|
|
31
|
+
_excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown", "secondaryLabel", "hasSecondaryLabel"],
|
|
32
32
|
_excluded3 = ["children", "className", "defaultOpen", "enterDelayMs", "leaveDelayMs", "label"],
|
|
33
33
|
_excluded4 = ["children", "className"];
|
|
34
34
|
|
|
@@ -166,7 +166,10 @@ function TabList(_ref2) {
|
|
|
166
166
|
scrollLeft = _useState6[0],
|
|
167
167
|
setScrollLeft = _useState6[1];
|
|
168
168
|
|
|
169
|
-
var
|
|
169
|
+
var hasSecondaryLabelTabs = contained && !!React__default.Children.toArray(children).filter(function (child) {
|
|
170
|
+
return child.props.secondaryLabel;
|
|
171
|
+
}).length;
|
|
172
|
+
var className = cx("".concat(prefix, "--tabs"), customClassName, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--tabs--contained"), contained), _defineProperty(_cx, "".concat(prefix, "--tabs--light"), light), _defineProperty(_cx, "".concat(prefix, "--tabs__icon--default"), iconSize === 'default'), _defineProperty(_cx, "".concat(prefix, "--tabs__icon--lg"), iconSize === 'lg'), _defineProperty(_cx, "".concat(prefix, "--tabs--tall"), hasSecondaryLabelTabs), _cx)); // Previous Button
|
|
170
173
|
// VISIBLE IF:
|
|
171
174
|
// SCROLLABLE
|
|
172
175
|
// AND SCROLL_LEFT > 0
|
|
@@ -326,7 +329,8 @@ function TabList(_ref2) {
|
|
|
326
329
|
}, /*#__PURE__*/React__default.cloneElement(child, {
|
|
327
330
|
ref: function ref(node) {
|
|
328
331
|
tabs.current[index] = node;
|
|
329
|
-
}
|
|
332
|
+
},
|
|
333
|
+
hasSecondaryLabel: hasSecondaryLabelTabs
|
|
330
334
|
}));
|
|
331
335
|
})), /*#__PURE__*/React__default.createElement("button", _extends({
|
|
332
336
|
"aria-hidden": "true",
|
|
@@ -451,6 +455,8 @@ var Tab = /*#__PURE__*/React__default.forwardRef(function Tab(_ref5, ref) {
|
|
|
451
455
|
disabled = _ref5.disabled,
|
|
452
456
|
_onClick = _ref5.onClick,
|
|
453
457
|
onKeyDown = _ref5.onKeyDown,
|
|
458
|
+
secondaryLabel = _ref5.secondaryLabel,
|
|
459
|
+
hasSecondaryLabel = _ref5.hasSecondaryLabel,
|
|
454
460
|
rest = _objectWithoutProperties(_ref5, _excluded2);
|
|
455
461
|
|
|
456
462
|
var prefix = usePrefix();
|
|
@@ -487,7 +493,11 @@ var Tab = /*#__PURE__*/React__default.forwardRef(function Tab(_ref5, ref) {
|
|
|
487
493
|
onKeyDown: onKeyDown,
|
|
488
494
|
tabIndex: selectedIndex === index ? '0' : '-1',
|
|
489
495
|
type: "button"
|
|
490
|
-
}),
|
|
496
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
|
497
|
+
className: "".concat(prefix, "--tabs__nav-item-label")
|
|
498
|
+
}, children), hasSecondaryLabel && /*#__PURE__*/React__default.createElement("div", {
|
|
499
|
+
className: "".concat(prefix, "--tabs__nav-item-secondary-label")
|
|
500
|
+
}, secondaryLabel));
|
|
491
501
|
});
|
|
492
502
|
Tab.propTypes = {
|
|
493
503
|
/**
|
|
@@ -510,6 +520,11 @@ Tab.propTypes = {
|
|
|
510
520
|
*/
|
|
511
521
|
disabled: PropTypes.bool,
|
|
512
522
|
|
|
523
|
+
/*
|
|
524
|
+
* Internal use only, determines wether a tab should render as a secondary label tab
|
|
525
|
+
**/
|
|
526
|
+
hasSecondaryLabel: PropTypes.bool,
|
|
527
|
+
|
|
513
528
|
/**
|
|
514
529
|
* Provide a handler that is invoked when a user clicks on the control
|
|
515
530
|
*/
|
|
@@ -525,7 +540,13 @@ Tab.propTypes = {
|
|
|
525
540
|
* Useful for using Tab along with react-router or other client
|
|
526
541
|
* side router libraries.
|
|
527
542
|
**/
|
|
528
|
-
renderButton: PropTypes.func
|
|
543
|
+
renderButton: PropTypes.func,
|
|
544
|
+
|
|
545
|
+
/*
|
|
546
|
+
* An optional label to render under the primary tab label.
|
|
547
|
+
/* This prop is only useful for conained tabs
|
|
548
|
+
**/
|
|
549
|
+
secondaryLabel: PropTypes.string
|
|
529
550
|
};
|
|
530
551
|
var IconTab = /*#__PURE__*/React__default.forwardRef(function IconTab(_ref6, ref) {
|
|
531
552
|
var children = _ref6.children,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 React from 'react';
|
|
9
|
+
export interface TextInputSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to add to the form item wrapper.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify whether the label should be hidden or not.
|
|
16
|
+
*/
|
|
17
|
+
hideLabel?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const TextInputSkeleton: {
|
|
20
|
+
({ hideLabel, className, ...rest }: TextInputSkeletonProps): JSX.Element;
|
|
21
|
+
propTypes: {
|
|
22
|
+
/**
|
|
23
|
+
* Specify an optional className to add to the form item wrapper.
|
|
24
|
+
*/
|
|
25
|
+
className: PropTypes.Requireable<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Specify whether the label should be hidden, or not
|
|
28
|
+
*/
|
|
29
|
+
hideLabel: PropTypes.Requireable<boolean>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export default TextInputSkeleton;
|
|
33
|
+
export { TextInputSkeleton };
|
|
@@ -10,6 +10,7 @@ import ControlledPasswordInput from './ControlledPasswordInput.js';
|
|
|
10
10
|
import PasswordInput from './PasswordInput.js';
|
|
11
11
|
import TextInput from './TextInput.js';
|
|
12
12
|
export { default as TextInput, default } from './TextInput.js';
|
|
13
|
+
export { default as TextInputSkeleton } from './TextInput.Skeleton.js';
|
|
13
14
|
|
|
14
15
|
TextInput.ControlledPasswordInput = ControlledPasswordInput;
|
|
15
16
|
TextInput.PasswordInput = PasswordInput;
|