@carbon/react 1.31.0-rc.0 → 1.31.1
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/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/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/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +6 -2
- 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/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/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/index.js +2 -2
- 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/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/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.js +6 -2
- 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/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/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/index.js +4 -4
- package/package.json +9 -9
|
@@ -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;
|
|
@@ -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;
|
package/lib/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
require('./feature-flags.js');
|
|
13
|
+
var AspectRatio = require('./components/AspectRatio/AspectRatio.js');
|
|
13
14
|
var Checkbox = require('./components/Checkbox/Checkbox.js');
|
|
14
15
|
var Checkbox_Skeleton = require('./components/Checkbox/Checkbox.Skeleton.js');
|
|
15
16
|
var index$3 = require('./components/ClassPrefix/index.js');
|
|
@@ -31,6 +32,7 @@ var Column = require('./components/Grid/Column.js');
|
|
|
31
32
|
var ColumnHang = require('./components/Grid/ColumnHang.js');
|
|
32
33
|
var Icon_Skeleton = require('./components/Icon/Icon.Skeleton.js');
|
|
33
34
|
var index$6 = require('./components/IdPrefix/index.js');
|
|
35
|
+
var Link = require('./components/Link/Link.js');
|
|
34
36
|
var ListItem = require('./components/ListItem/ListItem.js');
|
|
35
37
|
var index$7 = require('./components/MenuButton/index.js');
|
|
36
38
|
var OrderedList = require('./components/OrderedList/OrderedList.js');
|
|
@@ -73,7 +75,6 @@ var Pagination = require('./components/Pagination/experimental/Pagination.js');
|
|
|
73
75
|
var AccordionItem = require('./components/Accordion/AccordionItem.js');
|
|
74
76
|
var Accordion_Skeleton = require('./components/Accordion/Accordion.Skeleton.js');
|
|
75
77
|
var Accordion = require('./components/Accordion/Accordion.js');
|
|
76
|
-
var AspectRatio = require('./components/AspectRatio/AspectRatio.js');
|
|
77
78
|
var Breadcrumb_Skeleton = require('./components/Breadcrumb/Breadcrumb.Skeleton.js');
|
|
78
79
|
var CheckboxGroup = require('./components/CheckboxGroup/CheckboxGroup.js');
|
|
79
80
|
var CodeSnippet_Skeleton = require('./components/CodeSnippet/CodeSnippet.Skeleton.js');
|
|
@@ -168,7 +169,6 @@ var DatePickerInput = require('./components/DatePickerInput/DatePickerInput.js')
|
|
|
168
169
|
var ErrorBoundaryContext = require('./components/ErrorBoundary/ErrorBoundaryContext.js');
|
|
169
170
|
var FilterableMultiSelect = require('./components/MultiSelect/FilterableMultiSelect.js');
|
|
170
171
|
var FormGroup = require('./components/FormGroup/FormGroup.js');
|
|
171
|
-
var Link = require('./components/Link/Link.js');
|
|
172
172
|
var Menu = require('./components/Menu/Menu.js');
|
|
173
173
|
var MenuItem = require('./components/Menu/MenuItem.js');
|
|
174
174
|
var Modal = require('./components/Modal/Modal.js');
|
|
@@ -226,6 +226,7 @@ var Stack = require('./components/Stack/Stack.js');
|
|
|
226
226
|
|
|
227
227
|
|
|
228
228
|
|
|
229
|
+
exports.AspectRatio = AspectRatio["default"];
|
|
229
230
|
exports.Checkbox = Checkbox["default"];
|
|
230
231
|
exports.CheckboxSkeleton = Checkbox_Skeleton["default"];
|
|
231
232
|
exports.ClassPrefix = index$3.ClassPrefix;
|
|
@@ -246,6 +247,7 @@ exports.Column = Column["default"];
|
|
|
246
247
|
exports.ColumnHang = ColumnHang.ColumnHang;
|
|
247
248
|
exports.IconSkeleton = Icon_Skeleton["default"];
|
|
248
249
|
exports.IdPrefix = index$6.IdPrefix;
|
|
250
|
+
exports.Link = Link["default"];
|
|
249
251
|
exports.ListItem = ListItem["default"];
|
|
250
252
|
exports.MenuButton = index$7.MenuButton;
|
|
251
253
|
exports.OrderedList = OrderedList["default"];
|
|
@@ -300,7 +302,6 @@ exports.unstable_Pagination = Pagination["default"];
|
|
|
300
302
|
exports.AccordionItem = AccordionItem["default"];
|
|
301
303
|
exports.AccordionSkeleton = Accordion_Skeleton["default"];
|
|
302
304
|
exports.Accordion = Accordion["default"];
|
|
303
|
-
exports.AspectRatio = AspectRatio["default"];
|
|
304
305
|
exports.BreadcrumbSkeleton = Breadcrumb_Skeleton["default"];
|
|
305
306
|
exports.CheckboxGroup = CheckboxGroup["default"];
|
|
306
307
|
exports.CodeSnippetSkeleton = CodeSnippet_Skeleton["default"];
|
|
@@ -396,7 +397,6 @@ exports.DatePickerInput = DatePickerInput["default"];
|
|
|
396
397
|
exports.ErrorBoundaryContext = ErrorBoundaryContext.ErrorBoundaryContext;
|
|
397
398
|
exports.FilterableMultiSelect = FilterableMultiSelect["default"];
|
|
398
399
|
exports.FormGroup = FormGroup["default"];
|
|
399
|
-
exports.Link = Link["default"];
|
|
400
400
|
exports.Menu = Menu.Menu;
|
|
401
401
|
exports.MenuItem = MenuItem.MenuItem;
|
|
402
402
|
exports.MenuItemDivider = MenuItem.MenuItemDivider;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.31.
|
|
4
|
+
"version": "1.31.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@babel/runtime": "^7.18.3",
|
|
46
|
-
"@carbon/feature-flags": "^0.15.0
|
|
47
|
-
"@carbon/icons-react": "^11.21.0
|
|
48
|
-
"@carbon/layout": "^11.15.0
|
|
49
|
-
"@carbon/styles": "^1.31.0
|
|
46
|
+
"@carbon/feature-flags": "^0.15.0",
|
|
47
|
+
"@carbon/icons-react": "^11.21.0",
|
|
48
|
+
"@carbon/layout": "^11.15.0",
|
|
49
|
+
"@carbon/styles": "^1.31.0",
|
|
50
50
|
"@carbon/telemetry": "0.1.0",
|
|
51
51
|
"classnames": "2.3.2",
|
|
52
52
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@babel/plugin-transform-react-constant-elements": "^7.17.12",
|
|
73
73
|
"@babel/preset-env": "^7.18.2",
|
|
74
74
|
"@babel/preset-react": "^7.17.12",
|
|
75
|
-
"@carbon/test-utils": "^10.30.0
|
|
76
|
-
"@carbon/themes": "^11.20.0
|
|
75
|
+
"@carbon/test-utils": "^10.30.0",
|
|
76
|
+
"@carbon/themes": "^11.20.0",
|
|
77
77
|
"@rollup/plugin-babel": "^6.0.0",
|
|
78
78
|
"@rollup/plugin-commonjs": "^25.0.0",
|
|
79
79
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"requestanimationframe": "^0.0.23",
|
|
112
112
|
"rimraf": "^5.0.0",
|
|
113
113
|
"rollup": "^2.79.1",
|
|
114
|
-
"rollup-plugin-strip-banner": "^
|
|
114
|
+
"rollup-plugin-strip-banner": "^3.0.0",
|
|
115
115
|
"rtlcss": "^4.0.0",
|
|
116
116
|
"sass": "^1.51.0",
|
|
117
117
|
"sass-loader": "^13.0.0",
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
"**/*.scss",
|
|
134
134
|
"**/*.css"
|
|
135
135
|
],
|
|
136
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "2665483c2b21e23f3a9fae7c4a03218e690a214b"
|
|
137
137
|
}
|