@carbon/react 1.24.0 → 1.25.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/CodeSnippet/CodeSnippet.js +13 -115
- package/es/components/ComboBox/ComboBox.d.ts +6 -0
- package/es/components/ComboBox/ComboBox.js +19 -172
- package/es/components/ComboButton/index.js +164 -0
- package/es/components/ComposedModal/ComposedModal.js +1 -2
- package/es/components/DataTable/TableToolbar.d.ts +19 -0
- package/es/components/DataTable/TableToolbar.js +1 -1
- package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/es/components/DataTable/TableToolbarContent.d.ts +21 -0
- package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -3
- package/es/components/DataTable/tools/sorting.js +2 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/es/components/Dropdown/Dropdown.d.ts +6 -0
- package/es/components/Dropdown/Dropdown.js +8 -145
- package/es/components/FileUploader/FileUploader.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/es/components/FileUploader/FileUploaderItem.js +2 -1
- package/es/components/FileUploader/Filename.js +8 -2
- package/es/components/FluidTextArea/FluidTextArea.js +12 -1
- package/es/components/IconButton/index.js +1 -0
- package/es/components/ListBox/ListBoxSelection.js +4 -23
- package/es/components/ListBox/next/ListBoxSelection.js +2 -23
- package/es/components/Menu/Menu.js +50 -29
- package/es/components/Menu/MenuItem.js +1 -0
- package/es/components/MenuButton/index.js +127 -0
- package/es/components/Modal/Modal.js +4 -3
- package/es/components/MultiSelect/FilterableMultiSelect.js +31 -137
- package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/MultiSelect.js +48 -26
- package/es/components/Notification/Notification.js +27 -264
- package/es/components/OverflowMenu/OverflowMenu.js +13 -139
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/es/components/OverflowMenuV2/index.js +15 -51
- package/es/components/Popover/index.d.ts +5 -1
- package/es/components/Popover/index.js +37 -9
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -4
- package/es/components/RadioTile/RadioTile.js +6 -6
- package/es/components/Select/Select.d.ts +89 -0
- package/es/components/SelectItem/SelectItem.d.ts +62 -0
- package/es/components/SelectItem/SelectItem.js +2 -4
- package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/es/components/SkeletonText/SkeletonText.js +1 -1
- package/es/components/StructuredList/StructuredList.js +10 -38
- package/es/components/Tabs/Tabs.js +3 -1
- package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/es/components/TextArea/TextArea.Skeleton.js +5 -5
- package/es/components/TextArea/TextArea.d.ts +9 -2
- package/es/components/TextArea/TextArea.js +31 -8
- package/es/components/TextArea/index.js +1 -0
- package/es/components/Toggle/Toggle.js +8 -19
- package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/es/components/Tooltip/DefinitionTooltip.js +2 -2
- package/es/components/Tooltip/Tooltip.d.ts +117 -0
- package/es/components/Tooltip/Tooltip.js +6 -4
- package/es/components/Tooltip/index.d.ts +9 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +5 -3
- package/es/internal/ClickListener.js +1 -2
- package/es/internal/keyboard/match.js +1 -1
- package/es/internal/useAttachedMenu.js +85 -0
- package/es/internal/useDelayedState.d.ts +19 -0
- package/es/internal/useDelayedState.js +7 -3
- package/es/internal/useId.js +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
- package/lib/components/ComboBox/ComboBox.d.ts +6 -0
- package/lib/components/ComboBox/ComboBox.js +18 -171
- package/lib/components/ComboButton/index.js +174 -0
- package/lib/components/ComposedModal/ComposedModal.js +1 -2
- package/lib/components/DataTable/TableToolbar.d.ts +19 -0
- package/lib/components/DataTable/TableToolbar.js +1 -1
- package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/lib/components/DataTable/TableToolbarContent.d.ts +21 -0
- package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -3
- package/lib/components/DataTable/tools/sorting.js +2 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/lib/components/Dropdown/Dropdown.d.ts +6 -0
- package/lib/components/Dropdown/Dropdown.js +7 -144
- package/lib/components/FileUploader/FileUploader.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/lib/components/FileUploader/FileUploaderItem.js +2 -1
- package/lib/components/FileUploader/Filename.js +8 -2
- package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
- package/lib/components/IconButton/index.js +1 -0
- package/lib/components/ListBox/ListBoxSelection.js +4 -23
- package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
- package/lib/components/Menu/Menu.js +50 -29
- package/lib/components/Menu/MenuItem.js +1 -0
- package/lib/components/MenuButton/index.js +137 -0
- package/lib/components/Modal/Modal.js +4 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.js +29 -135
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +47 -25
- package/lib/components/Notification/Notification.js +27 -264
- package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/lib/components/OverflowMenuV2/index.js +13 -49
- package/lib/components/Popover/index.d.ts +5 -1
- package/lib/components/Popover/index.js +37 -9
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +6 -3
- package/lib/components/RadioTile/RadioTile.js +6 -6
- package/lib/components/Select/Select.d.ts +89 -0
- package/lib/components/SelectItem/SelectItem.d.ts +62 -0
- package/lib/components/SelectItem/SelectItem.js +1 -3
- package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/lib/components/SkeletonText/SkeletonText.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +10 -38
- package/lib/components/Tabs/Tabs.js +3 -1
- package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
- package/lib/components/TextArea/TextArea.d.ts +9 -2
- package/lib/components/TextArea/TextArea.js +30 -7
- package/lib/components/TextArea/index.js +2 -0
- package/lib/components/Toggle/Toggle.js +8 -19
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.d.ts +117 -0
- package/lib/components/Tooltip/Tooltip.js +6 -4
- package/lib/components/Tooltip/index.d.ts +9 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +50 -46
- package/lib/internal/ClickListener.js +1 -2
- package/lib/internal/keyboard/match.js +1 -1
- package/lib/internal/useAttachedMenu.js +89 -0
- package/lib/internal/useDelayedState.d.ts +19 -0
- package/lib/internal/useDelayedState.js +7 -3
- package/lib/internal/useId.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,89 @@
|
|
|
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 React, { ChangeEventHandler, ComponentPropsWithRef, ReactNode } from 'react';
|
|
8
|
+
type ExcludedAttributes = 'size';
|
|
9
|
+
interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttributes> {
|
|
10
|
+
/**
|
|
11
|
+
* Provide the contents of your Select
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be applied to the node containing the label and the select box
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optionally provide the default value of the `<select>`
|
|
20
|
+
*/
|
|
21
|
+
defaultValue?: any;
|
|
22
|
+
/**
|
|
23
|
+
* Specify whether the control is disabled
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Provide text that is used alongside the control label for additional help
|
|
28
|
+
*/
|
|
29
|
+
helperText?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Specify whether the label should be hidden, or not
|
|
32
|
+
*/
|
|
33
|
+
hideLabel?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Specify a custom `id` for the `<select>`
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Specify whether you want the inline version of this control
|
|
40
|
+
*/
|
|
41
|
+
inline?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Specify if the currently value is invalid.
|
|
44
|
+
*/
|
|
45
|
+
invalid?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Message which is displayed if the value is invalid.
|
|
48
|
+
*/
|
|
49
|
+
invalidText?: ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Provide label text to be read by screen readers when interacting with the control.
|
|
52
|
+
*/
|
|
53
|
+
labelText?: ReactNode;
|
|
54
|
+
/**
|
|
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
|
+
* @deprecated The `light` prop for `Select` is no longer needed and has been deprecated in v11 in favor of the new `Layer` component.
|
|
59
|
+
* It will be moved in the next major release.
|
|
60
|
+
*/
|
|
61
|
+
light?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Reserved for use with <Pagination> component. Will not render a label for the
|
|
64
|
+
* select since Pagination renders one for us.
|
|
65
|
+
*/
|
|
66
|
+
noLabel?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Provide an optional `onChange` hook that is called each time the value of the underlying `<input>` changes.
|
|
69
|
+
*/
|
|
70
|
+
onChange?: ChangeEventHandler<HTMLSelectElement>;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the select should be read-only
|
|
73
|
+
*/
|
|
74
|
+
readOnly?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Specify the size of the Select Input.
|
|
77
|
+
*/
|
|
78
|
+
size?: 'sm' | 'md' | 'lg';
|
|
79
|
+
/**
|
|
80
|
+
* Specify whether the control is currently in warning state
|
|
81
|
+
*/
|
|
82
|
+
warn?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Provide the text that is displayed when the control is in warning state
|
|
85
|
+
*/
|
|
86
|
+
warnText?: ReactNode;
|
|
87
|
+
}
|
|
88
|
+
declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "className" | "disabled" | "size" | "form" | "slot" | "style" | "title" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "onAnimationEnd" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "inline" | "name" | "readOnly" | "required" | "labelText" | "hideLabel" | "light" | "invalid" | "invalidText" | "warn" | "warnText" | "helperText" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
|
|
89
|
+
export default Select;
|
|
@@ -0,0 +1,62 @@
|
|
|
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 { HTMLAttributes } from 'react';
|
|
9
|
+
export interface SelectItemProps extends HTMLAttributes<HTMLOptionElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to be applied to the node
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify whether the <SelectItem> should be disabled
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Specify whether the <SelectItem> is hidden
|
|
20
|
+
*/
|
|
21
|
+
hidden?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Provide the contents of your <SelectItem>
|
|
24
|
+
*/
|
|
25
|
+
text: string;
|
|
26
|
+
/**
|
|
27
|
+
* Specify the value of the <SelectItem>
|
|
28
|
+
*/
|
|
29
|
+
value: any;
|
|
30
|
+
}
|
|
31
|
+
declare const SelectItem: {
|
|
32
|
+
({ className, value, disabled, hidden, text, ...other }: SelectItemProps): JSX.Element;
|
|
33
|
+
propTypes: {
|
|
34
|
+
/**
|
|
35
|
+
* Specify an optional className to be applied to the node
|
|
36
|
+
*/
|
|
37
|
+
className: PropTypes.Requireable<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Specify whether the <SelectItem> should be disabled
|
|
40
|
+
*/
|
|
41
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Specify whether the <SelectItem> is hidden
|
|
44
|
+
*/
|
|
45
|
+
hidden: PropTypes.Requireable<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Provide the contents of your <SelectItem>
|
|
48
|
+
*/
|
|
49
|
+
text: PropTypes.Validator<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Specify the value of the <SelectItem>
|
|
52
|
+
*/
|
|
53
|
+
value: PropTypes.Validator<any>;
|
|
54
|
+
};
|
|
55
|
+
defaultProps: {
|
|
56
|
+
disabled: boolean;
|
|
57
|
+
hidden: boolean;
|
|
58
|
+
value: string;
|
|
59
|
+
text: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export default SelectItem;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
@@ -14,8 +14,6 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
14
14
|
var _excluded = ["className", "value", "disabled", "hidden", "text"];
|
|
15
15
|
|
|
16
16
|
var SelectItem = function SelectItem(_ref) {
|
|
17
|
-
var _classNames;
|
|
18
|
-
|
|
19
17
|
var className = _ref.className,
|
|
20
18
|
value = _ref.value,
|
|
21
19
|
disabled = _ref.disabled,
|
|
@@ -24,7 +22,7 @@ var SelectItem = function SelectItem(_ref) {
|
|
|
24
22
|
other = _objectWithoutProperties(_ref, _excluded);
|
|
25
23
|
|
|
26
24
|
var prefix = usePrefix();
|
|
27
|
-
var selectItemClasses = cx((
|
|
25
|
+
var selectItemClasses = cx(_objectSpread2(_defineProperty({}, "".concat(prefix, "--select-option"), true), className && _defineProperty({}, className, className)));
|
|
28
26
|
return /*#__PURE__*/React__default.createElement("option", _extends({}, other, {
|
|
29
27
|
className: selectItemClasses,
|
|
30
28
|
value: value,
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { HTMLAttributes, ReactNode } from 'react';
|
|
9
|
+
export interface SelectItemGroupProps extends HTMLAttributes<HTMLOptGroupElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Provide the contents of your <SelectItemGroup>
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be applied to the node
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specify whether the <SelectItemGroup> should be disabled
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Specify the label to be displayed
|
|
24
|
+
*/
|
|
25
|
+
label: string;
|
|
26
|
+
}
|
|
27
|
+
declare const SelectItemGroup: {
|
|
28
|
+
({ children, className, disabled, label, ...other }: SelectItemGroupProps): JSX.Element;
|
|
29
|
+
propTypes: {
|
|
30
|
+
/**
|
|
31
|
+
* Provide the contents of your <SelectItemGroup>
|
|
32
|
+
*/
|
|
33
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
34
|
+
/**
|
|
35
|
+
* Specify an optional className to be applied to the node
|
|
36
|
+
*/
|
|
37
|
+
className: PropTypes.Requireable<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Specify whether the <SelectItemGroup> should be disabled
|
|
40
|
+
*/
|
|
41
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Specify the label to be displayed
|
|
44
|
+
*/
|
|
45
|
+
label: PropTypes.Validator<string>;
|
|
46
|
+
};
|
|
47
|
+
defaultProps: {
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
label: string | undefined;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export default SelectItemGroup;
|
|
@@ -46,7 +46,7 @@ var SkeletonText = function SkeletonText(_ref) {
|
|
|
46
46
|
useIsomorphicEffect(function () {
|
|
47
47
|
refs.current.map(function (item, j) {
|
|
48
48
|
var randomPercentWidth = getRandomInt(0, 75, j) + 'px';
|
|
49
|
-
var randomPxWidth = getRandomInt(widthNum - 75, widthNum, j) + 'px';
|
|
49
|
+
var randomPxWidth = getRandomInt(Math.max(widthNum - 75, 0), widthNum, j) + 'px';
|
|
50
50
|
|
|
51
51
|
if (item) {
|
|
52
52
|
if (widthPercent && paragraph) {
|
|
@@ -13,7 +13,9 @@ import { useId } from '../../internal/useId.js';
|
|
|
13
13
|
import deprecate from '../../prop-types/deprecate.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _StructuredListWrappe;
|
|
17
|
+
|
|
18
|
+
var _excluded = ["children", "selection", "className", "aria-label", "ariaLabel", "isCondensed", "isFlush"],
|
|
17
19
|
_excluded2 = ["children", "className"],
|
|
18
20
|
_excluded3 = ["children", "className"],
|
|
19
21
|
_excluded4 = ["onKeyDown", "children", "className", "head"],
|
|
@@ -27,7 +29,8 @@ function StructuredListWrapper(props) {
|
|
|
27
29
|
var children = props.children,
|
|
28
30
|
selection = props.selection,
|
|
29
31
|
className = props.className,
|
|
30
|
-
ariaLabel = props
|
|
32
|
+
ariaLabel = props['aria-label'],
|
|
33
|
+
deprecatedAriaLabel = props.ariaLabel,
|
|
31
34
|
isCondensed = props.isCondensed,
|
|
32
35
|
isFlush = props.isFlush,
|
|
33
36
|
other = _objectWithoutProperties(props, _excluded);
|
|
@@ -48,46 +51,15 @@ function StructuredListWrapper(props) {
|
|
|
48
51
|
role: "table",
|
|
49
52
|
className: classes
|
|
50
53
|
}, other, {
|
|
51
|
-
"aria-label": ariaLabel
|
|
54
|
+
"aria-label": deprecatedAriaLabel || ariaLabel
|
|
52
55
|
}), children)));
|
|
53
56
|
}
|
|
54
|
-
StructuredListWrapper.propTypes = {
|
|
55
|
-
|
|
56
|
-
* Specify a label to be read by screen readers on the container node
|
|
57
|
-
*/
|
|
58
|
-
ariaLabel: PropTypes.string,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Provide the contents of your StructuredListWrapper
|
|
62
|
-
*/
|
|
63
|
-
children: PropTypes.node,
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Specify an optional className to be applied to the container node
|
|
67
|
-
*/
|
|
68
|
-
className: PropTypes.string,
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Specify if structured list is condensed, default is false
|
|
72
|
-
*/
|
|
73
|
-
isCondensed: PropTypes.bool,
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Specify if structured list is flush, default is false
|
|
77
|
-
*/
|
|
78
|
-
isFlush: PropTypes.bool,
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Specify whether your StructuredListWrapper should have selections
|
|
82
|
-
*/
|
|
83
|
-
selection: PropTypes.bool
|
|
84
|
-
};
|
|
85
|
-
StructuredListWrapper.defaultProps = {
|
|
57
|
+
StructuredListWrapper.propTypes = (_StructuredListWrappe = {}, _defineProperty(_StructuredListWrappe, 'aria-label', PropTypes.string), _defineProperty(_StructuredListWrappe, "ariaLabel", deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _defineProperty(_StructuredListWrappe, "children", PropTypes.node), _defineProperty(_StructuredListWrappe, "className", PropTypes.string), _defineProperty(_StructuredListWrappe, "isCondensed", PropTypes.bool), _defineProperty(_StructuredListWrappe, "isFlush", PropTypes.bool), _defineProperty(_StructuredListWrappe, "selection", PropTypes.bool), _StructuredListWrappe);
|
|
58
|
+
StructuredListWrapper.defaultProps = _defineProperty({
|
|
86
59
|
selection: false,
|
|
87
60
|
isCondensed: false,
|
|
88
|
-
isFlush: false
|
|
89
|
-
|
|
90
|
-
};
|
|
61
|
+
isFlush: false
|
|
62
|
+
}, 'aria-label', 'Structured list section');
|
|
91
63
|
function StructuredListHead(props) {
|
|
92
64
|
var children = props.children,
|
|
93
65
|
className = props.className,
|
|
@@ -11,6 +11,7 @@ import cx from 'classnames';
|
|
|
11
11
|
import debounce from 'lodash.debounce';
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
13
|
import React__default, { useState, useRef, useCallback, useEffect } from 'react';
|
|
14
|
+
import '../Tooltip/DefinitionTooltip.js';
|
|
14
15
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
15
16
|
import { useControllableState } from '../../internal/useControllableState.js';
|
|
16
17
|
import { useEffectOnce } from '../../internal/useEffectOnce.js';
|
|
@@ -20,6 +21,7 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
|
20
21
|
import { getInteractiveContent } from '../../internal/useNoInteractiveChildren.js';
|
|
21
22
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
22
23
|
import { usePressable } from './usePressable.js';
|
|
24
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
23
25
|
import { matches, match } from '../../internal/keyboard/match.js';
|
|
24
26
|
import { ArrowRight, ArrowLeft, Home, End } from '../../internal/keyboard/keys.js';
|
|
25
27
|
|
|
@@ -377,7 +379,7 @@ TabList.propTypes = {
|
|
|
377
379
|
/**
|
|
378
380
|
* Specify whether or not to use the light component variant
|
|
379
381
|
*/
|
|
380
|
-
light: PropTypes.bool,
|
|
382
|
+
light: deprecate(PropTypes.bool, 'The `light` prop for `TabList` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
381
383
|
|
|
382
384
|
/**
|
|
383
385
|
* Provide the props that describe the right overflow button
|
|
@@ -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 TextAreaSkeletonProps extends React.InputHTMLAttributes<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 TextAreaSkeleton: {
|
|
20
|
+
(props: TextAreaSkeletonProps): 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 TextAreaSkeleton;
|
|
33
|
+
export { TextAreaSkeleton };
|
|
@@ -11,12 +11,12 @@ import React__default from 'react';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
var _excluded = ["
|
|
14
|
+
var _excluded = ["className", "hideLabel"];
|
|
15
15
|
|
|
16
|
-
var TextAreaSkeleton = function TextAreaSkeleton(
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
rest = _objectWithoutProperties(
|
|
16
|
+
var TextAreaSkeleton = function TextAreaSkeleton(props) {
|
|
17
|
+
var className = props.className,
|
|
18
|
+
hideLabel = props.hideLabel,
|
|
19
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
20
20
|
|
|
21
21
|
var prefix = usePrefix();
|
|
22
22
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { ReactNodeLike } from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
-
|
|
10
|
-
export interface TextAreaProps extends Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, ExcludedAttributes> {
|
|
9
|
+
export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaElement> {
|
|
11
10
|
/**
|
|
12
11
|
* Provide a custom className that is applied directly to the underlying
|
|
13
12
|
* `<textarea>` node
|
|
@@ -90,6 +89,14 @@ export interface TextAreaProps extends Omit<React.InputHTMLAttributes<HTMLTextAr
|
|
|
90
89
|
* Provide the current value of the `<textarea>`
|
|
91
90
|
*/
|
|
92
91
|
value?: string | number;
|
|
92
|
+
/**
|
|
93
|
+
* Specify whether the control is currently in warning state
|
|
94
|
+
*/
|
|
95
|
+
warn?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Provide the text that is displayed when the control is in warning state
|
|
98
|
+
*/
|
|
99
|
+
warnText?: ReactNodeLike;
|
|
93
100
|
}
|
|
94
101
|
declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<unknown>>;
|
|
95
102
|
export default TextArea;
|
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default, { useContext, useState, useRef } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import deprecate from '../../prop-types/deprecate.js';
|
|
13
|
-
import { WarningFilled } from '@carbon/icons-react';
|
|
13
|
+
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
14
14
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import '../FluidForm/FluidForm.js';
|
|
@@ -19,9 +19,9 @@ import { useAnnouncer } from '../../internal/useAnnouncer.js';
|
|
|
19
19
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
20
20
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
21
21
|
|
|
22
|
-
var _excluded = ["className", "id", "labelText", "hideLabel", "onChange", "onClick", "invalid", "invalidText", "helperText", "light", "placeholder", "enableCounter", "maxCount"];
|
|
22
|
+
var _excluded = ["className", "id", "labelText", "hideLabel", "onChange", "onClick", "invalid", "invalidText", "helperText", "light", "placeholder", "enableCounter", "maxCount", "warn", "warnText"];
|
|
23
23
|
var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRef) {
|
|
24
|
-
var _classNames, _classNames4;
|
|
24
|
+
var _classNames, _classNames4, _classNames5;
|
|
25
25
|
|
|
26
26
|
var className = props.className,
|
|
27
27
|
id = props.id,
|
|
@@ -36,6 +36,9 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRe
|
|
|
36
36
|
placeholder = props.placeholder,
|
|
37
37
|
enableCounter = props.enableCounter,
|
|
38
38
|
maxCount = props.maxCount,
|
|
39
|
+
_props$warn = props.warn,
|
|
40
|
+
warn = _props$warn === void 0 ? false : _props$warn,
|
|
41
|
+
warnText = props.warnText,
|
|
39
42
|
other = _objectWithoutProperties(props, _excluded);
|
|
40
43
|
|
|
41
44
|
var prefix = usePrefix();
|
|
@@ -97,7 +100,13 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRe
|
|
|
97
100
|
}, invalidText, isFluid && /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
98
101
|
className: "".concat(prefix, "--text-area__invalid-icon")
|
|
99
102
|
})) : null;
|
|
100
|
-
var
|
|
103
|
+
var warning = warn ? /*#__PURE__*/React__default.createElement("div", {
|
|
104
|
+
role: "alert",
|
|
105
|
+
className: "".concat(prefix, "--form-requirement")
|
|
106
|
+
}, warnText, isFluid && /*#__PURE__*/React__default.createElement(WarningAltFilled, {
|
|
107
|
+
className: "".concat(prefix, "--text-area__invalid-icon ").concat(prefix, "--text-area__invalid-icon--warning")
|
|
108
|
+
})) : null;
|
|
109
|
+
var textareaClasses = cx("".concat(prefix, "--text-area"), [enabled ? null : className], (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--text-area--light"), light), _defineProperty(_classNames4, "".concat(prefix, "--text-area--invalid"), invalid), _defineProperty(_classNames4, "".concat(prefix, "--text-area--warn"), warn), _classNames4));
|
|
101
110
|
var textareaRef = useRef(null);
|
|
102
111
|
var ref = useMergedRefs([forwardRef, textareaRef]);
|
|
103
112
|
useIsomorphicEffect(function () {
|
|
@@ -122,16 +131,18 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRe
|
|
|
122
131
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
123
132
|
className: "".concat(prefix, "--text-area__label-wrapper")
|
|
124
133
|
}, label, counter), /*#__PURE__*/React__default.createElement("div", {
|
|
125
|
-
className: cx("".concat(prefix, "--text-area__wrapper"),
|
|
134
|
+
className: cx("".concat(prefix, "--text-area__wrapper"), (_classNames5 = {}, _defineProperty(_classNames5, "".concat(prefix, "--text-area__wrapper--readonly"), other.readOnly), _defineProperty(_classNames5, "".concat(prefix, "--text-area__wrapper--warn"), warn), _classNames5)),
|
|
126
135
|
"data-invalid": invalid || null
|
|
127
136
|
}, invalid && !isFluid && /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
128
137
|
className: "".concat(prefix, "--text-area__invalid-icon")
|
|
138
|
+
}), warn && !invalid && !isFluid && /*#__PURE__*/React__default.createElement(WarningAltFilled, {
|
|
139
|
+
className: "".concat(prefix, "--text-area__invalid-icon ").concat(prefix, "--text-area__invalid-icon--warning")
|
|
129
140
|
}), input, /*#__PURE__*/React__default.createElement("span", {
|
|
130
141
|
className: "".concat(prefix, "--text-area__counter-alert"),
|
|
131
142
|
role: "alert"
|
|
132
143
|
}, ariaAnnouncement), isFluid && /*#__PURE__*/React__default.createElement("hr", {
|
|
133
144
|
className: "".concat(prefix, "--text-area__divider")
|
|
134
|
-
}), isFluid && invalid ? error : null), invalid && !isFluid ? error :
|
|
145
|
+
}), isFluid && invalid ? error : null, isFluid && warn && !invalid ? warning : null), !invalid && !warn && !isFluid ? helper : null, invalid && !isFluid ? error : null, warn && !invalid && !isFluid ? warning : null);
|
|
135
146
|
});
|
|
136
147
|
TextArea.displayName = 'TextArea';
|
|
137
148
|
TextArea.propTypes = {
|
|
@@ -233,7 +244,17 @@ TextArea.propTypes = {
|
|
|
233
244
|
/**
|
|
234
245
|
* Provide the current value of the `<textarea>`
|
|
235
246
|
*/
|
|
236
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
247
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Specify whether the control is currently in warning state
|
|
251
|
+
*/
|
|
252
|
+
warn: PropTypes.bool,
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Provide the text that is displayed when the control is in warning state
|
|
256
|
+
*/
|
|
257
|
+
warnText: PropTypes.node
|
|
237
258
|
};
|
|
238
259
|
TextArea.defaultProps = {
|
|
239
260
|
disabled: false,
|
|
@@ -245,7 +266,9 @@ TextArea.defaultProps = {
|
|
|
245
266
|
invalidText: '',
|
|
246
267
|
helperText: '',
|
|
247
268
|
enableCounter: false,
|
|
248
|
-
maxCount: undefined
|
|
269
|
+
maxCount: undefined,
|
|
270
|
+
warn: false,
|
|
271
|
+
warnText: ''
|
|
249
272
|
};
|
|
250
273
|
var TextArea$1 = TextArea;
|
|
251
274
|
|
|
@@ -64,8 +64,8 @@ function Toggle(_ref) {
|
|
|
64
64
|
|
|
65
65
|
var isSm = size === 'sm';
|
|
66
66
|
var sideLabel = hideLabel ? labelText : checked ? labelB : labelA;
|
|
67
|
-
var renderSideLabel = !(hideLabel &&
|
|
68
|
-
var LabelComponent =
|
|
67
|
+
var renderSideLabel = !(hideLabel && !labelText);
|
|
68
|
+
var LabelComponent = labelText ? 'label' : 'div';
|
|
69
69
|
var wrapperClasses = cx("".concat(prefix, "--toggle"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--toggle--disabled"), disabled), _defineProperty(_classNames, "".concat(prefix, "--toggle--readonly"), readOnly), _classNames), className);
|
|
70
70
|
var labelTextClasses = cx("".concat(prefix, "--toggle__label-text"), _defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLabel));
|
|
71
71
|
var appearanceClasses = cx("".concat(prefix, "--toggle__appearance"), _defineProperty({}, "".concat(prefix, "--toggle__appearance--sm"), isSm));
|
|
@@ -75,7 +75,7 @@ function Toggle(_ref) {
|
|
|
75
75
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
76
76
|
React__default.createElement("div", {
|
|
77
77
|
className: wrapperClasses,
|
|
78
|
-
onClick:
|
|
78
|
+
onClick: !labelText ? function (e) {
|
|
79
79
|
// the underlying <button> can only be activated by keyboard as it is visually hidden;
|
|
80
80
|
// therefore, if this event's target is the <button>, it had to be triggered by
|
|
81
81
|
// the keyboard event which already calls handleClick. if we wouldn't catch this, the
|
|
@@ -141,10 +141,7 @@ Toggle.propTypes = {
|
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* If true, the side labels (props.labelA and props.labelB) will be replaced by
|
|
144
|
-
* props.labelText, so that the toggle doesn't render a top label.
|
|
145
|
-
* hide any labels, you can use props['aria-labelledby'] to refer to another element
|
|
146
|
-
* that labels the toggle. props.labelText would no longer be required in that case
|
|
147
|
-
* and can therefore be omitted.
|
|
144
|
+
* props.labelText (if passed), so that the toggle doesn't render a top label.
|
|
148
145
|
*/
|
|
149
146
|
hideLabel: PropTypes.bool,
|
|
150
147
|
|
|
@@ -165,19 +162,11 @@ Toggle.propTypes = {
|
|
|
165
162
|
|
|
166
163
|
/**
|
|
167
164
|
* Provide the text that will be read by a screen reader when visiting this
|
|
168
|
-
* control. This
|
|
165
|
+
* control. This should be provided unless 'aria-labelledby' is set instead
|
|
166
|
+
* or you use an external <label> element with its "for" attribute set to the
|
|
167
|
+
* toggle's id.
|
|
169
168
|
*/
|
|
170
|
-
labelText:
|
|
171
|
-
if (!props['aria-labelledby'] && !props.labelText) {
|
|
172
|
-
return new Error('labelText property is required if no aria-labelledby is provided.');
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
176
|
-
rest[_key - 1] = arguments[_key];
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return PropTypes.node.apply(PropTypes, [props].concat(rest));
|
|
180
|
-
},
|
|
169
|
+
labelText: PropTypes.string,
|
|
181
170
|
|
|
182
171
|
/**
|
|
183
172
|
* Provide an event listener that is called when the control is clicked
|
|
@@ -0,0 +1,52 @@
|
|
|
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 React from 'react';
|
|
8
|
+
import { PopoverAlignment } from '../Popover';
|
|
9
|
+
export interface DefinitionTooltipProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'id' | 'classname' | 'children' | 'type'> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify how the trigger should align with the tooltip
|
|
12
|
+
*/
|
|
13
|
+
align?: PopoverAlignment;
|
|
14
|
+
/**
|
|
15
|
+
* The `children` prop will be used as the value that is being defined
|
|
16
|
+
*/
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Specify an optional className to be applied to the container node
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Specify whether the tooltip should be open when it first renders
|
|
24
|
+
*/
|
|
25
|
+
defaultOpen?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The `definition` prop is used as the content inside of the tooltip that
|
|
28
|
+
* appears when a user interacts with the element rendered by the `children`
|
|
29
|
+
* prop
|
|
30
|
+
*/
|
|
31
|
+
definition: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Provide a value that will be assigned as the id of the tooltip
|
|
34
|
+
*/
|
|
35
|
+
id?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Specifies whether or not the `DefinitionTooltip` should open on hover or not
|
|
38
|
+
*/
|
|
39
|
+
openOnHover?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated [Deprecated in v11] Please use the `definition` prop instead.
|
|
42
|
+
*
|
|
43
|
+
* Provide the text that will be displayed in the tooltip when it is rendered.
|
|
44
|
+
*/
|
|
45
|
+
tooltipText?: React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* The CSS class name of the trigger element
|
|
48
|
+
*/
|
|
49
|
+
triggerClassName?: string;
|
|
50
|
+
}
|
|
51
|
+
declare const DefinitionTooltip: React.FC<DefinitionTooltipProps>;
|
|
52
|
+
export { DefinitionTooltip };
|