@carbon/react 1.78.2 → 1.79.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +835 -835
- package/es/components/Accordion/AccordionItem.js +2 -2
- package/es/components/Button/Button.d.ts +2 -3
- package/es/components/Button/Button.js +29 -19
- package/es/components/Button/ButtonBase.js +3 -1
- package/es/components/ChatButton/ChatButton.d.ts +2 -3
- package/es/components/ChatButton/ChatButton.js +1 -2
- package/es/components/ComboBox/ComboBox.js +34 -24
- package/es/components/ComposedModal/ComposedModal.js +65 -51
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
- package/es/components/ContentSwitcher/ContentSwitcher.js +3 -3
- package/es/components/DataTable/TableBatchAction.d.ts +3 -3
- package/es/components/DataTable/TableBatchAction.js +1 -1
- package/es/components/DataTable/TableContainer.d.ts +1 -1
- package/es/components/DataTable/TableContainer.js +5 -4
- package/es/components/DataTable/TableExpandHeader.d.ts +6 -5
- package/es/components/DataTable/TableToolbarMenu.d.ts +2 -2
- package/es/components/DataTable/TableToolbarMenu.js +1 -1
- package/es/components/DatePicker/DatePicker.js +2 -2
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
- package/es/components/Dialog/index.d.ts +42 -4
- package/es/components/Dialog/index.js +177 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +2 -2
- package/es/components/FeatureFlags/index.d.ts +3 -1
- package/es/components/FeatureFlags/index.js +3 -0
- package/es/components/FileUploader/FileUploader.d.ts +1 -1
- package/es/components/FileUploader/FileUploader.js +2 -2
- package/es/components/FileUploader/FileUploaderButton.js +2 -2
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +6 -4
- package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/Grid/CSSGrid.js +18 -14
- package/es/components/Grid/Column.d.ts +2 -2
- package/es/components/Grid/Column.js +7 -8
- package/es/components/Grid/FlexGrid.js +7 -6
- package/es/components/Grid/GridTypes.d.ts +5 -3
- package/es/components/IconButton/index.d.ts +2 -2
- package/es/components/IconButton/index.js +4 -4
- package/es/components/Layer/index.d.ts +4 -6
- package/es/components/Layer/index.js +5 -6
- package/es/components/Link/Link.d.ts +2 -3
- package/es/components/Link/Link.js +1 -2
- package/es/components/ListBox/ListBoxMenuItem.d.ts +3 -3
- package/es/components/ListBox/ListBoxMenuItem.js +37 -15
- package/es/components/Menu/Menu.js +2 -2
- package/es/components/Menu/MenuItem.d.ts +2 -2
- package/es/components/Menu/MenuItem.js +3 -3
- package/es/components/Modal/Modal.js +121 -49
- package/es/components/ModalWrapper/ModalWrapper.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
- package/es/components/MultiSelect/MultiSelect.js +2 -2
- package/es/components/MultiSelect/index.d.ts +1 -1
- package/es/components/MultiSelect/index.js +1 -8
- package/es/components/Notification/Notification.d.ts +5 -13
- package/es/components/Notification/Notification.js +3 -4
- package/es/components/OverflowMenu/OverflowMenu.d.ts +22 -201
- package/es/components/OverflowMenu/OverflowMenu.js +269 -338
- package/es/components/OverflowMenu/index.d.ts +5 -5
- package/es/components/OverflowMenu/index.js +2 -2
- package/es/components/OverflowMenu/next/index.d.ts +4 -4
- package/es/components/OverflowMenu/next/index.js +1 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/es/components/ProgressIndicator/ProgressIndicator.js +2 -2
- package/es/components/RadioTile/RadioTile.js +2 -2
- package/es/components/Search/Search.d.ts +2 -3
- package/es/components/Search/Search.js +4 -6
- package/es/components/Slider/Slider.d.ts +39 -44
- package/es/components/Slider/Slider.js +57 -59
- package/es/components/Tabs/Tabs.d.ts +3 -6
- package/es/components/Tabs/Tabs.js +16 -18
- package/es/components/Tag/DismissibleTag.d.ts +3 -5
- package/es/components/Tag/DismissibleTag.js +1 -2
- package/es/components/Tag/OperationalTag.d.ts +2 -3
- package/es/components/Tag/OperationalTag.js +1 -2
- package/es/components/Tag/SelectableTag.d.ts +3 -5
- package/es/components/Tag/SelectableTag.js +1 -2
- package/es/components/Tag/Tag.d.ts +2 -3
- package/es/components/Tag/Tag.js +1 -2
- package/es/components/Tile/Tile.d.ts +3 -5
- package/es/components/Tile/Tile.js +16 -10
- package/es/components/Toggletip/index.js +2 -2
- package/es/components/Tooltip/DefinitionTooltip.js +2 -2
- package/es/components/Tooltip/Tooltip.d.ts +1 -1
- package/es/components/Tooltip/Tooltip.js +2 -2
- package/es/components/TreeView/TreeNode.d.ts +3 -5
- package/es/components/TreeView/TreeNode.js +3 -4
- package/es/components/TreeView/TreeView.js +2 -2
- package/es/components/UIShell/HeaderContainer.js +2 -2
- package/es/components/UIShell/HeaderMenu.js +2 -2
- package/es/components/UIShell/HeaderPanel.js +2 -2
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/components/UIShell/SideNav.js +2 -2
- package/es/components/UIShell/SideNavHeader.d.ts +2 -3
- package/es/components/UIShell/SideNavHeader.js +1 -2
- package/es/components/UIShell/SideNavLink.d.ts +2 -2
- package/es/components/UIShell/SideNavLink.js +1 -1
- package/es/components/UIShell/SideNavMenu.d.ts +2 -2
- package/es/components/UIShell/SideNavMenu.js +3 -3
- package/es/components/UIShell/SwitcherItem.js +2 -2
- package/es/index.js +1 -1
- package/es/internal/FloatingMenu.d.ts +2 -2
- package/es/internal/FloatingMenu.js +8 -5
- package/es/internal/OptimizedResize.d.ts +18 -0
- package/es/internal/OptimizedResize.js +21 -24
- package/es/internal/createClassWrapper.d.ts +3 -3
- package/es/internal/createClassWrapper.js +4 -4
- package/es/internal/keyboard/index.d.ts +9 -0
- package/es/internal/keyboard/keys.d.ts +23 -0
- package/es/internal/keyboard/keys.js +2 -2
- package/es/internal/keyboard/match.d.ts +26 -0
- package/es/internal/keyboard/match.js +17 -41
- package/es/internal/keyboard/navigation.d.ts +37 -0
- package/es/internal/keyboard/navigation.js +15 -27
- package/es/internal/useMatchMedia.d.ts +8 -0
- package/es/internal/useMatchMedia.js +10 -20
- package/es/internal/useMergedRefs.js +3 -0
- package/es/internal/useNormalizedInputProps.d.ts +52 -0
- package/es/internal/useNormalizedInputProps.js +9 -36
- package/lib/components/Accordion/AccordionItem.js +2 -2
- package/lib/components/Button/Button.d.ts +2 -3
- package/lib/components/Button/Button.js +29 -19
- package/lib/components/Button/ButtonBase.js +3 -1
- package/lib/components/ChatButton/ChatButton.d.ts +2 -3
- package/lib/components/ChatButton/ChatButton.js +1 -2
- package/lib/components/ComboBox/ComboBox.js +34 -24
- package/lib/components/ComposedModal/ComposedModal.js +64 -50
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.js +3 -3
- package/lib/components/DataTable/TableBatchAction.d.ts +3 -3
- package/lib/components/DataTable/TableBatchAction.js +1 -1
- package/lib/components/DataTable/TableContainer.d.ts +1 -1
- package/lib/components/DataTable/TableContainer.js +5 -4
- package/lib/components/DataTable/TableExpandHeader.d.ts +6 -5
- package/lib/components/DataTable/TableToolbarMenu.d.ts +2 -2
- package/lib/components/DataTable/TableToolbarMenu.js +1 -1
- package/lib/components/DatePicker/DatePicker.js +2 -2
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
- package/lib/components/Dialog/index.d.ts +42 -4
- package/lib/components/Dialog/index.js +190 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -2
- package/lib/components/FeatureFlags/index.d.ts +3 -1
- package/lib/components/FeatureFlags/index.js +3 -0
- package/lib/components/FileUploader/FileUploader.d.ts +1 -1
- package/lib/components/FileUploader/FileUploader.js +2 -2
- package/lib/components/FileUploader/FileUploaderButton.js +2 -2
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +6 -4
- package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/Grid/CSSGrid.js +18 -14
- package/lib/components/Grid/Column.d.ts +2 -2
- package/lib/components/Grid/Column.js +7 -8
- package/lib/components/Grid/FlexGrid.js +7 -6
- package/lib/components/Grid/GridTypes.d.ts +5 -3
- package/lib/components/IconButton/index.d.ts +2 -2
- package/lib/components/IconButton/index.js +4 -4
- package/lib/components/Layer/index.d.ts +4 -6
- package/lib/components/Layer/index.js +5 -6
- package/lib/components/Link/Link.d.ts +2 -3
- package/lib/components/Link/Link.js +1 -2
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +3 -3
- package/lib/components/ListBox/ListBoxMenuItem.js +36 -14
- package/lib/components/Menu/Menu.js +2 -2
- package/lib/components/Menu/MenuItem.d.ts +2 -2
- package/lib/components/Menu/MenuItem.js +3 -3
- package/lib/components/Modal/Modal.js +123 -51
- package/lib/components/ModalWrapper/ModalWrapper.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
- package/lib/components/MultiSelect/MultiSelect.js +2 -2
- package/lib/components/MultiSelect/index.d.ts +1 -1
- package/lib/components/MultiSelect/index.js +1 -8
- package/lib/components/Notification/Notification.d.ts +5 -13
- package/lib/components/Notification/Notification.js +3 -4
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +22 -201
- package/lib/components/OverflowMenu/OverflowMenu.js +268 -336
- package/lib/components/OverflowMenu/index.d.ts +5 -5
- package/lib/components/OverflowMenu/index.js +2 -2
- package/lib/components/OverflowMenu/next/index.d.ts +4 -4
- package/lib/components/OverflowMenu/next/index.js +1 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -2
- package/lib/components/RadioTile/RadioTile.js +2 -2
- package/lib/components/Search/Search.d.ts +2 -3
- package/lib/components/Search/Search.js +4 -6
- package/lib/components/Slider/Slider.d.ts +39 -44
- package/lib/components/Slider/Slider.js +57 -59
- package/lib/components/Tabs/Tabs.d.ts +3 -6
- package/lib/components/Tabs/Tabs.js +16 -18
- package/lib/components/Tag/DismissibleTag.d.ts +3 -5
- package/lib/components/Tag/DismissibleTag.js +1 -2
- package/lib/components/Tag/OperationalTag.d.ts +2 -3
- package/lib/components/Tag/OperationalTag.js +1 -2
- package/lib/components/Tag/SelectableTag.d.ts +3 -5
- package/lib/components/Tag/SelectableTag.js +1 -2
- package/lib/components/Tag/Tag.d.ts +2 -3
- package/lib/components/Tag/Tag.js +1 -2
- package/lib/components/Tile/Tile.d.ts +3 -5
- package/lib/components/Tile/Tile.js +16 -10
- package/lib/components/Toggletip/index.js +2 -2
- package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.d.ts +1 -1
- package/lib/components/Tooltip/Tooltip.js +2 -2
- package/lib/components/TreeView/TreeNode.d.ts +3 -5
- package/lib/components/TreeView/TreeNode.js +3 -4
- package/lib/components/TreeView/TreeView.js +2 -2
- package/lib/components/UIShell/HeaderContainer.js +2 -2
- package/lib/components/UIShell/HeaderMenu.js +2 -2
- package/lib/components/UIShell/HeaderPanel.js +2 -2
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/components/UIShell/SideNav.js +2 -2
- package/lib/components/UIShell/SideNavHeader.d.ts +2 -3
- package/lib/components/UIShell/SideNavHeader.js +1 -2
- package/lib/components/UIShell/SideNavLink.d.ts +2 -2
- package/lib/components/UIShell/SideNavLink.js +1 -1
- package/lib/components/UIShell/SideNavMenu.d.ts +2 -2
- package/lib/components/UIShell/SideNavMenu.js +3 -3
- package/lib/components/UIShell/SwitcherItem.js +2 -2
- package/lib/index.js +2 -2
- package/lib/internal/FloatingMenu.d.ts +2 -2
- package/lib/internal/FloatingMenu.js +9 -6
- package/lib/internal/OptimizedResize.d.ts +18 -0
- package/lib/internal/OptimizedResize.js +21 -24
- package/lib/internal/createClassWrapper.d.ts +3 -3
- package/lib/internal/createClassWrapper.js +4 -4
- package/lib/internal/keyboard/index.d.ts +9 -0
- package/lib/internal/keyboard/keys.d.ts +23 -0
- package/lib/internal/keyboard/keys.js +2 -2
- package/lib/internal/keyboard/match.d.ts +26 -0
- package/lib/internal/keyboard/match.js +17 -41
- package/lib/internal/keyboard/navigation.d.ts +37 -0
- package/lib/internal/keyboard/navigation.js +15 -27
- package/lib/internal/useMatchMedia.d.ts +8 -0
- package/lib/internal/useMatchMedia.js +10 -20
- package/lib/internal/useMergedRefs.js +3 -0
- package/lib/internal/useNormalizedInputProps.d.ts +52 -0
- package/lib/internal/useNormalizedInputProps.js +9 -36
- package/package.json +6 -6
- package/scss/components/dialog/_dialog.scss +9 -0
- package/scss/components/dialog/_index.scss +9 -0
- package/telemetry.yml +1 -0
- package/es/components/Modal/next/index.d.ts +0 -171
- package/es/internal/focus/index.js +0 -15
- package/es/internal/useEffectOnce.js +0 -30
- package/lib/components/Modal/next/index.d.ts +0 -171
- package/lib/internal/focus/index.js +0 -19
- package/lib/internal/useEffectOnce.js +0 -34
|
@@ -12,9 +12,28 @@ export interface DialogProps extends ReactAttr<HTMLDialogElement> {
|
|
|
12
12
|
*/
|
|
13
13
|
children?: React.ReactNode;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Specify an optional className to be applied to the modal root node
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specifies whether the dialog is modal or non-modal. This cannot be changed
|
|
20
|
+
* while open=true
|
|
16
21
|
*/
|
|
17
22
|
modal?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Specify a handler for the dialog's cancel event.
|
|
25
|
+
* The browser fires this event when the user presses the Esc key and is cancelable.
|
|
26
|
+
*/
|
|
27
|
+
onCancel?: React.ReactEventHandler<HTMLDialogElement>;
|
|
28
|
+
/**
|
|
29
|
+
* Specify a click handler applied to the dialog.
|
|
30
|
+
*/
|
|
31
|
+
onClick?: React.ReactEventHandler<HTMLDialogElement>;
|
|
32
|
+
/**
|
|
33
|
+
* Specify a handler the dialog's close event.
|
|
34
|
+
* The browser fires this event after the dialog has closed.
|
|
35
|
+
*/
|
|
36
|
+
onClose?: React.ReactEventHandler<HTMLDialogElement>;
|
|
18
37
|
/**
|
|
19
38
|
* Specify a handler for closing Dialog.
|
|
20
39
|
* The handler should care of closing Dialog, e.g. changing `open` prop.
|
|
@@ -25,6 +44,25 @@ export interface DialogProps extends ReactAttr<HTMLDialogElement> {
|
|
|
25
44
|
*/
|
|
26
45
|
open?: boolean;
|
|
27
46
|
}
|
|
28
|
-
declare const unstable__Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<unknown>>;
|
|
29
|
-
export
|
|
30
|
-
|
|
47
|
+
export declare const unstable__Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<unknown>>;
|
|
48
|
+
export interface DialogHeaderProps extends ReactAttr<HTMLDivElement> {
|
|
49
|
+
/**
|
|
50
|
+
* Provide the contents to be rendered inside of this component
|
|
51
|
+
*/
|
|
52
|
+
children?: React.ReactNode;
|
|
53
|
+
}
|
|
54
|
+
export declare const DialogHeader: React.ForwardRefExoticComponent<DialogHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
55
|
+
export interface DialogControlsProps extends ReactAttr<HTMLDivElement> {
|
|
56
|
+
/**
|
|
57
|
+
* Provide the contents to be rendered inside of this component
|
|
58
|
+
*/
|
|
59
|
+
children?: React.ReactNode;
|
|
60
|
+
}
|
|
61
|
+
export declare const DialogControls: React.ForwardRefExoticComponent<DialogControlsProps & React.RefAttributes<HTMLDivElement>>;
|
|
62
|
+
export interface DialogCloseButtonProps extends ReactAttr<HTMLDivElement> {
|
|
63
|
+
/**
|
|
64
|
+
* Specify a click handler applied to the IconButton
|
|
65
|
+
*/
|
|
66
|
+
onClick?: React.MouseEventHandler;
|
|
67
|
+
}
|
|
68
|
+
export declare const DialogCloseButton: React.ForwardRefExoticComponent<DialogCloseButtonProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default, { useRef, useEffect } from 'react';
|
|
11
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
|
+
import cx from 'classnames';
|
|
13
|
+
import { Close } from '@carbon/icons-react';
|
|
14
|
+
import { IconButton } from '../IconButton/index.js';
|
|
15
|
+
import { noopFn } from '../../internal/noopFn.js';
|
|
16
|
+
|
|
17
|
+
const unstable__Dialog = /*#__PURE__*/React__default.forwardRef((_ref, forwardRef) => {
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
className,
|
|
21
|
+
modal,
|
|
22
|
+
onCancel = noopFn,
|
|
23
|
+
onClick = noopFn,
|
|
24
|
+
onClose = noopFn,
|
|
25
|
+
onRequestClose = noopFn,
|
|
26
|
+
open = false,
|
|
27
|
+
...rest
|
|
28
|
+
} = _ref;
|
|
29
|
+
const prefix = usePrefix();
|
|
30
|
+
|
|
31
|
+
// This component needs access to a ref, placed on the dialog, to call the
|
|
32
|
+
// various imperative dialog functions (show(), close(), etc.).
|
|
33
|
+
// If the parent component has not passed a ref for forwardRef, forwardRef
|
|
34
|
+
// will be null. A "backup" ref is needed to ensure the dialog's instance
|
|
35
|
+
// methods can always be called within this component.
|
|
36
|
+
const backupRef = useRef(null);
|
|
37
|
+
const ref = forwardRef ?? backupRef;
|
|
38
|
+
|
|
39
|
+
// Clicks on the backdrop of an open modal dialog should request the consuming component to close
|
|
40
|
+
// the dialog. Clicks elsewhere, or on non-modal dialogs should not request
|
|
41
|
+
// to close the dialog.
|
|
42
|
+
function handleModalBackdropClick(e) {
|
|
43
|
+
if (open && modal && e.target === ref.current) {
|
|
44
|
+
onRequestClose(e);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function handleClick(e) {
|
|
48
|
+
handleModalBackdropClick(e);
|
|
49
|
+
|
|
50
|
+
// onClick should always be called, no matter if the target is a modal
|
|
51
|
+
// dialog, modal dialog backdrop, or non-modal dialog.
|
|
52
|
+
onClick(e);
|
|
53
|
+
}
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (ref.current) {
|
|
56
|
+
if (open) {
|
|
57
|
+
if (modal) {
|
|
58
|
+
// Display the dialog as a modal, over the top of any other dialogs
|
|
59
|
+
// that might be present. Everything outside the dialog are inert
|
|
60
|
+
// with interactions outside the dialog being blocked.
|
|
61
|
+
ref.current.showModal();
|
|
62
|
+
} else {
|
|
63
|
+
// Display the dialog modelessly, i.e. still allowing interaction
|
|
64
|
+
// with content outside of the dialog.
|
|
65
|
+
ref.current.show();
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
ref.current.close();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}, [modal, open]);
|
|
72
|
+
return /*#__PURE__*/React__default.createElement("dialog", _extends({}, rest, {
|
|
73
|
+
className: cx(`${prefix}--dialog`, {
|
|
74
|
+
[`${prefix}--dialog--modal`]: modal
|
|
75
|
+
}, className),
|
|
76
|
+
ref: ref,
|
|
77
|
+
onCancel: onCancel,
|
|
78
|
+
onClick: handleClick,
|
|
79
|
+
onClose: onClose
|
|
80
|
+
}), children);
|
|
81
|
+
});
|
|
82
|
+
unstable__Dialog.displayName = 'Dialog';
|
|
83
|
+
unstable__Dialog.propTypes = {
|
|
84
|
+
/**
|
|
85
|
+
* Provide children to be rendered inside of the Dialog
|
|
86
|
+
*/
|
|
87
|
+
children: PropTypes.node,
|
|
88
|
+
/**
|
|
89
|
+
* Specify an optional className to be applied to the modal root node
|
|
90
|
+
*/
|
|
91
|
+
className: PropTypes.string,
|
|
92
|
+
/**
|
|
93
|
+
* Modal specifies whether the Dialog is modal or non-modal. This cannot be
|
|
94
|
+
* changed while open=true
|
|
95
|
+
*/
|
|
96
|
+
modal: PropTypes.bool,
|
|
97
|
+
/**
|
|
98
|
+
* Specify a handler for closing Dialog.
|
|
99
|
+
* The handler should care of closing Dialog, e.g. changing `open` prop.
|
|
100
|
+
*/
|
|
101
|
+
onRequestClose: PropTypes.func,
|
|
102
|
+
/**
|
|
103
|
+
* open initial state
|
|
104
|
+
*/
|
|
105
|
+
open: PropTypes.bool
|
|
106
|
+
};
|
|
107
|
+
const DialogHeader = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
|
|
108
|
+
let {
|
|
109
|
+
children,
|
|
110
|
+
...rest
|
|
111
|
+
} = _ref2;
|
|
112
|
+
const prefix = usePrefix();
|
|
113
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
114
|
+
className: `${prefix}--dialog__header`,
|
|
115
|
+
ref: ref
|
|
116
|
+
}, rest), children);
|
|
117
|
+
});
|
|
118
|
+
DialogHeader.propTypes = {
|
|
119
|
+
/**
|
|
120
|
+
* Provide the contents to be rendered inside of this component
|
|
121
|
+
*/
|
|
122
|
+
children: PropTypes.node
|
|
123
|
+
};
|
|
124
|
+
const DialogControls = /*#__PURE__*/React__default.forwardRef((_ref3, ref) => {
|
|
125
|
+
let {
|
|
126
|
+
children,
|
|
127
|
+
...rest
|
|
128
|
+
} = _ref3;
|
|
129
|
+
const prefix = usePrefix();
|
|
130
|
+
return (
|
|
131
|
+
/*#__PURE__*/
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
React__default.createElement("div", _extends({
|
|
134
|
+
className: `${prefix}--dialog__header-controls`,
|
|
135
|
+
ref: ref
|
|
136
|
+
}, rest), children)
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
DialogControls.propTypes = {
|
|
140
|
+
/**
|
|
141
|
+
* Provide children to be rendered inside of this component
|
|
142
|
+
*/
|
|
143
|
+
children: PropTypes.node
|
|
144
|
+
};
|
|
145
|
+
const DialogCloseButton = /*#__PURE__*/React__default.forwardRef((_ref4, ref) => {
|
|
146
|
+
let {
|
|
147
|
+
onClick,
|
|
148
|
+
...rest
|
|
149
|
+
} = _ref4;
|
|
150
|
+
const prefix = usePrefix();
|
|
151
|
+
return (
|
|
152
|
+
/*#__PURE__*/
|
|
153
|
+
// @ts-ignore
|
|
154
|
+
React__default.createElement(IconButton, _extends({
|
|
155
|
+
kind: "ghost",
|
|
156
|
+
className: `${prefix}--dialog__close`,
|
|
157
|
+
label: "Close",
|
|
158
|
+
title: "Close",
|
|
159
|
+
"aria-label": "Close",
|
|
160
|
+
align: "left",
|
|
161
|
+
onClick: onClick
|
|
162
|
+
}, rest), /*#__PURE__*/React__default.createElement(Close, {
|
|
163
|
+
size: 20,
|
|
164
|
+
"aria-hidden": "true",
|
|
165
|
+
tabIndex: "-1",
|
|
166
|
+
className: `${prefix}--icon__close`
|
|
167
|
+
}))
|
|
168
|
+
);
|
|
169
|
+
});
|
|
170
|
+
DialogCloseButton.propTypes = {
|
|
171
|
+
/**
|
|
172
|
+
* Specify a click handler applied to the IconButton
|
|
173
|
+
*/
|
|
174
|
+
onClick: PropTypes.func
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export { DialogCloseButton, DialogControls, DialogHeader, unstable__Dialog };
|
|
@@ -12,9 +12,9 @@ import Search from '../Search/Search.js';
|
|
|
12
12
|
import '../Search/Search.Skeleton.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
15
|
-
import mergeRefs from '../../tools/mergeRefs.js';
|
|
16
|
-
import { match } from '../../internal/keyboard/match.js';
|
|
17
15
|
import { Escape } from '../../internal/keyboard/keys.js';
|
|
16
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
17
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
18
18
|
|
|
19
19
|
const ExpandableSearch = /*#__PURE__*/React__default.forwardRef(function ExpandableSearch(_ref, forwardedRef) {
|
|
20
20
|
let {
|
|
@@ -14,6 +14,7 @@ export interface FeatureFlagsProps {
|
|
|
14
14
|
enableV12Overflowmenu?: boolean;
|
|
15
15
|
enableTreeviewControllable?: boolean;
|
|
16
16
|
enableExperimentalFocusWrapWithoutSentinels?: boolean;
|
|
17
|
+
enableDialogElement?: boolean;
|
|
17
18
|
enableV12DynamicFloatingStyles?: boolean;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
@@ -26,7 +27,7 @@ declare const FeatureFlagContext: React.Context<any>;
|
|
|
26
27
|
* along with the current `FeatureFlagContext` to provide consumers to check if
|
|
27
28
|
* a feature flag is enabled or disabled in a given React tree
|
|
28
29
|
*/
|
|
29
|
-
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableV12DynamicFloatingStyles, }: FeatureFlagsProps): JSX.Element;
|
|
30
|
+
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, }: FeatureFlagsProps): JSX.Element;
|
|
30
31
|
declare namespace FeatureFlags {
|
|
31
32
|
var propTypes: {
|
|
32
33
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -39,6 +40,7 @@ declare namespace FeatureFlags {
|
|
|
39
40
|
enableV12Overflowmenu: PropTypes.Requireable<boolean>;
|
|
40
41
|
enableTreeviewControllable: PropTypes.Requireable<boolean>;
|
|
41
42
|
enableExperimentalFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
|
|
43
|
+
enableDialogElement: PropTypes.Requireable<boolean>;
|
|
42
44
|
enableV12DynamicFloatingStyles: PropTypes.Requireable<boolean>;
|
|
43
45
|
};
|
|
44
46
|
}
|
|
@@ -30,6 +30,7 @@ function FeatureFlags(_ref) {
|
|
|
30
30
|
enableV12Overflowmenu = false,
|
|
31
31
|
enableTreeviewControllable = false,
|
|
32
32
|
enableExperimentalFocusWrapWithoutSentinels = false,
|
|
33
|
+
enableDialogElement = false,
|
|
33
34
|
enableV12DynamicFloatingStyles = false
|
|
34
35
|
} = _ref;
|
|
35
36
|
const parentScope = useContext(FeatureFlagContext);
|
|
@@ -40,6 +41,7 @@ function FeatureFlags(_ref) {
|
|
|
40
41
|
'enable-v12-overflowmenu': enableV12Overflowmenu,
|
|
41
42
|
'enable-treeview-controllable': enableTreeviewControllable,
|
|
42
43
|
'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
|
|
44
|
+
'enable-dialog-element': enableDialogElement,
|
|
43
45
|
'enable-v12-dynamic-floating-styles': enableV12DynamicFloatingStyles,
|
|
44
46
|
...flags
|
|
45
47
|
};
|
|
@@ -78,6 +80,7 @@ FeatureFlags.propTypes = {
|
|
|
78
80
|
enableV12Overflowmenu: PropTypes.bool,
|
|
79
81
|
enableTreeviewControllable: PropTypes.bool,
|
|
80
82
|
enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool,
|
|
83
|
+
enableDialogElement: PropTypes.bool,
|
|
81
84
|
enableV12DynamicFloatingStyles: PropTypes.bool
|
|
82
85
|
};
|
|
83
86
|
|
|
@@ -12,12 +12,12 @@ import React__default, { useState, useImperativeHandle } from 'react';
|
|
|
12
12
|
import Filename from './Filename.js';
|
|
13
13
|
import FileUploaderButton from './FileUploaderButton.js';
|
|
14
14
|
import { ButtonKinds } from '../Button/Button.js';
|
|
15
|
+
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
16
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
15
17
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
18
|
import '../Text/index.js';
|
|
17
19
|
import { useId } from '../../internal/useId.js';
|
|
18
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
19
20
|
import { Text } from '../Text/Text.js';
|
|
20
|
-
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
21
21
|
|
|
22
22
|
const FileUploader = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
23
23
|
let {
|
|
@@ -9,13 +9,13 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default, { useState, useRef } from 'react';
|
|
12
|
+
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
13
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
12
14
|
import { ButtonKinds } from '../../prop-types/types.js';
|
|
13
15
|
import uniqueId from '../../tools/uniqueId.js';
|
|
14
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
17
|
import deprecate from '../../prop-types/deprecate.js';
|
|
16
18
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
18
|
-
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
19
19
|
|
|
20
20
|
function FileUploaderButton(_ref) {
|
|
21
21
|
let {
|
|
@@ -9,13 +9,13 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import React__default, { useRef, useState } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
+
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
13
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
12
14
|
import uniqueId from '../../tools/uniqueId.js';
|
|
13
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
16
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
15
17
|
import deprecate from '../../prop-types/deprecate.js';
|
|
16
18
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
18
|
-
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
19
19
|
|
|
20
20
|
function FileUploaderDropContainer(_ref) {
|
|
21
21
|
let {
|
|
@@ -71,14 +71,16 @@ function FileUploaderDropContainer(_ref) {
|
|
|
71
71
|
}
|
|
72
72
|
function handleChange(event) {
|
|
73
73
|
const files = [...(event.target.files ?? [])];
|
|
74
|
-
const
|
|
74
|
+
const filesToValidate = multiple ? files : [files[0]];
|
|
75
|
+
const addedFiles = validateFiles(filesToValidate);
|
|
75
76
|
return onAddFiles(event, {
|
|
76
77
|
addedFiles
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
80
|
function handleDrop(event) {
|
|
80
81
|
const files = [...event.dataTransfer.files];
|
|
81
|
-
const
|
|
82
|
+
const filesToValidate = multiple ? files : [files[0]];
|
|
83
|
+
const addedFiles = validateFiles(filesToValidate);
|
|
82
84
|
return onAddFiles(event, {
|
|
83
85
|
addedFiles
|
|
84
86
|
});
|
|
@@ -10,15 +10,15 @@ import cx from 'classnames';
|
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default, { useRef, useState, useLayoutEffect } from 'react';
|
|
12
12
|
import Filename from './Filename.js';
|
|
13
|
+
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
14
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
13
15
|
import uniqueId from '../../tools/uniqueId.js';
|
|
14
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
17
|
import { noopFn } from '../../internal/noopFn.js';
|
|
16
18
|
import '../Text/index.js';
|
|
17
19
|
import '../Tooltip/DefinitionTooltip.js';
|
|
18
20
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
19
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
20
21
|
import { Text } from '../Text/Text.js';
|
|
21
|
-
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
22
22
|
|
|
23
23
|
function FileUploaderItem(_ref) {
|
|
24
24
|
let {
|
|
@@ -12,10 +12,10 @@ import React__default from 'react';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { useGridSettings, GridSettings } from './GridContext.js';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const CSSGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
16
16
|
let {
|
|
17
17
|
align,
|
|
18
|
-
as
|
|
18
|
+
as,
|
|
19
19
|
children,
|
|
20
20
|
className: customClassName,
|
|
21
21
|
condensed = false,
|
|
@@ -38,7 +38,8 @@ function CSSGrid(_ref) {
|
|
|
38
38
|
mode: "css-grid",
|
|
39
39
|
subgrid: true
|
|
40
40
|
}, /*#__PURE__*/React__default.createElement(Subgrid, _extends({
|
|
41
|
-
|
|
41
|
+
ref: ref,
|
|
42
|
+
as: as,
|
|
42
43
|
className: customClassName,
|
|
43
44
|
mode: mode
|
|
44
45
|
}, rest), children));
|
|
@@ -53,23 +54,24 @@ function CSSGrid(_ref) {
|
|
|
53
54
|
});
|
|
54
55
|
|
|
55
56
|
// cast as any to let TypeScript allow passing in attributes to base component
|
|
56
|
-
const
|
|
57
|
+
const BaseComponent = as || 'div';
|
|
57
58
|
return /*#__PURE__*/React__default.createElement(GridSettings, {
|
|
58
59
|
mode: "css-grid",
|
|
59
60
|
subgrid: true
|
|
60
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
61
|
-
className: className
|
|
61
|
+
}, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
|
|
62
|
+
className: className,
|
|
63
|
+
ref: ref
|
|
62
64
|
}, rest), children));
|
|
63
|
-
}
|
|
65
|
+
});
|
|
64
66
|
CSSGrid.propTypes = {
|
|
65
|
-
/**
|
|
66
|
-
* Specify grid alignment. Default is center
|
|
67
|
-
*/
|
|
68
|
-
align: PropTypes.oneOf(['start', 'center', 'end']),
|
|
69
67
|
/**
|
|
70
68
|
* Provide a custom element to render instead of the default <div>
|
|
71
69
|
*/
|
|
72
70
|
as: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
71
|
+
/**
|
|
72
|
+
* Specify grid alignment. Default is center
|
|
73
|
+
*/
|
|
74
|
+
align: PropTypes.oneOf(['start', 'center', 'end']),
|
|
73
75
|
/**
|
|
74
76
|
* Pass in content that will be rendered within the `Grid`
|
|
75
77
|
*/
|
|
@@ -93,9 +95,9 @@ CSSGrid.propTypes = {
|
|
|
93
95
|
*/
|
|
94
96
|
narrow: PropTypes.bool
|
|
95
97
|
};
|
|
96
|
-
const Subgrid = _ref2 => {
|
|
98
|
+
const Subgrid = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
|
|
97
99
|
let {
|
|
98
|
-
as
|
|
100
|
+
as,
|
|
99
101
|
className: customClassName,
|
|
100
102
|
children,
|
|
101
103
|
mode,
|
|
@@ -108,10 +110,12 @@ const Subgrid = _ref2 => {
|
|
|
108
110
|
[`${prefix}--subgrid--narrow`]: mode === 'narrow',
|
|
109
111
|
[`${prefix}--subgrid--wide`]: mode === 'wide'
|
|
110
112
|
});
|
|
113
|
+
const BaseComponent = as || 'div';
|
|
111
114
|
return /*#__PURE__*/React__default.createElement(BaseComponent, _extends({}, rest, {
|
|
115
|
+
ref: ref,
|
|
112
116
|
className: className
|
|
113
117
|
}), children);
|
|
114
|
-
};
|
|
118
|
+
});
|
|
115
119
|
Subgrid.propTypes = {
|
|
116
120
|
/**
|
|
117
121
|
* Provide a custom element to render instead of the default <div>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
9
9
|
type ColumnSpanPercent = '25%' | '50%' | '75%' | '100%';
|
|
10
10
|
type ColumnSpanSimple = boolean | number | ColumnSpanPercent;
|
|
11
11
|
export interface ColumnSpanObject {
|
|
@@ -65,7 +65,7 @@ export interface ColumnBaseProps {
|
|
|
65
65
|
*/
|
|
66
66
|
span?: ColumnSpan;
|
|
67
67
|
}
|
|
68
|
-
export type ColumnProps<T extends React.ElementType> =
|
|
68
|
+
export type ColumnProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, ColumnBaseProps>;
|
|
69
69
|
export interface ColumnComponent {
|
|
70
70
|
<T extends React.ElementType>(props: ColumnProps<T>, context?: any): React.ReactElement<any, any> | null;
|
|
71
71
|
}
|
|
@@ -13,9 +13,9 @@ import React__default from 'react';
|
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import { useGridSettings } from './GridContext.js';
|
|
15
15
|
|
|
16
|
-
function Column(_ref) {
|
|
16
|
+
const Column = /*#__PURE__*/React__default.forwardRef(function Column(_ref, ref) {
|
|
17
17
|
let {
|
|
18
|
-
as
|
|
18
|
+
as,
|
|
19
19
|
children,
|
|
20
20
|
className: customClassName,
|
|
21
21
|
sm,
|
|
@@ -29,6 +29,7 @@ function Column(_ref) {
|
|
|
29
29
|
mode
|
|
30
30
|
} = useGridSettings();
|
|
31
31
|
const prefix = usePrefix();
|
|
32
|
+
const BaseComponent = as || 'div';
|
|
32
33
|
if (mode === 'css-grid') {
|
|
33
34
|
return /*#__PURE__*/React__default.createElement(CSSGridColumn, _extends({
|
|
34
35
|
as: BaseComponent,
|
|
@@ -44,13 +45,11 @@ function Column(_ref) {
|
|
|
44
45
|
const className = cx(customClassName, columnClassName, {
|
|
45
46
|
[`${prefix}--col`]: columnClassName.length === 0
|
|
46
47
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return /*#__PURE__*/React__default.createElement(BaseComponentAsAny, _extends({
|
|
51
|
-
className: className
|
|
48
|
+
return /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
|
|
49
|
+
className: className,
|
|
50
|
+
ref: ref
|
|
52
51
|
}, rest), children);
|
|
53
|
-
}
|
|
52
|
+
});
|
|
54
53
|
const percentSpanType = PropTypes.oneOf(['25%', '50%', '75%', '100%']);
|
|
55
54
|
const spanPropType = FeatureFlags.enabled('enable-css-grid') ? PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.shape({
|
|
56
55
|
span: PropTypes.oneOfType([PropTypes.number, percentSpanType]),
|
|
@@ -12,9 +12,9 @@ import React__default from 'react';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { GridSettings } from './GridContext.js';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const FlexGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
16
16
|
let {
|
|
17
|
-
as
|
|
17
|
+
as,
|
|
18
18
|
condensed = false,
|
|
19
19
|
narrow = false,
|
|
20
20
|
fullWidth = false,
|
|
@@ -30,14 +30,15 @@ function FlexGrid(_ref) {
|
|
|
30
30
|
[`${prefix}--grid--full-width`]: fullWidth
|
|
31
31
|
});
|
|
32
32
|
// cast as any to let TypeScript allow passing in attributes to base component
|
|
33
|
-
const
|
|
33
|
+
const BaseComponent = as || 'div';
|
|
34
34
|
return /*#__PURE__*/React__default.createElement(GridSettings, {
|
|
35
35
|
mode: "flexbox",
|
|
36
36
|
subgrid: false
|
|
37
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
38
|
-
className: className
|
|
37
|
+
}, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
|
|
38
|
+
className: className,
|
|
39
|
+
ref: ref
|
|
39
40
|
}, rest), children));
|
|
40
|
-
}
|
|
41
|
+
});
|
|
41
42
|
FlexGrid.propTypes = {
|
|
42
43
|
/**
|
|
43
44
|
* Provide a custom element to render instead of the default <div>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
8
8
|
export interface GridBaseProps {
|
|
9
9
|
/**
|
|
10
10
|
* Pass in content that will be rendered within the `Grid`
|
|
@@ -29,7 +29,9 @@ export interface GridBaseProps {
|
|
|
29
29
|
*/
|
|
30
30
|
narrow?: boolean;
|
|
31
31
|
}
|
|
32
|
-
export type GridProps<T extends React.ElementType> =
|
|
32
|
+
export type GridProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, GridBaseProps>;
|
|
33
33
|
export interface GridComponent {
|
|
34
|
-
<T extends React.ElementType>(props: GridProps<T
|
|
34
|
+
<T extends React.ElementType = 'div'>(props: GridProps<T>): React.ReactElement | null;
|
|
35
|
+
displayName?: string;
|
|
36
|
+
propTypes?: React.WeakValidationMap<GridProps<any>>;
|
|
35
37
|
}
|
|
@@ -86,9 +86,9 @@ export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
86
86
|
*/
|
|
87
87
|
rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
|
|
88
88
|
/**
|
|
89
|
-
* Specify the size of the Button.
|
|
89
|
+
* Specify the size of the Button.
|
|
90
90
|
*/
|
|
91
|
-
size?: ButtonSize
|
|
91
|
+
size?: Extract<ButtonSize, 'sm' | 'md' | 'lg'>;
|
|
92
92
|
/**
|
|
93
93
|
* Optionally specify a `target` when using an `<a>` element.
|
|
94
94
|
*/
|
|
@@ -76,9 +76,9 @@ const IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton(_r
|
|
|
76
76
|
kind: kind,
|
|
77
77
|
ref: ref,
|
|
78
78
|
size: size,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
isSelected: isSelected,
|
|
80
|
+
hasIconOnly: true,
|
|
81
|
+
className: className,
|
|
82
82
|
"aria-describedby": badgeCount && badgeId
|
|
83
83
|
}), children, !disabled && badgeCount !== undefined && /*#__PURE__*/React__default.createElement(BadgeIndicator, {
|
|
84
84
|
id: badgeId,
|
|
@@ -184,7 +184,7 @@ IconButton.propTypes = {
|
|
|
184
184
|
*/
|
|
185
185
|
rel: PropTypes.string,
|
|
186
186
|
/**
|
|
187
|
-
* Specify the size of the Button.
|
|
187
|
+
* Specify the size of the Button.
|
|
188
188
|
*/
|
|
189
189
|
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
190
190
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { LayerLevel } from './LayerLevel';
|
|
9
|
-
import {
|
|
9
|
+
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
10
10
|
/**
|
|
11
11
|
* A custom hook that will return information about the current layer. A common
|
|
12
12
|
* field to pull from this is the `level` for the layer that the component that
|
|
@@ -30,8 +30,6 @@ export interface LayerBaseProps {
|
|
|
30
30
|
*/
|
|
31
31
|
level?: LayerLevel;
|
|
32
32
|
}
|
|
33
|
-
export type LayerProps<T extends React.ElementType> =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
export declare const Layer: LayerComponent;
|
|
33
|
+
export type LayerProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, LayerBaseProps>;
|
|
34
|
+
declare const Layer: React.ForwardRefExoticComponent<Omit<LayerProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
|
|
35
|
+
export { Layer };
|