@carbon/react 1.30.0 → 1.31.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/Accordion/Accordion.js +3 -1
- package/es/components/AspectRatio/AspectRatio.d.ts +67 -0
- package/es/components/AspectRatio/AspectRatio.js +2 -2
- package/es/components/AspectRatio/index.d.ts +7 -0
- package/es/components/Button/Button.js +6 -1
- package/es/components/Checkbox/Checkbox.js +2 -2
- package/es/components/CodeSnippet/CodeSnippet.js +1 -0
- package/es/components/ComboButton/index.js +6 -5
- package/es/components/ContainedList/ContainedList.js +12 -4
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +6 -1
- package/es/components/ContentSwitcher/ContentSwitcher.js +10 -1
- package/es/components/CopyButton/CopyButton.js +8 -2
- package/es/components/DataTable/DataTable.js +8 -2
- package/es/components/DataTable/Table.d.ts +6 -1
- package/es/components/DataTable/Table.js +78 -3
- package/es/components/DataTable/TableHeader.js +2 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +1 -2
- package/es/components/DataTableSkeleton/index.d.ts +9 -0
- package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +6 -2
- package/es/components/FileUploader/FileUploaderButton.js +2 -1
- package/es/components/IconButton/index.js +10 -2
- package/es/components/Layout/index.js +118 -0
- package/es/components/Link/Link.d.ts +53 -0
- package/es/components/Link/Link.js +4 -3
- package/es/components/Link/index.d.ts +9 -0
- package/es/components/ListBox/ListBoxPropTypes.d.ts +1 -1
- package/es/components/Menu/MenuItem.js +2 -1
- package/es/components/MenuButton/index.js +7 -4
- package/es/components/OverflowMenu/index.js +9 -1
- package/es/components/OverflowMenu/next/index.js +98 -0
- package/es/components/OverflowMenuV2/index.js +15 -73
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +0 -1
- package/es/components/Search/Search.d.ts +4 -0
- package/es/components/Search/Search.js +8 -2
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Tabs/Tabs.js +5 -1
- package/es/components/Tag/Tag.js +2 -0
- package/es/components/TextArea/TextArea.Skeleton.js +1 -2
- package/es/components/TextArea/TextArea.js +1 -2
- package/es/components/TextArea/index.d.ts +10 -0
- package/es/components/TextInput/PasswordInput.js +1 -2
- package/es/components/TextInput/TextInput.Skeleton.js +1 -2
- package/es/components/TextInput/TextInput.js +5 -4
- package/es/components/TextInput/index.d.ts +4 -0
- package/es/components/TimePicker/TimePicker.d.ts +8 -0
- package/es/components/TimePicker/TimePicker.js +26 -6
- package/es/components/Tooltip/Tooltip.js +4 -2
- package/es/components/UIShell/HeaderMenuItem.d.ts +22 -0
- package/es/components/UIShell/HeaderMenuItem.js +4 -3
- package/es/components/UIShell/HeaderPanel.js +3 -11
- package/es/components/UIShell/Link.d.ts +48 -0
- package/es/components/UIShell/Link.js +30 -19
- package/es/components/UIShell/SideNav.d.ts +2 -1
- package/es/components/UIShell/SideNav.js +25 -7
- package/es/index.d.ts +21 -20
- package/es/index.js +30 -28
- package/lib/components/Accordion/Accordion.js +3 -1
- package/lib/components/AspectRatio/AspectRatio.d.ts +67 -0
- package/lib/components/AspectRatio/AspectRatio.js +2 -2
- package/lib/components/AspectRatio/index.d.ts +7 -0
- package/lib/components/Button/Button.js +6 -1
- package/lib/components/Checkbox/Checkbox.js +2 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
- package/lib/components/ComboButton/index.js +6 -5
- package/lib/components/ContainedList/ContainedList.js +12 -4
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +6 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.js +10 -1
- package/lib/components/CopyButton/CopyButton.js +8 -2
- package/lib/components/DataTable/DataTable.js +8 -2
- package/lib/components/DataTable/Table.d.ts +6 -1
- package/lib/components/DataTable/Table.js +78 -2
- package/lib/components/DataTable/TableHeader.js +2 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +1 -2
- package/lib/components/DataTableSkeleton/index.d.ts +9 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.js +6 -2
- package/lib/components/FileUploader/FileUploaderButton.js +2 -1
- package/lib/components/IconButton/index.js +10 -2
- package/lib/components/Layout/index.js +129 -0
- package/lib/components/Link/Link.d.ts +53 -0
- package/lib/components/Link/Link.js +4 -3
- package/lib/components/Link/index.d.ts +9 -0
- package/lib/components/ListBox/ListBoxPropTypes.d.ts +1 -1
- package/lib/components/Menu/MenuItem.js +2 -1
- package/lib/components/MenuButton/index.js +7 -4
- package/lib/components/OverflowMenu/index.js +13 -1
- package/lib/components/OverflowMenu/next/index.js +108 -0
- package/lib/components/OverflowMenuV2/index.js +14 -74
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +0 -1
- package/lib/components/Search/Search.d.ts +4 -0
- package/lib/components/Search/Search.js +8 -2
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Tabs/Tabs.js +5 -1
- package/lib/components/Tag/Tag.js +2 -0
- package/lib/components/TextArea/TextArea.Skeleton.js +1 -2
- package/lib/components/TextArea/TextArea.js +1 -2
- package/lib/components/TextArea/index.d.ts +10 -0
- package/lib/components/TextInput/PasswordInput.js +1 -2
- package/lib/components/TextInput/TextInput.Skeleton.js +1 -2
- package/lib/components/TextInput/TextInput.js +5 -4
- package/lib/components/TextInput/index.d.ts +4 -0
- package/lib/components/TimePicker/TimePicker.d.ts +8 -0
- package/lib/components/TimePicker/TimePicker.js +26 -6
- package/lib/components/Tooltip/Tooltip.js +4 -2
- package/lib/components/UIShell/HeaderMenuItem.d.ts +22 -0
- package/lib/components/UIShell/HeaderMenuItem.js +3 -2
- package/lib/components/UIShell/HeaderPanel.js +3 -11
- package/lib/components/UIShell/Link.d.ts +48 -0
- package/lib/components/UIShell/Link.js +29 -18
- package/lib/components/UIShell/SideNav.d.ts +2 -1
- package/lib/components/UIShell/SideNav.js +24 -6
- package/lib/index.d.ts +21 -20
- package/lib/index.js +92 -89
- package/package.json +10 -9
- /package/es/components/{Layout → LayoutDirection}/LayoutDirection.js +0 -0
- /package/es/components/{Layout → LayoutDirection}/LayoutDirectionContext.js +0 -0
- /package/es/components/{Layout → LayoutDirection}/useLayoutDirection.js +0 -0
- /package/lib/components/{Layout → LayoutDirection}/LayoutDirection.js +0 -0
- /package/lib/components/{Layout → LayoutDirection}/LayoutDirectionContext.js +0 -0
- /package/lib/components/{Layout → LayoutDirection}/useLayoutDirection.js +0 -0
|
@@ -9,86 +9,26 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
12
|
var React = require('react');
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var Menu = require('../Menu/Menu.js');
|
|
18
|
-
var useId = require('../../internal/useId.js');
|
|
19
|
-
var usePrefix = require('../../internal/usePrefix.js');
|
|
20
|
-
var useAttachedMenu = require('../../internal/useAttachedMenu.js');
|
|
13
|
+
var warning = require('../../internal/warning.js');
|
|
14
|
+
var index = require('../FeatureFlags/index.js');
|
|
15
|
+
var index$1 = require('../OverflowMenu/index.js');
|
|
21
16
|
|
|
22
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
18
|
|
|
24
19
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
26
|
-
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
function OverflowMenuV2(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const triggerRef = React.useRef(null);
|
|
40
|
-
const {
|
|
41
|
-
open,
|
|
42
|
-
x,
|
|
43
|
-
y,
|
|
44
|
-
handleClick,
|
|
45
|
-
handleMousedown,
|
|
46
|
-
handleClose
|
|
47
|
-
} = useAttachedMenu.useAttachedMenu(triggerRef);
|
|
48
|
-
const containerClasses = cx__default["default"](`${prefix}--overflow-menu__container`);
|
|
49
|
-
const triggerClasses = cx__default["default"](`${prefix}--overflow-menu`, {
|
|
50
|
-
[`${prefix}--overflow-menu--open`]: open,
|
|
51
|
-
[className]: className
|
|
52
|
-
}, size !== defaultSize && `${prefix}--overflow-menu--${size}`);
|
|
53
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
54
|
-
className: containerClasses,
|
|
55
|
-
"aria-owns": id
|
|
56
|
-
}, /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
57
|
-
type: "button",
|
|
58
|
-
"aria-haspopup": true,
|
|
59
|
-
"aria-expanded": open,
|
|
60
|
-
className: triggerClasses,
|
|
61
|
-
onClick: handleClick,
|
|
62
|
-
onMouseDown: handleMousedown,
|
|
63
|
-
ref: triggerRef
|
|
64
|
-
}), /*#__PURE__*/React__default["default"].createElement(IconElement, {
|
|
65
|
-
className: `${prefix}--overflow-menu__icon`
|
|
66
|
-
})), /*#__PURE__*/React__default["default"].createElement(Menu.Menu, {
|
|
67
|
-
id: id,
|
|
68
|
-
size: size,
|
|
69
|
-
open: open,
|
|
70
|
-
onClose: handleClose,
|
|
71
|
-
x: x,
|
|
72
|
-
y: y
|
|
73
|
-
}, children));
|
|
21
|
+
let didWarnAboutDeprecation = false;
|
|
22
|
+
function OverflowMenuV2(props) {
|
|
23
|
+
if (process.env.NODE_ENV !== "production") {
|
|
24
|
+
process.env.NODE_ENV !== "production" ? warning.warning(didWarnAboutDeprecation, '`<OverflowMenuV2>` is deprecated and will be removed in the next major version. Use `<OverflowMenu>` with the `enable-v12-overflowmenu` feature flag instead.') : void 0;
|
|
25
|
+
didWarnAboutDeprecation = true;
|
|
26
|
+
}
|
|
27
|
+
return /*#__PURE__*/React__default["default"].createElement(index.FeatureFlags, {
|
|
28
|
+
flags: {
|
|
29
|
+
'enable-v12-overflowmenu': true
|
|
30
|
+
}
|
|
31
|
+
}, /*#__PURE__*/React__default["default"].createElement(index$1["default"], props));
|
|
74
32
|
}
|
|
75
|
-
OverflowMenuV2.propTypes = {
|
|
76
|
-
/**
|
|
77
|
-
* A collection of MenuItems to be rendered within this OverflowMenu.
|
|
78
|
-
*/
|
|
79
|
-
children: PropTypes__default["default"].node,
|
|
80
|
-
/**
|
|
81
|
-
* Additional CSS class names for the trigger button.
|
|
82
|
-
*/
|
|
83
|
-
className: PropTypes__default["default"].string,
|
|
84
|
-
/**
|
|
85
|
-
* Otionally provide a custom icon to be rendered on the trigger button.
|
|
86
|
-
*/
|
|
87
|
-
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
88
|
-
/**
|
|
89
|
-
* Specify the size of the menu, from a list of available sizes.
|
|
90
|
-
*/
|
|
91
|
-
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg'])
|
|
92
|
-
};
|
|
93
33
|
|
|
94
34
|
exports.OverflowMenuV2 = OverflowMenuV2;
|
|
@@ -116,7 +116,6 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
116
116
|
className: fieldsetClasses,
|
|
117
117
|
disabled: disabled,
|
|
118
118
|
"data-invalid": invalid ? true : undefined,
|
|
119
|
-
"aria-readonly": readOnly,
|
|
120
119
|
"aria-describedby": showHelper && helperText ? helperId : undefined
|
|
121
120
|
}, rest), legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
|
|
122
121
|
className: `${prefix}--label`
|
|
@@ -28,6 +28,10 @@ export interface SearchProps extends InputPropsBase {
|
|
|
28
28
|
* Specify whether the `<input>` should be disabled
|
|
29
29
|
*/
|
|
30
30
|
disabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Specify whether or not ExpandableSearch should render expanded or not
|
|
33
|
+
*/
|
|
34
|
+
isExpanded?: boolean;
|
|
31
35
|
/**
|
|
32
36
|
* Specify a custom `id` for the input
|
|
33
37
|
*/
|
|
@@ -39,6 +39,7 @@ const Search = /*#__PURE__*/React__default["default"].forwardRef(function Search
|
|
|
39
39
|
closeButtonLabelText = 'Clear search input',
|
|
40
40
|
defaultValue,
|
|
41
41
|
disabled,
|
|
42
|
+
isExpanded = true,
|
|
42
43
|
id,
|
|
43
44
|
labelText,
|
|
44
45
|
// @ts-expect-error: deprecated prop
|
|
@@ -55,6 +56,7 @@ const Search = /*#__PURE__*/React__default["default"].forwardRef(function Search
|
|
|
55
56
|
value,
|
|
56
57
|
...rest
|
|
57
58
|
} = _ref;
|
|
59
|
+
const hasPropValue = value || defaultValue ? true : false;
|
|
58
60
|
const prefix = usePrefix.usePrefix();
|
|
59
61
|
const {
|
|
60
62
|
isFluid
|
|
@@ -64,7 +66,7 @@ const Search = /*#__PURE__*/React__default["default"].forwardRef(function Search
|
|
|
64
66
|
const inputId = useId.useId('search-input');
|
|
65
67
|
const uniqueId = id || inputId;
|
|
66
68
|
const searchId = `${uniqueId}-search`;
|
|
67
|
-
const [hasContent, setHasContent] = React.useState(
|
|
69
|
+
const [hasContent, setHasContent] = React.useState(hasPropValue || false);
|
|
68
70
|
const [prevValue, setPrevValue] = React.useState(value);
|
|
69
71
|
const searchClasses = cx__default["default"]({
|
|
70
72
|
[`${prefix}--search`]: true,
|
|
@@ -77,7 +79,7 @@ const Search = /*#__PURE__*/React__default["default"].forwardRef(function Search
|
|
|
77
79
|
}, className);
|
|
78
80
|
const clearClasses = cx__default["default"]({
|
|
79
81
|
[`${prefix}--search-close`]: true,
|
|
80
|
-
[`${prefix}--search-close--hidden`]: !hasContent
|
|
82
|
+
[`${prefix}--search-close--hidden`]: !hasContent || !isExpanded
|
|
81
83
|
});
|
|
82
84
|
if (value !== prevValue) {
|
|
83
85
|
setHasContent(!!value);
|
|
@@ -172,6 +174,10 @@ Search.propTypes = {
|
|
|
172
174
|
* Specify a custom `id` for the input
|
|
173
175
|
*/
|
|
174
176
|
id: PropTypes__default["default"].string,
|
|
177
|
+
/**
|
|
178
|
+
* Specify whether or not ExpandableSearch should render expanded or not
|
|
179
|
+
*/
|
|
180
|
+
isExpanded: PropTypes__default["default"].bool,
|
|
175
181
|
/**
|
|
176
182
|
* Provide the label text for the Search icon
|
|
177
183
|
*/
|
|
@@ -85,5 +85,5 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
|
|
|
85
85
|
*/
|
|
86
86
|
warnText?: ReactNode;
|
|
87
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" | "
|
|
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" | "invalid" | "labelText" | "helperText" | "invalidText" | "hideLabel" | "warn" | "warnText" | "light" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
|
|
89
89
|
export default Select;
|
|
@@ -552,7 +552,11 @@ const Tab = /*#__PURE__*/React__default["default"].forwardRef(function Tab(_ref5
|
|
|
552
552
|
type: "button"
|
|
553
553
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
554
554
|
className: `${prefix}--tabs__nav-item-label-wrapper`
|
|
555
|
-
}, /*#__PURE__*/React__default["default"].createElement("
|
|
555
|
+
}, dismissable && Icon && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
556
|
+
className: `${prefix}--tabs__nav-item--icon-left`
|
|
557
|
+
}, /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
558
|
+
size: 16
|
|
559
|
+
})), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
556
560
|
className: `${prefix}--tabs__nav-item-label`
|
|
557
561
|
}, children), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
558
562
|
className: cx__default["default"](`${prefix}--tabs__nav-item--icon`, {
|
|
@@ -59,6 +59,8 @@ const Tag = _ref => {
|
|
|
59
59
|
[`${prefix}--tag--disabled`]: disabled,
|
|
60
60
|
[`${prefix}--tag--filter`]: filter,
|
|
61
61
|
[`${prefix}--tag--${size}`]: size,
|
|
62
|
+
// TODO: V12 - Remove this class
|
|
63
|
+
[`${prefix}--layout--size-${size}`]: size,
|
|
62
64
|
[`${prefix}--tag--${type}`]: type,
|
|
63
65
|
[`${prefix}--tag--interactive`]: other.onClick && !filter
|
|
64
66
|
});
|
|
@@ -46,7 +46,6 @@ TextAreaSkeleton.propTypes = {
|
|
|
46
46
|
*/
|
|
47
47
|
hideLabel: PropTypes__default["default"].bool
|
|
48
48
|
};
|
|
49
|
-
var TextAreaSkeleton$1 = TextAreaSkeleton;
|
|
50
49
|
|
|
51
50
|
exports.TextAreaSkeleton = TextAreaSkeleton;
|
|
52
|
-
exports["default"] = TextAreaSkeleton
|
|
51
|
+
exports["default"] = TextAreaSkeleton;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 TextArea from './TextArea';
|
|
8
|
+
export { default as TextAreaSkeleton } from './TextArea.Skeleton';
|
|
9
|
+
export default TextArea;
|
|
10
|
+
export { TextArea };
|
|
@@ -46,7 +46,6 @@ TextInputSkeleton.propTypes = {
|
|
|
46
46
|
*/
|
|
47
47
|
hideLabel: PropTypes__default["default"].bool
|
|
48
48
|
};
|
|
49
|
-
var TextInputSkeleton$1 = TextInputSkeleton;
|
|
50
49
|
|
|
51
50
|
exports.TextInputSkeleton = TextInputSkeleton;
|
|
52
|
-
exports["default"] = TextInputSkeleton
|
|
51
|
+
exports["default"] = TextInputSkeleton;
|
|
@@ -44,7 +44,7 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef(function Tex
|
|
|
44
44
|
onClick = () => {},
|
|
45
45
|
placeholder,
|
|
46
46
|
readOnly,
|
|
47
|
-
size
|
|
47
|
+
size,
|
|
48
48
|
type = 'text',
|
|
49
49
|
warn = false,
|
|
50
50
|
warnText,
|
|
@@ -71,7 +71,9 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef(function Tex
|
|
|
71
71
|
[`${prefix}--text-input--light`]: light,
|
|
72
72
|
[`${prefix}--text-input--invalid`]: normalizedProps.invalid,
|
|
73
73
|
[`${prefix}--text-input--warning`]: normalizedProps.warn,
|
|
74
|
-
[`${prefix}--text-input--${size}`]: size
|
|
74
|
+
[`${prefix}--text-input--${size}`]: size,
|
|
75
|
+
// TODO: V12 - Remove this class
|
|
76
|
+
[`${prefix}--layout--size-${size}`]: size
|
|
75
77
|
});
|
|
76
78
|
const sharedTextInputProps = {
|
|
77
79
|
id,
|
|
@@ -270,6 +272,5 @@ TextInput.propTypes = {
|
|
|
270
272
|
*/
|
|
271
273
|
warnText: PropTypes__default["default"].node
|
|
272
274
|
};
|
|
273
|
-
var TextInput$1 = TextInput;
|
|
274
275
|
|
|
275
|
-
exports["default"] = TextInput
|
|
276
|
+
exports["default"] = TextInput;
|
|
@@ -36,6 +36,14 @@ export interface TimePickerProps extends Omit<ReactAttr<HTMLInputElement>, Exclu
|
|
|
36
36
|
* Provide the text that is displayed when the control is in an invalid state
|
|
37
37
|
*/
|
|
38
38
|
invalidText?: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Specify a warning message
|
|
41
|
+
*/
|
|
42
|
+
warning?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Provide the text that is displayed when the control is in an warning state
|
|
45
|
+
*/
|
|
46
|
+
warningText?: React.ReactNode;
|
|
39
47
|
/**
|
|
40
48
|
* Provide the text that will be read by a screen reader when visiting this
|
|
41
49
|
* control
|
|
@@ -15,6 +15,7 @@ var PropTypes = require('prop-types');
|
|
|
15
15
|
var React = require('react');
|
|
16
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
17
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
18
|
+
var iconsReact = require('@carbon/icons-react');
|
|
18
19
|
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
21
|
|
|
@@ -31,6 +32,8 @@ const TimePicker = /*#__PURE__*/React__default["default"].forwardRef(function Ti
|
|
|
31
32
|
id,
|
|
32
33
|
invalidText = 'Invalid time format.',
|
|
33
34
|
invalid = false,
|
|
35
|
+
warningText = 'Warning message.',
|
|
36
|
+
warning = false,
|
|
34
37
|
labelText,
|
|
35
38
|
light = false,
|
|
36
39
|
maxLength = 5,
|
|
@@ -75,12 +78,14 @@ const TimePicker = /*#__PURE__*/React__default["default"].forwardRef(function Ti
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
const timePickerInputClasses = cx__default["default"](`${prefix}--time-picker__input-field`, `${prefix}--text-input`, [className], {
|
|
78
|
-
[`${prefix}--text-input--light`]: light
|
|
81
|
+
[`${prefix}--text-input--light`]: light,
|
|
82
|
+
[`${prefix}--time-picker__input-field-error`]: invalid || warning
|
|
79
83
|
});
|
|
80
84
|
const timePickerClasses = cx__default["default"]({
|
|
81
85
|
[`${prefix}--time-picker`]: true,
|
|
82
86
|
[`${prefix}--time-picker--light`]: light,
|
|
83
87
|
[`${prefix}--time-picker--invalid`]: invalid,
|
|
88
|
+
[`${prefix}--time-picker--warning`]: warning,
|
|
84
89
|
[`${prefix}--time-picker--readonly`]: readOnly,
|
|
85
90
|
[`${prefix}--time-picker--${size}`]: size,
|
|
86
91
|
...(className && {
|
|
@@ -95,9 +100,6 @@ const TimePicker = /*#__PURE__*/React__default["default"].forwardRef(function Ti
|
|
|
95
100
|
htmlFor: id,
|
|
96
101
|
className: labelClasses
|
|
97
102
|
}, labelText) : null;
|
|
98
|
-
const error = invalid ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
99
|
-
className: `${prefix}--form-requirement`
|
|
100
|
-
}, invalidText) : null;
|
|
101
103
|
function getInternalPickerSelects() {
|
|
102
104
|
const readOnlyEventHandlers = {
|
|
103
105
|
onMouseDown: evt => {
|
|
@@ -150,7 +152,17 @@ const TimePicker = /*#__PURE__*/React__default["default"].forwardRef(function Ti
|
|
|
150
152
|
ref: ref,
|
|
151
153
|
type: type,
|
|
152
154
|
value: value
|
|
153
|
-
}, rest, readOnlyProps))
|
|
155
|
+
}, rest, readOnlyProps)), (invalid || warning) && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
156
|
+
className: `${prefix}--time-picker__error__icon`
|
|
157
|
+
}, invalid ? /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
158
|
+
className: `${prefix}--checkbox__invalid-icon`,
|
|
159
|
+
size: 16
|
|
160
|
+
}) : /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningAltFilled, {
|
|
161
|
+
className: `${prefix}--text-input__invalid-icon--warning`,
|
|
162
|
+
size: 16
|
|
163
|
+
}))), getInternalPickerSelects()), (invalid || warning) && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
164
|
+
className: `${prefix}--form-requirement`
|
|
165
|
+
}, invalid ? invalidText : warningText));
|
|
154
166
|
});
|
|
155
167
|
TimePicker.propTypes = {
|
|
156
168
|
/**
|
|
@@ -232,7 +244,15 @@ TimePicker.propTypes = {
|
|
|
232
244
|
/**
|
|
233
245
|
* Specify the value of the `<input>`
|
|
234
246
|
*/
|
|
235
|
-
value: PropTypes__default["default"].string
|
|
247
|
+
value: PropTypes__default["default"].string,
|
|
248
|
+
/**
|
|
249
|
+
* Specify a warning message
|
|
250
|
+
*/
|
|
251
|
+
warning: PropTypes__default["default"].bool,
|
|
252
|
+
/**
|
|
253
|
+
* Provide the text that is displayed when the control is in an warning state
|
|
254
|
+
*/
|
|
255
|
+
warningText: PropTypes__default["default"].node
|
|
236
256
|
};
|
|
237
257
|
var TimePicker$1 = TimePicker;
|
|
238
258
|
|
|
@@ -104,10 +104,12 @@ function Tooltip(_ref) {
|
|
|
104
104
|
onMouseLeave: onMouseLeave,
|
|
105
105
|
open: open,
|
|
106
106
|
ref: containerRef
|
|
107
|
-
}),
|
|
107
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
108
|
+
className: `${prefix}--tooltip-trigger__wrapper`
|
|
109
|
+
}, child !== undefined ? /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
108
110
|
...triggerProps,
|
|
109
111
|
...getChildEventHandlers(child.props)
|
|
110
|
-
}) : null, /*#__PURE__*/React__default["default"].createElement(index.PopoverContent, {
|
|
112
|
+
}) : null), /*#__PURE__*/React__default["default"].createElement(index.PopoverContent, {
|
|
111
113
|
"aria-hidden": "true",
|
|
112
114
|
className: `${prefix}--tooltip-content`,
|
|
113
115
|
id: id,
|
|
@@ -0,0 +1,22 @@
|
|
|
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, { type ComponentProps, type ReactNode, ElementType } from 'react';
|
|
8
|
+
import { LinkProps } from './Link';
|
|
9
|
+
type HeaderMenuItemProps<E extends ElementType> = LinkProps<E> & {
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
isActive?: boolean | undefined;
|
|
12
|
+
isCurrentPage?: boolean | undefined;
|
|
13
|
+
'aria-current'?: string | undefined;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
role?: ComponentProps<'li'>['role'];
|
|
16
|
+
tabIndex?: number | undefined;
|
|
17
|
+
};
|
|
18
|
+
declare const HeaderMenuItem: (<E extends React.ElementType<any> = "a">(props: HeaderMenuItemProps<E>) => JSX.Element) & {
|
|
19
|
+
displayName?: string | undefined;
|
|
20
|
+
propTypes?: React.WeakValidationMap<HeaderMenuItemProps<any>> | undefined;
|
|
21
|
+
};
|
|
22
|
+
export default HeaderMenuItem;
|
|
@@ -23,7 +23,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
23
23
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
24
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
function HeaderMenuItemRenderFunction(_ref, ref) {
|
|
27
27
|
let {
|
|
28
28
|
className,
|
|
29
29
|
isActive,
|
|
@@ -55,7 +55,8 @@ const HeaderMenuItem = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
55
55
|
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
56
56
|
className: `${prefix}--text-truncate--end`
|
|
57
57
|
}, children)));
|
|
58
|
-
}
|
|
58
|
+
}
|
|
59
|
+
const HeaderMenuItem = /*#__PURE__*/React.forwardRef(HeaderMenuItemRenderFunction);
|
|
59
60
|
HeaderMenuItem.displayName = 'HeaderMenuItem';
|
|
60
61
|
HeaderMenuItem.propTypes = {
|
|
61
62
|
/**
|
|
@@ -13,7 +13,6 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var React = require('react');
|
|
14
14
|
var cx = require('classnames');
|
|
15
15
|
var PropTypes = require('prop-types');
|
|
16
|
-
var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
|
|
17
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
17
|
|
|
19
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -24,33 +23,26 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
24
23
|
|
|
25
24
|
const HeaderPanel = /*#__PURE__*/React__default["default"].forwardRef(function HeaderPanel(_ref, ref) {
|
|
26
25
|
let {
|
|
27
|
-
'aria-label': ariaLabel,
|
|
28
|
-
'aria-labelledby': ariaLabelledBy,
|
|
29
26
|
children,
|
|
30
27
|
className: customClassName,
|
|
31
28
|
expanded,
|
|
32
29
|
...other
|
|
33
30
|
} = _ref;
|
|
34
31
|
const prefix = usePrefix.usePrefix();
|
|
35
|
-
const accessibilityLabel = {
|
|
36
|
-
'aria-label': ariaLabel,
|
|
37
|
-
'aria-labelledby': ariaLabelledBy
|
|
38
|
-
};
|
|
39
32
|
const className = cx__default["default"](`${prefix}--header-panel`, {
|
|
40
33
|
[`${prefix}--header-panel--expanded`]: expanded,
|
|
41
34
|
[customClassName]: !!customClassName
|
|
42
35
|
});
|
|
43
36
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, other, {
|
|
44
|
-
className: className
|
|
45
|
-
}, accessibilityLabel, {
|
|
37
|
+
className: className,
|
|
46
38
|
ref: ref
|
|
47
39
|
}), children);
|
|
48
40
|
});
|
|
49
41
|
HeaderPanel.propTypes = {
|
|
50
42
|
/**
|
|
51
|
-
*
|
|
43
|
+
* The content that will render inside of the `HeaderPanel`
|
|
52
44
|
*/
|
|
53
|
-
|
|
45
|
+
children: PropTypes__default["default"].node,
|
|
54
46
|
/**
|
|
55
47
|
* Optionally provide a custom class to apply to the underlying `<li>` node
|
|
56
48
|
*/
|
|
@@ -0,0 +1,48 @@
|
|
|
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, { type ElementType, type Ref } from 'react';
|
|
9
|
+
import { type PolymorphicProps } from '../../types/common';
|
|
10
|
+
type LinkBaseProps<E extends ElementType> = {
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `as` instead
|
|
13
|
+
*/
|
|
14
|
+
element?: E | undefined;
|
|
15
|
+
ref?: Ref<E>;
|
|
16
|
+
};
|
|
17
|
+
export type LinkProps<E extends ElementType> = PolymorphicProps<E, LinkBaseProps<E>>;
|
|
18
|
+
/**
|
|
19
|
+
* Link is a custom component that allows us to supporting rendering elements
|
|
20
|
+
* other than `a` in our markup. The goal is to allow users to support passing
|
|
21
|
+
* in their own components to support use-cases like `react-router` or
|
|
22
|
+
* `@reach/router`
|
|
23
|
+
*/
|
|
24
|
+
declare const Link: (<E extends React.ElementType<any> = "a">(props: LinkProps<E>) => JSX.Element) & {
|
|
25
|
+
displayName?: string | undefined;
|
|
26
|
+
propTypes?: React.WeakValidationMap<LinkProps<any>> | undefined;
|
|
27
|
+
};
|
|
28
|
+
declare const LinkPropTypes: {
|
|
29
|
+
/**
|
|
30
|
+
* Provide a custom element or component to render the top-level node for the
|
|
31
|
+
* component.
|
|
32
|
+
*/
|
|
33
|
+
as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
|
|
34
|
+
/**
|
|
35
|
+
* The base element to use to build the link. Defaults to `a`, can also accept
|
|
36
|
+
* alternative tag names or custom components like `Link` from `react-router`.
|
|
37
|
+
* @deprecated Use `as` instead
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
element: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
41
|
+
/**
|
|
42
|
+
* Property to indicate if the side nav container is open (or not). Use to
|
|
43
|
+
* keep local state and styling in step with the SideNav expansion state.
|
|
44
|
+
*/
|
|
45
|
+
isSideNavExpanded: PropTypes.Requireable<boolean>;
|
|
46
|
+
};
|
|
47
|
+
export { LinkPropTypes };
|
|
48
|
+
export default Link;
|
|
@@ -9,38 +9,53 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
12
13
|
var PropTypes = require('prop-types');
|
|
13
14
|
var React = require('react');
|
|
15
|
+
var deprecate = require('../../prop-types/deprecate.js');
|
|
14
16
|
|
|
15
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
18
|
|
|
17
19
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
18
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
21
|
|
|
22
|
+
// Note: Maybe we should use `as` instead of `element`? `as` appears to be
|
|
23
|
+
// standard and is used in other places in this project.
|
|
24
|
+
function LinkRenderFunction(_ref, ref) {
|
|
25
|
+
let {
|
|
26
|
+
element,
|
|
27
|
+
as: BaseComponent,
|
|
28
|
+
// Captured here to prevent it from being passed into the created element.
|
|
29
|
+
// See https://github.com/carbon-design-system/carbon/issues/3970
|
|
30
|
+
isSideNavExpanded: _isSideNavExpanded,
|
|
31
|
+
...rest
|
|
32
|
+
} = _ref;
|
|
33
|
+
const BaseComponentAsAny = BaseComponent ?? element ?? 'a';
|
|
34
|
+
return /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({
|
|
35
|
+
ref: ref
|
|
36
|
+
}, rest));
|
|
37
|
+
}
|
|
38
|
+
|
|
20
39
|
/**
|
|
21
40
|
* Link is a custom component that allows us to supporting rendering elements
|
|
22
41
|
* other than `a` in our markup. The goal is to allow users to support passing
|
|
23
42
|
* in their own components to support use-cases like `react-router` or
|
|
24
43
|
* `@reach/router`
|
|
25
44
|
*/
|
|
26
|
-
const Link = /*#__PURE__*/
|
|
27
|
-
const {
|
|
28
|
-
element,
|
|
29
|
-
isSideNavExpanded,
|
|
30
|
-
// eslint-disable-line no-unused-vars
|
|
31
|
-
...rest
|
|
32
|
-
} = props;
|
|
33
|
-
return /*#__PURE__*/React__default["default"].createElement(element, {
|
|
34
|
-
...rest,
|
|
35
|
-
ref
|
|
36
|
-
});
|
|
37
|
-
});
|
|
45
|
+
const Link = /*#__PURE__*/React.forwardRef(LinkRenderFunction);
|
|
38
46
|
const LinkPropTypes = {
|
|
47
|
+
/**
|
|
48
|
+
* Provide a custom element or component to render the top-level node for the
|
|
49
|
+
* component.
|
|
50
|
+
*/
|
|
51
|
+
as: PropTypes__default["default"].elementType,
|
|
39
52
|
/**
|
|
40
53
|
* The base element to use to build the link. Defaults to `a`, can also accept
|
|
41
54
|
* alternative tag names or custom components like `Link` from `react-router`.
|
|
55
|
+
* @deprecated Use `as` instead
|
|
56
|
+
*
|
|
42
57
|
*/
|
|
43
|
-
element: PropTypes__default["default"].elementType,
|
|
58
|
+
element: deprecate["default"](PropTypes__default["default"].elementType, 'The `element` prop for `Link` has been deprecated. Please use `as` ' + 'instead. This will be removed in the next major release.'),
|
|
44
59
|
/**
|
|
45
60
|
* Property to indicate if the side nav container is open (or not). Use to
|
|
46
61
|
* keep local state and styling in step with the SideNav expansion state.
|
|
@@ -49,10 +64,6 @@ const LinkPropTypes = {
|
|
|
49
64
|
};
|
|
50
65
|
Link.displayName = 'Link';
|
|
51
66
|
Link.propTypes = LinkPropTypes;
|
|
52
|
-
Link.defaultProps = {
|
|
53
|
-
element: 'a'
|
|
54
|
-
};
|
|
55
|
-
var Link$1 = Link;
|
|
56
67
|
|
|
57
68
|
exports.LinkPropTypes = LinkPropTypes;
|
|
58
|
-
exports["default"] = Link
|
|
69
|
+
exports["default"] = Link;
|