@carbon/react 1.26.0 → 1.27.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/Checkbox/Checkbox.d.ts +20 -0
- package/es/components/Checkbox/Checkbox.js +58 -4
- package/es/components/CheckboxGroup/CheckboxGroup.js +119 -0
- package/es/components/ComboBox/ComboBox.js +11 -2
- package/es/components/ContentSwitcher/ContentSwitcher.js +9 -4
- package/es/components/Copy/Copy.js +1 -1
- package/es/components/DataTable/DataTable.js +44 -2
- package/es/components/DataTable/Table.js +1 -2
- package/es/components/DataTable/TableCell.js +1 -2
- package/es/components/DataTable/TableExpandRow.js +1 -2
- package/es/components/DataTable/TableExpandedRow.js +1 -2
- package/es/components/DataTable/TableHead.js +1 -2
- package/es/components/DataTable/TableHeader.js +1 -2
- package/es/components/DataTable/TableRow.js +1 -2
- package/es/components/DataTable/TableSelectAll.js +1 -2
- package/es/components/DataTable/TableSelectRow.js +1 -2
- package/es/components/DataTable/TableToolbar.js +2 -3
- package/es/components/DataTable/TableToolbarAction.js +1 -2
- package/es/components/DataTable/TableToolbarContent.js +1 -2
- package/es/components/DataTable/TableToolbarMenu.js +1 -2
- package/es/components/DataTable/index.d.ts +29 -0
- package/es/components/DataTable/index.js +70 -0
- package/es/components/DatePicker/DatePicker.js +25 -3
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +15 -1
- package/es/components/DatePickerInput/DatePickerInput.js +7 -2
- package/es/components/Dropdown/Dropdown.js +16 -4
- package/es/components/ErrorBoundary/ErrorBoundary.js +1 -1
- package/es/components/FileUploader/FileUploader.js +1 -1
- package/es/components/FluidDatePicker/FluidDatePicker.js +9 -2
- package/es/components/IconButton/index.js +19 -5
- package/es/components/Modal/Modal.js +4 -2
- package/es/components/ModalWrapper/ModalWrapper.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +9 -1
- package/es/components/MultiSelect/MultiSelect.js +2 -1
- package/es/components/NumberInput/NumberInput.js +10 -2
- package/es/components/ProgressBar/ProgressBar.js +3 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +2 -1
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Select/Select.js +10 -1
- package/es/components/StructuredList/StructuredList.js +2 -1
- package/es/components/Switch/IconSwitch.js +174 -0
- package/es/components/TextArea/TextArea.js +16 -1
- package/es/components/TextInput/ControlledPasswordInput.js +11 -2
- package/es/components/TextInput/PasswordInput.js +4 -1
- package/es/components/TextInput/index.js +0 -3
- package/es/components/TextInput/util.js +15 -2
- package/es/components/Tile/Tile.js +6 -4
- package/es/components/Toggle/Toggle.Skeleton.d.ts +58 -0
- package/es/components/Toggle/Toggle.Skeleton.js +1 -1
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +1 -1
- package/es/components/Tooltip/Tooltip.d.ts +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +4 -1
- package/lib/components/Checkbox/Checkbox.d.ts +20 -0
- package/lib/components/Checkbox/Checkbox.js +58 -4
- package/lib/components/CheckboxGroup/CheckboxGroup.js +129 -0
- package/lib/components/ComboBox/ComboBox.js +10 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.js +9 -4
- package/lib/components/Copy/Copy.js +1 -1
- package/lib/components/DataTable/DataTable.js +48 -6
- package/lib/components/DataTable/Table.js +1 -2
- package/lib/components/DataTable/TableCell.js +1 -2
- package/lib/components/DataTable/TableExpandRow.js +1 -2
- package/lib/components/DataTable/TableExpandedRow.js +1 -2
- package/lib/components/DataTable/TableHead.js +1 -2
- package/lib/components/DataTable/TableHeader.js +1 -2
- package/lib/components/DataTable/TableRow.js +1 -2
- package/lib/components/DataTable/TableSelectAll.js +1 -2
- package/lib/components/DataTable/TableSelectRow.js +1 -2
- package/lib/components/DataTable/TableToolbar.js +1 -2
- package/lib/components/DataTable/TableToolbarAction.js +1 -2
- package/lib/components/DataTable/TableToolbarContent.js +1 -2
- package/lib/components/DataTable/TableToolbarMenu.js +1 -2
- package/lib/components/DataTable/index.d.ts +29 -0
- package/lib/components/DataTable/index.js +76 -0
- package/lib/components/DatePicker/DatePicker.js +25 -3
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +15 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +7 -2
- package/lib/components/Dropdown/Dropdown.js +15 -3
- package/lib/components/FluidDatePicker/FluidDatePicker.js +9 -2
- package/lib/components/IconButton/index.js +19 -5
- package/lib/components/Modal/Modal.js +4 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +8 -0
- package/lib/components/MultiSelect/MultiSelect.js +2 -1
- package/lib/components/NumberInput/NumberInput.js +10 -2
- package/lib/components/ProgressBar/ProgressBar.js +3 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +2 -1
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/Select.js +9 -0
- package/lib/components/StructuredList/StructuredList.js +2 -1
- package/lib/components/Switch/IconSwitch.js +184 -0
- package/lib/components/TextArea/TextArea.js +16 -1
- package/lib/components/TextInput/ControlledPasswordInput.js +10 -1
- package/lib/components/TextInput/PasswordInput.js +4 -1
- package/lib/components/TextInput/index.js +0 -3
- package/lib/components/TextInput/util.js +15 -2
- package/lib/components/Tile/Tile.js +6 -4
- package/lib/components/Toggle/Toggle.Skeleton.d.ts +58 -0
- package/lib/components/Toggle/Toggle.Skeleton.js +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -1
- package/package.json +12 -12
|
@@ -0,0 +1,174 @@
|
|
|
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
|
+
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default, { useState } from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import { IconButton } from '../IconButton/index.js';
|
|
13
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
|
|
15
|
+
var _excluded = ["align", "children", "className", "disabled", "enterDelayMs", "index", "leaveDelayMs", "name", "onClick", "onKeyDown", "selected", "size", "text"];
|
|
16
|
+
|
|
17
|
+
var noopFn = function noopFn() {};
|
|
18
|
+
|
|
19
|
+
var IconSwitch = /*#__PURE__*/React__default.forwardRef(function Switch(props, tabRef) {
|
|
20
|
+
var _classNames2;
|
|
21
|
+
|
|
22
|
+
var align = props.align,
|
|
23
|
+
children = props.children,
|
|
24
|
+
className = props.className,
|
|
25
|
+
disabled = props.disabled,
|
|
26
|
+
enterDelayMs = props.enterDelayMs,
|
|
27
|
+
index = props.index,
|
|
28
|
+
_props$leaveDelayMs = props.leaveDelayMs,
|
|
29
|
+
leaveDelayMs = _props$leaveDelayMs === void 0 ? 0 : _props$leaveDelayMs,
|
|
30
|
+
name = props.name,
|
|
31
|
+
_props$onClick = props.onClick,
|
|
32
|
+
onClick = _props$onClick === void 0 ? noopFn : _props$onClick,
|
|
33
|
+
_props$onKeyDown = props.onKeyDown,
|
|
34
|
+
onKeyDown = _props$onKeyDown === void 0 ? noopFn : _props$onKeyDown,
|
|
35
|
+
_props$selected = props.selected,
|
|
36
|
+
selected = _props$selected === void 0 ? false : _props$selected,
|
|
37
|
+
size = props.size,
|
|
38
|
+
text = props.text,
|
|
39
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
40
|
+
|
|
41
|
+
var prefix = usePrefix();
|
|
42
|
+
|
|
43
|
+
var _useState = useState(false),
|
|
44
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
+
isHovered = _useState2[0],
|
|
46
|
+
setIsHovered = _useState2[1];
|
|
47
|
+
|
|
48
|
+
var handleClick = function handleClick(e) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
onClick({
|
|
51
|
+
index: index,
|
|
52
|
+
name: name,
|
|
53
|
+
text: text
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
58
|
+
var key = event.key || event.which;
|
|
59
|
+
onKeyDown({
|
|
60
|
+
index: index,
|
|
61
|
+
name: name,
|
|
62
|
+
text: text,
|
|
63
|
+
key: key
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
68
|
+
setIsHovered(true);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
72
|
+
setIsHovered(false);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var classes = cx(className, "".concat(prefix, "--content-switcher-btn"), _defineProperty({}, "".concat(prefix, "--content-switcher--selected"), selected));
|
|
76
|
+
var iconButtonClasses = cx("".concat(prefix, "--content-switcher-popover__wrapper"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "--content-switcher-popover--selected"), selected), _defineProperty(_classNames2, "".concat(prefix, "--content-switcher-popover--disabled"), disabled), _classNames2));
|
|
77
|
+
var commonProps = {
|
|
78
|
+
onClick: handleClick,
|
|
79
|
+
onKeyDown: handleKeyDown,
|
|
80
|
+
className: classes,
|
|
81
|
+
disabled: disabled,
|
|
82
|
+
align: align,
|
|
83
|
+
enterDelayMs: enterDelayMs,
|
|
84
|
+
leaveDelayMs: leaveDelayMs,
|
|
85
|
+
size: size
|
|
86
|
+
};
|
|
87
|
+
return /*#__PURE__*/React__default.createElement(IconButton, _extends({
|
|
88
|
+
label: text,
|
|
89
|
+
type: "button",
|
|
90
|
+
ref: tabRef,
|
|
91
|
+
role: "tab",
|
|
92
|
+
tabIndex: selected || isHovered ? 0 : -1,
|
|
93
|
+
onMouseEnter: handleMouseEnter,
|
|
94
|
+
onMouseLeave: handleMouseLeave,
|
|
95
|
+
onFocus: handleMouseEnter,
|
|
96
|
+
onBlur: handleMouseLeave,
|
|
97
|
+
"aria-selected": selected,
|
|
98
|
+
"aria-label": text,
|
|
99
|
+
wrapperClasses: iconButtonClasses
|
|
100
|
+
}, other, commonProps), children);
|
|
101
|
+
});
|
|
102
|
+
IconSwitch.displayName = 'IconSwitch';
|
|
103
|
+
IconSwitch.propTypes = {
|
|
104
|
+
/**
|
|
105
|
+
* Specify how the trigger should align with the tooltip
|
|
106
|
+
*/
|
|
107
|
+
align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Provide child elements to be rendered inside of the Switch
|
|
111
|
+
*/
|
|
112
|
+
children: PropTypes.node,
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Specify an optional className to be added to your Switch
|
|
116
|
+
*/
|
|
117
|
+
className: PropTypes.string,
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Specify whether or not the Switch should be disabled
|
|
121
|
+
*/
|
|
122
|
+
disabled: PropTypes.bool,
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Specify the duration in milliseconds to delay before displaying the tooltip
|
|
126
|
+
*/
|
|
127
|
+
enterDelayMs: PropTypes.number,
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The index of your Switch in your ContentSwitcher that is used for event handlers.
|
|
131
|
+
* Reserved for usage in ContentSwitcher
|
|
132
|
+
*/
|
|
133
|
+
index: PropTypes.number,
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Specify the duration in milliseconds to delay before hiding the tooltip
|
|
137
|
+
*/
|
|
138
|
+
leaveDelayMs: PropTypes.number,
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Provide the name of your Switch that is used for event handlers
|
|
142
|
+
*/
|
|
143
|
+
name: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* A handler that is invoked when a user clicks on the control.
|
|
147
|
+
* Reserved for usage in ContentSwitcher
|
|
148
|
+
*/
|
|
149
|
+
onClick: PropTypes.func,
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* A handler that is invoked on the key down event for the control.
|
|
153
|
+
* Reserved for usage in ContentSwitcher
|
|
154
|
+
*/
|
|
155
|
+
onKeyDown: PropTypes.func,
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Whether your Switch is selected. Reserved for usage in ContentSwitcher
|
|
159
|
+
*/
|
|
160
|
+
selected: PropTypes.bool,
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Passed in from `ContentSwitcher` to render icon-only variant
|
|
164
|
+
*/
|
|
165
|
+
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Provide the visible text displayed by the Tooltip
|
|
169
|
+
*/
|
|
170
|
+
text: PropTypes.string
|
|
171
|
+
};
|
|
172
|
+
var IconSwitch$1 = IconSwitch;
|
|
173
|
+
|
|
174
|
+
export { IconSwitch$1 as default };
|
|
@@ -18,8 +18,10 @@ import { FormContext } from '../FluidForm/FormContext.js';
|
|
|
18
18
|
import { useAnnouncer } from '../../internal/useAnnouncer.js';
|
|
19
19
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
20
20
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
21
|
+
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
21
22
|
|
|
22
23
|
var _excluded = ["className", "id", "labelText", "hideLabel", "onChange", "onClick", "invalid", "invalidText", "helperText", "light", "placeholder", "enableCounter", "maxCount", "warn", "warnText"];
|
|
24
|
+
var getInstanceId = setupGetInstanceId();
|
|
23
25
|
var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRef) {
|
|
24
26
|
var _classNames, _classNames4, _classNames5;
|
|
25
27
|
|
|
@@ -56,6 +58,9 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRe
|
|
|
56
58
|
textCount = _useState2[0],
|
|
57
59
|
setTextCount = _useState2[1];
|
|
58
60
|
|
|
61
|
+
var _useRef = useRef(getInstanceId()),
|
|
62
|
+
textAreaInstanceId = _useRef.current;
|
|
63
|
+
|
|
59
64
|
var textareaProps = {
|
|
60
65
|
id: id,
|
|
61
66
|
onChange: function onChange(evt) {
|
|
@@ -89,7 +94,9 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRe
|
|
|
89
94
|
className: counterClasses
|
|
90
95
|
}, "".concat(textCount, "/").concat(maxCount)) : null;
|
|
91
96
|
var helperTextClasses = cx("".concat(prefix, "--form__helper-text"), _defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), other.disabled));
|
|
97
|
+
var helperId = !helperText ? undefined : "text-area-helper-text-".concat(textAreaInstanceId);
|
|
92
98
|
var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
99
|
+
id: helperId,
|
|
93
100
|
className: helperTextClasses
|
|
94
101
|
}, helperText) : null;
|
|
95
102
|
var errorId = id + '-error-msg';
|
|
@@ -117,11 +124,19 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRe
|
|
|
117
124
|
textareaRef.current.style.width = "100%";
|
|
118
125
|
}
|
|
119
126
|
}, [other.cols]);
|
|
127
|
+
var ariaDescribedBy;
|
|
128
|
+
|
|
129
|
+
if (invalid) {
|
|
130
|
+
ariaDescribedBy = errorId;
|
|
131
|
+
} else if (!invalid && !warn && !isFluid && helperText) {
|
|
132
|
+
ariaDescribedBy = helperId;
|
|
133
|
+
}
|
|
134
|
+
|
|
120
135
|
var input = /*#__PURE__*/React__default.createElement("textarea", _extends({}, other, textareaProps, {
|
|
121
136
|
placeholder: placeholder,
|
|
122
137
|
className: textareaClasses,
|
|
123
138
|
"aria-invalid": invalid,
|
|
124
|
-
"aria-describedby":
|
|
139
|
+
"aria-describedby": ariaDescribedBy,
|
|
125
140
|
disabled: other.disabled,
|
|
126
141
|
readOnly: other.readOnly,
|
|
127
142
|
ref: ref
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, objectSpread2 as _objectSpread2, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default from 'react';
|
|
9
|
+
import React__default, { useRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { WarningFilled, ViewOff, View } from '@carbon/icons-react';
|
|
@@ -14,8 +14,10 @@ import { textInputProps } from './util.js';
|
|
|
14
14
|
import { warning } from '../../internal/warning.js';
|
|
15
15
|
import deprecate from '../../prop-types/deprecate.js';
|
|
16
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
17
|
+
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
17
18
|
|
|
18
19
|
var _excluded = ["labelText", "className", "id", "placeholder", "onChange", "onClick", "hideLabel", "invalid", "invalidText", "helperText", "light", "type", "togglePasswordVisibility", "tooltipPosition", "tooltipAlignment", "hidePasswordLabel", "showPasswordLabel", "size"];
|
|
20
|
+
var getInstanceId = setupGetInstanceId();
|
|
19
21
|
var didWarnAboutDeprecation = false;
|
|
20
22
|
var ControlledPasswordInput = /*#__PURE__*/React__default.forwardRef(function ControlledPasswordInput(_ref, ref) {
|
|
21
23
|
var _classNames, _classNames2, _classNames4;
|
|
@@ -47,6 +49,9 @@ var ControlledPasswordInput = /*#__PURE__*/React__default.forwardRef(function Co
|
|
|
47
49
|
|
|
48
50
|
var prefix = usePrefix();
|
|
49
51
|
|
|
52
|
+
var _useRef = useRef(getInstanceId()),
|
|
53
|
+
controlledPasswordInstanceId = _useRef.current;
|
|
54
|
+
|
|
50
55
|
if (process.env.NODE_ENV !== "production") {
|
|
51
56
|
process.env.NODE_ENV !== "production" ? warning(didWarnAboutDeprecation, '`<TextInput.ControlledPasswordInput>` has been deprecated in favor of `<TextInput.PasswordInput />` and will be removed in the next major release of `carbon-components-react`') : void 0;
|
|
52
57
|
didWarnAboutDeprecation = true;
|
|
@@ -90,10 +95,13 @@ var ControlledPasswordInput = /*#__PURE__*/React__default.forwardRef(function Co
|
|
|
90
95
|
className: "".concat(prefix, "--icon-visibility-on")
|
|
91
96
|
});
|
|
92
97
|
var passwordVisibilityToggleClasses = cx("".concat(prefix, "--text-input--password__visibility__toggle"), "".concat(prefix, "--btn"), "".concat(prefix, "--btn--icon-only"), "".concat(prefix, "--tooltip__trigger"), "".concat(prefix, "--tooltip--a11y"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--tooltip--").concat(tooltipPosition), tooltipPosition), _defineProperty(_classNames4, "".concat(prefix, "--tooltip--align-").concat(tooltipAlignment), tooltipAlignment), _classNames4));
|
|
98
|
+
var helperId = !helperText ? undefined : "controlled-password-helper-text-".concat(controlledPasswordInstanceId);
|
|
93
99
|
var input = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("input", _extends({}, textInputProps({
|
|
94
100
|
invalid: invalid,
|
|
95
101
|
sharedTextInputProps: sharedTextInputProps,
|
|
96
|
-
invalidId: errorId
|
|
102
|
+
invalidId: errorId,
|
|
103
|
+
hasHelper: !error && helperText,
|
|
104
|
+
helperId: helperId
|
|
97
105
|
}), {
|
|
98
106
|
"data-toggle-password-visibility": type === 'password'
|
|
99
107
|
})), /*#__PURE__*/React__default.createElement("button", {
|
|
@@ -104,6 +112,7 @@ var ControlledPasswordInput = /*#__PURE__*/React__default.forwardRef(function Co
|
|
|
104
112
|
className: "".concat(prefix, "--assistive-text")
|
|
105
113
|
}, passwordIsVisible ? hidePasswordLabel : showPasswordLabel), passwordVisibilityIcon));
|
|
106
114
|
var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
115
|
+
id: helperId,
|
|
107
116
|
className: helperTextClasses
|
|
108
117
|
}, helperText) : null;
|
|
109
118
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -112,6 +112,7 @@ var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInpu
|
|
|
112
112
|
className: labelClasses
|
|
113
113
|
}, labelText) : null;
|
|
114
114
|
var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
115
|
+
id: normalizedProps.helperId,
|
|
115
116
|
className: helperTextClasses
|
|
116
117
|
}, helperText) : null;
|
|
117
118
|
var passwordIsVisible = inputType === 'text';
|
|
@@ -126,7 +127,9 @@ var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInpu
|
|
|
126
127
|
invalid: normalizedProps.invalid,
|
|
127
128
|
invalidId: normalizedProps.invalidId,
|
|
128
129
|
warn: normalizedProps.warn,
|
|
129
|
-
warnId: normalizedProps.warnId
|
|
130
|
+
warnId: normalizedProps.warnId,
|
|
131
|
+
hasHelper: Boolean(helperText && !isFluid && (inline || !inline && !normalizedProps.validation)),
|
|
132
|
+
helperId: normalizedProps.helperId
|
|
130
133
|
}), {
|
|
131
134
|
disabled: disabled,
|
|
132
135
|
"data-toggle-password-visibility": inputType === 'password'
|
|
@@ -12,9 +12,6 @@ import TextInput from './TextInput.js';
|
|
|
12
12
|
export { default as TextInput, default } from './TextInput.js';
|
|
13
13
|
export { default as TextInputSkeleton } from './TextInput.Skeleton.js';
|
|
14
14
|
|
|
15
|
-
TextInput.ControlledPasswordInput = ControlledPasswordInput;
|
|
16
|
-
TextInput.PasswordInput = PasswordInput;
|
|
17
|
-
|
|
18
15
|
if (process.env.NODE_ENV !== "production") {
|
|
19
16
|
deprecateFieldOnObject(TextInput, 'ControlledPasswordInput', ControlledPasswordInput);
|
|
20
17
|
deprecateFieldOnObject(TextInput, 'PasswordInput', PasswordInput);
|
|
@@ -21,13 +21,26 @@ var warnProps = function warnProps(warnId) {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
var helperProps = function helperProps(helperId) {
|
|
25
|
+
return {
|
|
26
|
+
'aria-describedby': helperId
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @param {{sharedTextInputProps: object, invalid?: boolean, invalidId?: string, warn?: boolean, warnId?: string, hasHelper?: boolean, helperId?: string}} config
|
|
31
|
+
* @returns {object}
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
24
35
|
var textInputProps = function textInputProps(_ref) {
|
|
25
36
|
var sharedTextInputProps = _ref.sharedTextInputProps,
|
|
26
37
|
invalid = _ref.invalid,
|
|
27
38
|
invalidId = _ref.invalidId,
|
|
28
39
|
warn = _ref.warn,
|
|
29
|
-
warnId = _ref.warnId
|
|
30
|
-
|
|
40
|
+
warnId = _ref.warnId,
|
|
41
|
+
hasHelper = _ref.hasHelper,
|
|
42
|
+
helperId = _ref.helperId;
|
|
43
|
+
return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, sharedTextInputProps), invalid ? invalidProps(invalidId) : {}), warn ? warnProps(warnId) : {}), hasHelper ? helperProps(helperId) : {});
|
|
31
44
|
};
|
|
32
45
|
|
|
33
46
|
export { textInputProps };
|
|
@@ -16,6 +16,7 @@ import { composeEventHandlers } from '../../tools/events.js';
|
|
|
16
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
17
17
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
18
18
|
import { getInteractiveContent } from '../../internal/useNoInteractiveChildren.js';
|
|
19
|
+
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
19
20
|
import { matches } from '../../internal/keyboard/match.js';
|
|
20
21
|
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
21
22
|
|
|
@@ -318,7 +319,7 @@ SelectableTile.propTypes = {
|
|
|
318
319
|
*/
|
|
319
320
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
|
|
320
321
|
};
|
|
321
|
-
function ExpandableTile(_ref4) {
|
|
322
|
+
var ExpandableTile = /*#__PURE__*/React__default.forwardRef(function ExpandableTile(_ref4, forwardRef) {
|
|
322
323
|
var _cx4, _cx5;
|
|
323
324
|
|
|
324
325
|
var tabIndex = _ref4.tabIndex,
|
|
@@ -376,6 +377,7 @@ function ExpandableTile(_ref4) {
|
|
|
376
377
|
var tileContent = useRef(null);
|
|
377
378
|
var tile = useRef(null);
|
|
378
379
|
var prefix = usePrefix();
|
|
380
|
+
var ref = useMergedRefs([forwardRef, tile]);
|
|
379
381
|
|
|
380
382
|
if (expanded !== prevExpanded) {
|
|
381
383
|
setIsExpanded(expanded);
|
|
@@ -463,7 +465,7 @@ function ExpandableTile(_ref4) {
|
|
|
463
465
|
};
|
|
464
466
|
}, []);
|
|
465
467
|
return interactive ? /*#__PURE__*/React__default.createElement("div", _extends({
|
|
466
|
-
ref:
|
|
468
|
+
ref: ref,
|
|
467
469
|
className: interactiveClassNames,
|
|
468
470
|
"aria-expanded": isExpanded
|
|
469
471
|
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -483,7 +485,7 @@ function ExpandableTile(_ref4) {
|
|
|
483
485
|
className: "".concat(prefix, "--tile-content")
|
|
484
486
|
}, childrenAsArray[1]))) : /*#__PURE__*/React__default.createElement("button", _extends({
|
|
485
487
|
type: "button",
|
|
486
|
-
ref:
|
|
488
|
+
ref: ref,
|
|
487
489
|
className: classNames,
|
|
488
490
|
"aria-expanded": isExpanded,
|
|
489
491
|
title: isExpanded ? tileExpandedIconText : tileCollapsedIconText
|
|
@@ -502,7 +504,7 @@ function ExpandableTile(_ref4) {
|
|
|
502
504
|
ref: belowTheFold,
|
|
503
505
|
className: "".concat(prefix, "--tile-content")
|
|
504
506
|
}, childrenAsArray[1])));
|
|
505
|
-
}
|
|
507
|
+
});
|
|
506
508
|
ExpandableTile.propTypes = {
|
|
507
509
|
/**
|
|
508
510
|
* The child nodes.
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
type ToggleSkeletonProps = {
|
|
10
|
+
'aria-label': string;
|
|
11
|
+
/**
|
|
12
|
+
* Specify an optional className to add to the form item wrapper.
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Provide an id that unique represents the underlying `<input>`
|
|
17
|
+
*/
|
|
18
|
+
id?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Provide the text that will be read by a screen reader when visiting this
|
|
21
|
+
* control
|
|
22
|
+
* `aria-label` is always required but will be null if `labelText` is also
|
|
23
|
+
* provided
|
|
24
|
+
*/
|
|
25
|
+
labelText?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Specify the size of the Toggle. Currently only supports 'sm' or 'md' (default)
|
|
28
|
+
*/
|
|
29
|
+
size?: 'sm' | 'md';
|
|
30
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
31
|
+
declare class ToggleSkeleton extends React.Component<ToggleSkeletonProps> {
|
|
32
|
+
static propTypes: {
|
|
33
|
+
"aria-label": PropTypes.Validator<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Specify an optional className to add to the form item wrapper.
|
|
36
|
+
*/
|
|
37
|
+
className: PropTypes.Requireable<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Provide an id that unique represents the underlying `<input>`
|
|
40
|
+
*/
|
|
41
|
+
id: PropTypes.Requireable<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Provide the text that will be read by a screen reader when visiting this
|
|
44
|
+
* control
|
|
45
|
+
* `aria-label` is always required but will be undefined if `labelText` is also
|
|
46
|
+
* provided
|
|
47
|
+
*/
|
|
48
|
+
labelText: PropTypes.Requireable<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Specify the size of the Toggle. Currently only supports 'sm' or 'md' (default)
|
|
51
|
+
*/
|
|
52
|
+
size: PropTypes.Requireable<string>;
|
|
53
|
+
};
|
|
54
|
+
static defaultProps: Partial<ToggleSkeletonProps>;
|
|
55
|
+
render(): JSX.Element;
|
|
56
|
+
}
|
|
57
|
+
export default ToggleSkeleton;
|
|
58
|
+
export { ToggleSkeleton };
|
|
@@ -50,7 +50,7 @@ var ToggleSkeleton = /*#__PURE__*/function (_React$Component) {
|
|
|
50
50
|
}), /*#__PURE__*/React__default.createElement("label", {
|
|
51
51
|
className: "".concat(prefix, "--toggle-input__label"),
|
|
52
52
|
htmlFor: id,
|
|
53
|
-
"aria-label": labelText ?
|
|
53
|
+
"aria-label": labelText ? undefined : _this.props['aria-label']
|
|
54
54
|
}, labelText ? _div || (_div = /*#__PURE__*/React__default.createElement("div", null, labelText)) : null, /*#__PURE__*/React__default.createElement("span", {
|
|
55
55
|
className: "".concat(prefix, "--toggle__switch")
|
|
56
56
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { inherits as _inherits, createSuper as _createSuper,
|
|
8
|
+
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass, objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
@@ -22,7 +22,7 @@ interface TooltipBaseProps {
|
|
|
22
22
|
*/
|
|
23
23
|
className?: string;
|
|
24
24
|
/**
|
|
25
|
-
* Determines
|
|
25
|
+
* Determines whether the tooltip should close when inner content is activated (click, Enter or Space)
|
|
26
26
|
*/
|
|
27
27
|
closeOnActivation?: boolean;
|
|
28
28
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { inherits as _inherits, createSuper as _createSuper,
|
|
8
|
+
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass, objectWithoutProperties as _objectWithoutProperties, extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import { ChevronDown } from '@carbon/icons-react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import React__default from 'react';
|
package/es/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './components/Breadcrumb';
|
|
|
12
12
|
export * from './components/Button';
|
|
13
13
|
export * from './components/ButtonSet';
|
|
14
14
|
export * from './components/Checkbox';
|
|
15
|
+
export * from './components/CheckboxGroup';
|
|
15
16
|
export * from './components/ClassPrefix';
|
|
16
17
|
export * from './components/CodeSnippet';
|
|
17
18
|
export * from './components/ComboBox';
|
package/es/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { default as Checkbox } from './components/Checkbox/Checkbox.js';
|
|
|
10
10
|
export { default as CheckboxSkeleton } from './components/Checkbox/Checkbox.Skeleton.js';
|
|
11
11
|
export { ClassPrefix } from './components/ClassPrefix/index.js';
|
|
12
12
|
export { default as ContentSwitcher } from './components/ContentSwitcher/index.js';
|
|
13
|
+
import './components/DataTable/index.js';
|
|
13
14
|
export { default as Dropdown } from './components/Dropdown/Dropdown.js';
|
|
14
15
|
export { default as DropdownSkeleton } from './components/Dropdown/Dropdown.Skeleton.js';
|
|
15
16
|
export { default as FluidForm } from './components/FluidForm/FluidForm.js';
|
|
@@ -60,6 +61,7 @@ export { default as AccordionSkeleton } from './components/Accordion/Accordion.S
|
|
|
60
61
|
export { default as Accordion } from './components/Accordion/Accordion.js';
|
|
61
62
|
export { default as AspectRatio } from './components/AspectRatio/AspectRatio.js';
|
|
62
63
|
export { default as BreadcrumbSkeleton } from './components/Breadcrumb/Breadcrumb.Skeleton.js';
|
|
64
|
+
export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup.js';
|
|
63
65
|
export { default as CodeSnippetSkeleton } from './components/CodeSnippet/CodeSnippet.Skeleton.js';
|
|
64
66
|
export { default as CodeSnippet } from './components/CodeSnippet/CodeSnippet.js';
|
|
65
67
|
export { default as ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
|
|
@@ -122,7 +124,7 @@ export { ModalFooter } from './components/ComposedModal/ModalFooter.js';
|
|
|
122
124
|
export { ModalHeader } from './components/ComposedModal/ModalHeader.js';
|
|
123
125
|
export { default as DangerButton } from './components/DangerButton/DangerButton.js';
|
|
124
126
|
export { default as DataTable } from './components/DataTable/DataTable.js';
|
|
125
|
-
export {
|
|
127
|
+
export { Table } from './components/DataTable/Table.js';
|
|
126
128
|
export { default as TableActionList } from './components/DataTable/TableActionList.js';
|
|
127
129
|
export { default as TableBatchAction } from './components/DataTable/TableBatchAction.js';
|
|
128
130
|
export { default as TableBatchActions } from './components/DataTable/TableBatchActions.js';
|
|
@@ -176,6 +178,7 @@ export { default as Select } from './components/Select/Select.js';
|
|
|
176
178
|
export { default as SelectItem } from './components/SelectItem/SelectItem.js';
|
|
177
179
|
export { default as SelectItemGroup } from './components/SelectItemGroup/SelectItemGroup.js';
|
|
178
180
|
export { default as Switch } from './components/Switch/Switch.js';
|
|
181
|
+
export { default as IconSwitch } from './components/Switch/IconSwitch.js';
|
|
179
182
|
export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
|
|
180
183
|
export { default as StructuredListSkeleton } from './components/StructuredList/StructuredList.Skeleton.js';
|
|
181
184
|
export { StructuredListBody, StructuredListCell, StructuredListHead, StructuredListInput, StructuredListRow, StructuredListWrapper } from './components/StructuredList/StructuredList.js';
|
|
@@ -25,6 +25,10 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
25
25
|
* Specify whether the Checkbox should be disabled
|
|
26
26
|
*/
|
|
27
27
|
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Provide text for the form group for additional help
|
|
30
|
+
*/
|
|
31
|
+
helperText?: React.ReactNode;
|
|
28
32
|
/**
|
|
29
33
|
* Specify whether the label should be hidden, or not
|
|
30
34
|
*/
|
|
@@ -33,6 +37,22 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
33
37
|
* Specify whether the Checkbox is in an indeterminate state
|
|
34
38
|
*/
|
|
35
39
|
indeterminate?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Specify whether the Checkbox is currently invalid
|
|
42
|
+
*/
|
|
43
|
+
invalid?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Provide the text that is displayed when the Checkbox is in an invalid state
|
|
46
|
+
*/
|
|
47
|
+
invalidText: React.ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* Specify whether the Checkbox is currently invalid
|
|
50
|
+
*/
|
|
51
|
+
warn?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Provide the text that is displayed when the Checkbox is in an invalid state
|
|
54
|
+
*/
|
|
55
|
+
warnText: React.ReactNode;
|
|
36
56
|
/**
|
|
37
57
|
* Provide an optional handler that is called when the internal state of
|
|
38
58
|
* Checkbox changes. This handler is called with event and state info.
|