@carbon/react 1.25.0 → 1.26.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 +91 -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/PasswordInput.d.ts +125 -0
- package/es/components/TextInput/PasswordInput.js +10 -6
- 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 +90 -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/PasswordInput.d.ts +125 -0
- package/lib/components/TextInput/PasswordInput.js +10 -25
- 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
|
@@ -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;
|
|
@@ -15,6 +15,9 @@ var React = require('react');
|
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var index = require('../Text/index.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
+
var iconsReact = require('@carbon/icons-react');
|
|
19
|
+
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
20
|
+
var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
|
|
18
21
|
|
|
19
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
23
|
|
|
@@ -22,25 +25,33 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
22
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
26
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
27
|
|
|
25
|
-
var _excluded = ["children", "className", "defaultSelected", "disabled", "labelPosition", "legendText", "name", "onChange", "orientation", "readOnly", "valueSelected"];
|
|
26
|
-
var
|
|
28
|
+
var _excluded = ["children", "className", "defaultSelected", "disabled", "helperText", "invalid", "invalidText", "labelPosition", "legendText", "name", "onChange", "orientation", "readOnly", "valueSelected", "warn", "warnText"];
|
|
29
|
+
var getInstanceId = setupGetInstanceId["default"]();
|
|
30
|
+
var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
27
31
|
var _classNames;
|
|
28
32
|
|
|
29
|
-
var children =
|
|
30
|
-
className =
|
|
31
|
-
defaultSelected =
|
|
32
|
-
disabled =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
var children = props.children,
|
|
34
|
+
className = props.className,
|
|
35
|
+
defaultSelected = props.defaultSelected,
|
|
36
|
+
disabled = props.disabled,
|
|
37
|
+
helperText = props.helperText,
|
|
38
|
+
_props$invalid = props.invalid,
|
|
39
|
+
invalid = _props$invalid === void 0 ? false : _props$invalid,
|
|
40
|
+
invalidText = props.invalidText,
|
|
41
|
+
_props$labelPosition = props.labelPosition,
|
|
42
|
+
labelPosition = _props$labelPosition === void 0 ? 'right' : _props$labelPosition,
|
|
43
|
+
legendText = props.legendText,
|
|
44
|
+
name = props.name,
|
|
45
|
+
_props$onChange = props.onChange,
|
|
46
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
47
|
+
_props$orientation = props.orientation,
|
|
48
|
+
orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
|
|
49
|
+
readOnly = props.readOnly,
|
|
50
|
+
valueSelected = props.valueSelected,
|
|
51
|
+
_props$warn = props.warn,
|
|
52
|
+
warn = _props$warn === void 0 ? false : _props$warn,
|
|
53
|
+
warnText = props.warnText,
|
|
54
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
|
44
55
|
|
|
45
56
|
var prefix = usePrefix.usePrefix();
|
|
46
57
|
|
|
@@ -53,6 +64,9 @@ var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
53
64
|
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
|
54
65
|
prevValueSelected = _useState4[0],
|
|
55
66
|
setPrevValueSelected = _useState4[1];
|
|
67
|
+
|
|
68
|
+
var _useRef = React.useRef(getInstanceId()),
|
|
69
|
+
radioButtonGroupInstanceId = _useRef.current;
|
|
56
70
|
/**
|
|
57
71
|
* prop + state alignment - getDerivedStateFromProps
|
|
58
72
|
* only update if selected prop changes
|
|
@@ -66,7 +80,11 @@ var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
66
80
|
|
|
67
81
|
function getRadioButtons() {
|
|
68
82
|
var mappedChildren = React__default["default"].Children.map(children, function (radioButton) {
|
|
69
|
-
var
|
|
83
|
+
var _props;
|
|
84
|
+
|
|
85
|
+
var _ref = (_props = radioButton === null || radioButton === void 0 ? void 0 : radioButton.props) !== null && _props !== void 0 ? _props : undefined,
|
|
86
|
+
value = _ref.value;
|
|
87
|
+
|
|
70
88
|
var newProps = {
|
|
71
89
|
name: name,
|
|
72
90
|
key: value,
|
|
@@ -75,11 +93,13 @@ var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
75
93
|
checked: value === selected
|
|
76
94
|
};
|
|
77
95
|
|
|
78
|
-
if (!selected && radioButton.props.checked) {
|
|
96
|
+
if (!selected && radioButton !== null && radioButton !== void 0 && radioButton.props.checked) {
|
|
79
97
|
newProps.checked = true;
|
|
80
98
|
}
|
|
81
99
|
|
|
82
|
-
|
|
100
|
+
if (radioButton) {
|
|
101
|
+
return /*#__PURE__*/React__default["default"].cloneElement(radioButton, newProps);
|
|
102
|
+
}
|
|
83
103
|
});
|
|
84
104
|
return mappedChildren;
|
|
85
105
|
}
|
|
@@ -93,18 +113,38 @@ var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
93
113
|
}
|
|
94
114
|
}
|
|
95
115
|
|
|
96
|
-
var
|
|
116
|
+
var showWarning = !readOnly && !invalid && warn;
|
|
117
|
+
var showHelper = !invalid && !disabled && !warn;
|
|
97
118
|
var wrapperClasses = cx__default["default"]("".concat(prefix, "--form-item"), className);
|
|
119
|
+
var fieldsetClasses = cx__default["default"]("".concat(prefix, "--radio-button-group"), (_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--").concat(orientation), orientation === 'vertical'), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--label-").concat(labelPosition), labelPosition), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--readonly"), readOnly), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--invalid"), !readOnly && invalid), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--warning"), showWarning), _classNames));
|
|
120
|
+
var helperClasses = cx__default["default"]("".concat(prefix, "--form__helper-text"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), disabled));
|
|
121
|
+
var helperId = !helperText ? undefined : "radio-button-group-helper-text-".concat(radioButtonGroupInstanceId);
|
|
122
|
+
var helper = helperText ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
123
|
+
id: helperId,
|
|
124
|
+
className: helperClasses
|
|
125
|
+
}, helperText) : null;
|
|
126
|
+
var divRef = React.useRef(null);
|
|
98
127
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
99
128
|
className: wrapperClasses,
|
|
100
|
-
ref: ref
|
|
129
|
+
ref: mergeRefs["default"](divRef, ref)
|
|
101
130
|
}, /*#__PURE__*/React__default["default"].createElement("fieldset", _rollupPluginBabelHelpers["extends"]({
|
|
102
131
|
className: fieldsetClasses,
|
|
103
132
|
disabled: disabled,
|
|
133
|
+
"data-invalid": invalid ? true : undefined,
|
|
104
134
|
"aria-readonly": readOnly
|
|
105
135
|
}, rest), legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
|
|
106
136
|
className: "".concat(prefix, "--label")
|
|
107
|
-
}, legendText), getRadioButtons())
|
|
137
|
+
}, legendText), getRadioButtons()), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
138
|
+
className: "".concat(prefix, "--radio-button__validation-msg")
|
|
139
|
+
}, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
140
|
+
className: "".concat(prefix, "--radio-button__invalid-icon")
|
|
141
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
142
|
+
className: "".concat(prefix, "--form-requirement")
|
|
143
|
+
}, invalidText)), showWarning && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningAltFilled, {
|
|
144
|
+
className: "".concat(prefix, "--radio-button__invalid-icon ").concat(prefix, "--radio-button__invalid-icon--warning")
|
|
145
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
146
|
+
className: "".concat(prefix, "--form-requirement")
|
|
147
|
+
}, warnText))), showHelper && helper);
|
|
108
148
|
});
|
|
109
149
|
RadioButtonGroup.propTypes = {
|
|
110
150
|
/**
|
|
@@ -127,6 +167,21 @@ RadioButtonGroup.propTypes = {
|
|
|
127
167
|
*/
|
|
128
168
|
disabled: PropTypes__default["default"].bool,
|
|
129
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Provide text that is used alongside the control label for additional help
|
|
172
|
+
*/
|
|
173
|
+
helperText: PropTypes__default["default"].node,
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Specify whether the control is currently invalid
|
|
177
|
+
*/
|
|
178
|
+
invalid: PropTypes__default["default"].bool,
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
182
|
+
*/
|
|
183
|
+
invalidText: PropTypes__default["default"].node,
|
|
184
|
+
|
|
130
185
|
/**
|
|
131
186
|
* Provide where label text should be placed
|
|
132
187
|
*/
|
|
@@ -162,8 +217,19 @@ RadioButtonGroup.propTypes = {
|
|
|
162
217
|
/**
|
|
163
218
|
* Specify the value that is currently selected in the group
|
|
164
219
|
*/
|
|
165
|
-
valueSelected: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])
|
|
220
|
+
valueSelected: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]),
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Specify whether the control is currently in warning state
|
|
224
|
+
*/
|
|
225
|
+
warn: PropTypes__default["default"].bool,
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Provide the text that is displayed when the control is in warning state
|
|
229
|
+
*/
|
|
230
|
+
warnText: PropTypes__default["default"].node
|
|
166
231
|
};
|
|
232
|
+
RadioButtonGroup.displayName = 'RadioButtonGroup';
|
|
167
233
|
var RadioButtonGroup$1 = RadioButtonGroup;
|
|
168
234
|
|
|
169
235
|
exports["default"] = RadioButtonGroup$1;
|
|
@@ -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 };
|
|
@@ -54,7 +54,7 @@ var Search = /*#__PURE__*/React__default["default"].forwardRef(function Search(_
|
|
|
54
54
|
onKeyDown = _ref.onKeyDown,
|
|
55
55
|
onExpand = _ref.onExpand,
|
|
56
56
|
_ref$placeholder = _ref.placeholder,
|
|
57
|
-
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
57
|
+
placeholder = _ref$placeholder === void 0 ? 'Search' : _ref$placeholder,
|
|
58
58
|
renderIcon = _ref.renderIcon,
|
|
59
59
|
_ref$role = _ref.role,
|
|
60
60
|
role = _ref$role === void 0 ? 'searchbox' : _ref$role,
|
|
@@ -125,9 +125,10 @@ var Search = /*#__PURE__*/React__default["default"].forwardRef(function Search(_
|
|
|
125
125
|
|
|
126
126
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
127
127
|
role: "search",
|
|
128
|
-
"aria-
|
|
128
|
+
"aria-label": placeholder,
|
|
129
129
|
className: searchClasses
|
|
130
130
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
131
|
+
"aria-labelledby": uniqueId,
|
|
131
132
|
role: onExpand ? 'button' : null,
|
|
132
133
|
className: "".concat(prefix, "--search-magnifier"),
|
|
133
134
|
onClick: onExpand
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var Search = require('./Search.js');
|
|
13
|
+
var Search_Skeleton = require('./Search.Skeleton.js');
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
exports.Search = Search["default"];
|
|
17
18
|
exports["default"] = Search["default"];
|
|
19
|
+
exports.SearchSkeleton = Search_Skeleton["default"];
|
|
@@ -256,7 +256,7 @@ StructuredListInput.propTypes = {
|
|
|
256
256
|
/**
|
|
257
257
|
* Provide an optional hook that is called each time the input is updated
|
|
258
258
|
*/
|
|
259
|
-
onChange:
|
|
259
|
+
onChange: PropTypes__default["default"].func,
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
262
|
* Provide a `title` for the input
|
|
@@ -39,7 +39,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
39
39
|
var _ChevronLeft, _ChevronRight;
|
|
40
40
|
|
|
41
41
|
var _excluded = ["activation", "aria-label", "children", "className", "contained", "iconSize", "leftOverflowButtonProps", "light", "rightOverflowButtonProps", "scrollDebounceWait", "scrollIntoView"],
|
|
42
|
-
_excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown"],
|
|
42
|
+
_excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown", "secondaryLabel", "hasSecondaryLabel"],
|
|
43
43
|
_excluded3 = ["children", "className", "defaultOpen", "enterDelayMs", "leaveDelayMs", "label"],
|
|
44
44
|
_excluded4 = ["children", "className"];
|
|
45
45
|
|
|
@@ -177,7 +177,10 @@ function TabList(_ref2) {
|
|
|
177
177
|
scrollLeft = _useState6[0],
|
|
178
178
|
setScrollLeft = _useState6[1];
|
|
179
179
|
|
|
180
|
-
var
|
|
180
|
+
var hasSecondaryLabelTabs = contained && !!React__default["default"].Children.toArray(children).filter(function (child) {
|
|
181
|
+
return child.props.secondaryLabel;
|
|
182
|
+
}).length;
|
|
183
|
+
var className = cx__default["default"]("".concat(prefix, "--tabs"), customClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tabs--contained"), contained), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tabs--light"), light), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tabs__icon--default"), iconSize === 'default'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tabs__icon--lg"), iconSize === 'lg'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tabs--tall"), hasSecondaryLabelTabs), _cx)); // Previous Button
|
|
181
184
|
// VISIBLE IF:
|
|
182
185
|
// SCROLLABLE
|
|
183
186
|
// AND SCROLL_LEFT > 0
|
|
@@ -337,7 +340,8 @@ function TabList(_ref2) {
|
|
|
337
340
|
}, /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
338
341
|
ref: function ref(node) {
|
|
339
342
|
tabs.current[index] = node;
|
|
340
|
-
}
|
|
343
|
+
},
|
|
344
|
+
hasSecondaryLabel: hasSecondaryLabelTabs
|
|
341
345
|
}));
|
|
342
346
|
})), /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
|
|
343
347
|
"aria-hidden": "true",
|
|
@@ -462,6 +466,8 @@ var Tab = /*#__PURE__*/React__default["default"].forwardRef(function Tab(_ref5,
|
|
|
462
466
|
disabled = _ref5.disabled,
|
|
463
467
|
_onClick = _ref5.onClick,
|
|
464
468
|
onKeyDown = _ref5.onKeyDown,
|
|
469
|
+
secondaryLabel = _ref5.secondaryLabel,
|
|
470
|
+
hasSecondaryLabel = _ref5.hasSecondaryLabel,
|
|
465
471
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref5, _excluded2);
|
|
466
472
|
|
|
467
473
|
var prefix = usePrefix.usePrefix();
|
|
@@ -498,7 +504,11 @@ var Tab = /*#__PURE__*/React__default["default"].forwardRef(function Tab(_ref5,
|
|
|
498
504
|
onKeyDown: onKeyDown,
|
|
499
505
|
tabIndex: selectedIndex === index ? '0' : '-1',
|
|
500
506
|
type: "button"
|
|
501
|
-
}),
|
|
507
|
+
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
508
|
+
className: "".concat(prefix, "--tabs__nav-item-label")
|
|
509
|
+
}, children), hasSecondaryLabel && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
510
|
+
className: "".concat(prefix, "--tabs__nav-item-secondary-label")
|
|
511
|
+
}, secondaryLabel));
|
|
502
512
|
});
|
|
503
513
|
Tab.propTypes = {
|
|
504
514
|
/**
|
|
@@ -521,6 +531,11 @@ Tab.propTypes = {
|
|
|
521
531
|
*/
|
|
522
532
|
disabled: PropTypes__default["default"].bool,
|
|
523
533
|
|
|
534
|
+
/*
|
|
535
|
+
* Internal use only, determines wether a tab should render as a secondary label tab
|
|
536
|
+
**/
|
|
537
|
+
hasSecondaryLabel: PropTypes__default["default"].bool,
|
|
538
|
+
|
|
524
539
|
/**
|
|
525
540
|
* Provide a handler that is invoked when a user clicks on the control
|
|
526
541
|
*/
|
|
@@ -536,7 +551,13 @@ Tab.propTypes = {
|
|
|
536
551
|
* Useful for using Tab along with react-router or other client
|
|
537
552
|
* side router libraries.
|
|
538
553
|
**/
|
|
539
|
-
renderButton: PropTypes__default["default"].func
|
|
554
|
+
renderButton: PropTypes__default["default"].func,
|
|
555
|
+
|
|
556
|
+
/*
|
|
557
|
+
* An optional label to render under the primary tab label.
|
|
558
|
+
/* This prop is only useful for conained tabs
|
|
559
|
+
**/
|
|
560
|
+
secondaryLabel: PropTypes__default["default"].string
|
|
540
561
|
};
|
|
541
562
|
var IconTab = /*#__PURE__*/React__default["default"].forwardRef(function IconTab(_ref6, ref) {
|
|
542
563
|
var children = _ref6.children,
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React, { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { ReactNodeLike } from 'prop-types';
|
|
3
|
+
type ExcludedAttributes = 'size';
|
|
4
|
+
export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
5
|
+
/**
|
|
6
|
+
* Provide a custom className that is applied directly to the underlyling `<input>` node
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Optionally provide the default value of the `<input>`
|
|
11
|
+
*/
|
|
12
|
+
defaultValue?: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* Specify whether the control is disabled
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Specify whether to display the character counter
|
|
19
|
+
*/
|
|
20
|
+
enableCounter?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Provide text that is used alongside the control label for additional help
|
|
23
|
+
*/
|
|
24
|
+
helperText?: ReactNodeLike;
|
|
25
|
+
/**
|
|
26
|
+
* Specify whether or not the underlying label is visually hidden
|
|
27
|
+
*/
|
|
28
|
+
hideLabel?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* "Hide password" tooltip text on password visibility toggle
|
|
31
|
+
*/
|
|
32
|
+
hidePasswordLabel?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Provide a unique identifier for the input field
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
/**
|
|
38
|
+
* `true` to use the inline version
|
|
39
|
+
*/
|
|
40
|
+
inline?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Specify whether the control is currently invalid
|
|
43
|
+
*/
|
|
44
|
+
invalid?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
47
|
+
*/
|
|
48
|
+
invalidText?: ReactNodeLike;
|
|
49
|
+
/**
|
|
50
|
+
* Provide the text that will be read by a screen reader when visiting this control
|
|
51
|
+
*/
|
|
52
|
+
labelText: ReactNodeLike;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated The `light` prop for `PasswordInput` has been deprecated in favor of the new `Layer` component. It will be removed in the next major release.
|
|
55
|
+
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
56
|
+
* Don't use this to make tile background color same as container background color.
|
|
57
|
+
*/
|
|
58
|
+
light?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Max character count allowed for the input. This is needed in order for enableCounter to display
|
|
61
|
+
*/
|
|
62
|
+
maxCount?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Optionally provide an `onChange` handler that is called whenever `<input>` is updated
|
|
65
|
+
* @param evt Change event triggered by `<input>`
|
|
66
|
+
* @returns {void}
|
|
67
|
+
*/
|
|
68
|
+
onChange?: (evt: React.ChangeEvent<HTMLInputElement>) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Optionally provide an `onClick` handler that is called whenever the `<input>` is returned
|
|
71
|
+
* @param evt Mouse event triggered by `<input>`
|
|
72
|
+
* @returns {void}
|
|
73
|
+
*/
|
|
74
|
+
onClick?: (evt: React.MouseEvent<HTMLInputElement>) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Callback function that is called whenever the toggle password visibility button is clicked
|
|
77
|
+
* @param evt Mouse event triggered by the password visibility `<button>`
|
|
78
|
+
* @returns {void}
|
|
79
|
+
*/
|
|
80
|
+
onTogglePasswordVisibility?: (evt: React.MouseEvent<HTMLButtonElement>) => void;
|
|
81
|
+
/**
|
|
82
|
+
* Specify the placeholder attribute for the `<input>`
|
|
83
|
+
*/
|
|
84
|
+
placeholder?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the input should be read-only
|
|
87
|
+
*/
|
|
88
|
+
readOnly?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* "Show password" tooltip text on password visibility toggle
|
|
91
|
+
*/
|
|
92
|
+
showPasswordLabel?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Specify the size of the Text Input. Supports `sm`, `md`, or `lg`.
|
|
95
|
+
*/
|
|
96
|
+
size?: 'sm' | 'md' | 'lg';
|
|
97
|
+
/**
|
|
98
|
+
* Specify the alignment of the tooltip to the icon-only button.
|
|
99
|
+
* Can be one of: `start`, `center`, or `end`.
|
|
100
|
+
*/
|
|
101
|
+
tooltipAlignment?: 'start' | 'center' | 'end';
|
|
102
|
+
/**
|
|
103
|
+
* Specify the direction of the tooltip for the icon-only button.
|
|
104
|
+
* Can be either `top`, `right`, `bottom`, or `left`
|
|
105
|
+
*/
|
|
106
|
+
tooltipPosition?: 'top' | 'right' | 'bottom' | 'left';
|
|
107
|
+
/**
|
|
108
|
+
* The input type, either `password` or `text`
|
|
109
|
+
*/
|
|
110
|
+
type?: 'password' | 'text';
|
|
111
|
+
/**
|
|
112
|
+
* Provide the current value of the `<input>`
|
|
113
|
+
*/
|
|
114
|
+
value?: string | number;
|
|
115
|
+
/**
|
|
116
|
+
* Specify whether the control is currently in warning state
|
|
117
|
+
*/
|
|
118
|
+
warn?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Provide the text that is displayed when the control is in warning state
|
|
121
|
+
*/
|
|
122
|
+
warnText?: ReactNodeLike;
|
|
123
|
+
}
|
|
124
|
+
declare const PasswordInput: React.ForwardRefExoticComponent<PasswordInputProps & React.RefAttributes<unknown>>;
|
|
125
|
+
export default PasswordInput;
|
|
@@ -18,36 +18,16 @@ var useNormalizedInputProps = require('../../internal/useNormalizedInputProps.js
|
|
|
18
18
|
var util = require('./util.js');
|
|
19
19
|
require('../FluidForm/FluidForm.js');
|
|
20
20
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
21
|
-
var FeatureFlags = require('@carbon/feature-flags');
|
|
22
21
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
23
22
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
24
23
|
|
|
25
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
26
25
|
|
|
27
|
-
function _interopNamespace(e) {
|
|
28
|
-
if (e && e.__esModule) return e;
|
|
29
|
-
var n = Object.create(null);
|
|
30
|
-
if (e) {
|
|
31
|
-
Object.keys(e).forEach(function (k) {
|
|
32
|
-
if (k !== 'default') {
|
|
33
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
34
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function () { return e[k]; }
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
n["default"] = e;
|
|
42
|
-
return Object.freeze(n);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
26
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
46
27
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
47
28
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
48
|
-
var FeatureFlags__namespace = /*#__PURE__*/_interopNamespace(FeatureFlags);
|
|
49
29
|
|
|
50
|
-
var _excluded = ["className", "disabled", "helperText", "hideLabel", "hidePasswordLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "onTogglePasswordVisibility", "placeholder", "size", "showPasswordLabel", "tooltipPosition", "tooltipAlignment", "type", "warn", "warnText"];
|
|
30
|
+
var _excluded = ["className", "disabled", "helperText", "hideLabel", "hidePasswordLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "onTogglePasswordVisibility", "placeholder", "readOnly", "size", "showPasswordLabel", "tooltipPosition", "tooltipAlignment", "type", "warn", "warnText"];
|
|
51
31
|
var PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function PasswordInput(_ref, ref) {
|
|
52
32
|
var _classNames, _classNames2, _classNames3, _classNames4, _classNames7, _classNames8;
|
|
53
33
|
|
|
@@ -71,6 +51,7 @@ var PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function P
|
|
|
71
51
|
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
72
52
|
onTogglePasswordVisibility = _ref.onTogglePasswordVisibility,
|
|
73
53
|
placeholder = _ref.placeholder,
|
|
54
|
+
readOnly = _ref.readOnly,
|
|
74
55
|
_ref$size = _ref.size,
|
|
75
56
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
76
57
|
_ref$showPasswordLabe = _ref.showPasswordLabel,
|
|
@@ -81,7 +62,8 @@ var PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function P
|
|
|
81
62
|
tooltipAlignment = _ref$tooltipAlignment === void 0 ? 'center' : _ref$tooltipAlignment,
|
|
82
63
|
_ref$type = _ref.type,
|
|
83
64
|
type = _ref$type === void 0 ? 'password' : _ref$type,
|
|
84
|
-
warn = _ref.warn,
|
|
65
|
+
_ref$warn = _ref.warn,
|
|
66
|
+
warn = _ref$warn === void 0 ? false : _ref$warn,
|
|
85
67
|
warnText = _ref.warnText,
|
|
86
68
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
87
69
|
|
|
@@ -96,7 +78,9 @@ var PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function P
|
|
|
96
78
|
invalid: invalid,
|
|
97
79
|
invalidText: invalidText,
|
|
98
80
|
warn: warn,
|
|
99
|
-
warnText: warnText
|
|
81
|
+
warnText: warnText,
|
|
82
|
+
readOnly: readOnly,
|
|
83
|
+
disabled: disabled
|
|
100
84
|
});
|
|
101
85
|
|
|
102
86
|
var _useContext = React.useContext(FormContext.FormContext),
|
|
@@ -169,6 +153,7 @@ var PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function P
|
|
|
169
153
|
React.useEffect(function () {
|
|
170
154
|
setInputType(type);
|
|
171
155
|
}, [type]);
|
|
156
|
+
var Icon = normalizedProps.icon;
|
|
172
157
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
173
158
|
className: inputWrapperClasses
|
|
174
159
|
}, !inline ? label : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -178,7 +163,7 @@ var PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function P
|
|
|
178
163
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
179
164
|
className: fieldWrapperClasses,
|
|
180
165
|
"data-invalid": normalizedProps.invalid || null
|
|
181
|
-
},
|
|
166
|
+
}, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
182
167
|
className: iconClasses
|
|
183
168
|
}), input, isFluid && !inline && normalizedProps.validation), !isFluid && !inline && (normalizedProps.validation || helper)));
|
|
184
169
|
});
|
|
@@ -278,7 +263,7 @@ PasswordInput.propTypes = {
|
|
|
278
263
|
/**
|
|
279
264
|
* Specify the size of the Text Input. Supports `sm`, `md`, or `lg`.
|
|
280
265
|
*/
|
|
281
|
-
size:
|
|
266
|
+
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
|
|
282
267
|
|
|
283
268
|
/**
|
|
284
269
|
* Specify the alignment of the tooltip to the icon-only button.
|