@carbon/react 1.78.0-rc.0 → 1.78.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.
Files changed (231) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +851 -816
  2. package/es/components/Accordion/AccordionItem.js +2 -2
  3. package/es/components/Button/Button.d.ts +2 -3
  4. package/es/components/Button/Button.js +1 -2
  5. package/es/components/Button/ButtonBase.js +1 -1
  6. package/es/components/ChatButton/ChatButton.d.ts +2 -3
  7. package/es/components/ChatButton/ChatButton.js +1 -2
  8. package/es/components/ComboBox/ComboBox.js +40 -30
  9. package/es/components/ComboButton/index.js +0 -1
  10. package/es/components/ComposedModal/ComposedModal.js +65 -51
  11. package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
  12. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
  13. package/es/components/ContentSwitcher/ContentSwitcher.js +3 -3
  14. package/es/components/ContextMenu/useContextMenu.d.ts +0 -1
  15. package/es/components/ContextMenu/useContextMenu.js +1 -2
  16. package/es/components/DataTable/TableBatchAction.d.ts +3 -3
  17. package/es/components/DataTable/TableBatchAction.js +1 -1
  18. package/es/components/DataTable/TableContainer.d.ts +1 -1
  19. package/es/components/DataTable/TableContainer.js +3 -3
  20. package/es/components/DataTable/TableExpandHeader.d.ts +6 -5
  21. package/es/components/DataTable/TableToolbarMenu.d.ts +2 -2
  22. package/es/components/DataTable/TableToolbarMenu.js +1 -1
  23. package/es/components/DatePicker/DatePicker.js +2 -2
  24. package/es/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
  25. package/es/components/Dialog/index.d.ts +42 -4
  26. package/es/components/Dialog/index.js +177 -0
  27. package/es/components/ExpandableSearch/ExpandableSearch.js +2 -2
  28. package/es/components/FeatureFlags/index.d.ts +3 -1
  29. package/es/components/FeatureFlags/index.js +3 -0
  30. package/es/components/FileUploader/FileUploader.d.ts +1 -1
  31. package/es/components/FileUploader/FileUploader.js +2 -2
  32. package/es/components/FileUploader/FileUploaderButton.js +2 -2
  33. package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
  34. package/es/components/FileUploader/FileUploaderDropContainer.js +6 -4
  35. package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
  36. package/es/components/FileUploader/FileUploaderItem.js +2 -2
  37. package/es/components/Grid/CSSGrid.js +18 -14
  38. package/es/components/Grid/FlexGrid.js +7 -6
  39. package/es/components/Grid/GridTypes.d.ts +5 -3
  40. package/es/components/IconButton/index.js +3 -3
  41. package/es/components/Layer/index.d.ts +4 -6
  42. package/es/components/Layer/index.js +5 -6
  43. package/es/components/Link/Link.d.ts +2 -3
  44. package/es/components/Link/Link.js +1 -2
  45. package/es/components/ListBox/ListBoxMenuItem.d.ts +3 -3
  46. package/es/components/ListBox/ListBoxMenuItem.js +37 -15
  47. package/es/components/Menu/Menu.d.ts +1 -0
  48. package/es/components/Menu/Menu.js +7 -9
  49. package/es/components/Menu/MenuContext.d.ts +4 -4
  50. package/es/components/Menu/MenuContext.js +6 -1
  51. package/es/components/Menu/MenuItem.d.ts +2 -2
  52. package/es/components/Menu/MenuItem.js +16 -24
  53. package/es/components/MenuButton/index.js +14 -2
  54. package/es/components/Modal/Modal.js +121 -49
  55. package/es/components/ModalWrapper/ModalWrapper.js +1 -1
  56. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
  57. package/es/components/MultiSelect/MultiSelect.js +2 -2
  58. package/es/components/Notification/Notification.d.ts +5 -13
  59. package/es/components/Notification/Notification.js +7 -9
  60. package/es/components/OverflowMenu/OverflowMenu.d.ts +4 -8
  61. package/es/components/OverflowMenu/OverflowMenu.js +3 -3
  62. package/es/components/OverflowMenu/next/index.d.ts +2 -2
  63. package/es/components/OverflowMenu/next/index.js +1 -1
  64. package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  65. package/es/components/ProgressIndicator/ProgressIndicator.js +2 -2
  66. package/es/components/RadioTile/RadioTile.js +2 -2
  67. package/es/components/Search/Search.d.ts +2 -3
  68. package/es/components/Search/Search.js +4 -6
  69. package/es/components/Slider/Slider.d.ts +16 -15
  70. package/es/components/Slider/Slider.js +22 -22
  71. package/es/components/Tabs/Tabs.d.ts +3 -6
  72. package/es/components/Tabs/Tabs.js +8 -9
  73. package/es/components/Tag/DismissibleTag.d.ts +3 -5
  74. package/es/components/Tag/DismissibleTag.js +1 -2
  75. package/es/components/Tag/OperationalTag.d.ts +2 -3
  76. package/es/components/Tag/OperationalTag.js +1 -2
  77. package/es/components/Tag/SelectableTag.d.ts +3 -5
  78. package/es/components/Tag/SelectableTag.js +1 -2
  79. package/es/components/Tag/Tag.d.ts +2 -3
  80. package/es/components/Tag/Tag.js +1 -2
  81. package/es/components/Tile/Tile.d.ts +3 -5
  82. package/es/components/Tile/Tile.js +8 -6
  83. package/es/components/Toggletip/index.js +2 -2
  84. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  85. package/es/components/Tooltip/Tooltip.d.ts +1 -1
  86. package/es/components/Tooltip/Tooltip.js +2 -2
  87. package/es/components/TreeView/TreeNode.d.ts +3 -5
  88. package/es/components/TreeView/TreeNode.js +3 -4
  89. package/es/components/TreeView/TreeView.js +2 -2
  90. package/es/components/UIShell/HeaderContainer.js +2 -2
  91. package/es/components/UIShell/HeaderMenu.js +2 -2
  92. package/es/components/UIShell/HeaderPanel.js +2 -2
  93. package/es/components/UIShell/SideNav.d.ts +1 -1
  94. package/es/components/UIShell/SideNav.js +2 -2
  95. package/es/components/UIShell/SideNavHeader.d.ts +2 -3
  96. package/es/components/UIShell/SideNavHeader.js +1 -2
  97. package/es/components/UIShell/SideNavLink.d.ts +2 -2
  98. package/es/components/UIShell/SideNavLink.js +1 -1
  99. package/es/components/UIShell/SideNavMenu.d.ts +2 -2
  100. package/es/components/UIShell/SideNavMenu.js +3 -3
  101. package/es/components/UIShell/SwitcherItem.js +2 -2
  102. package/es/internal/FloatingMenu.js +4 -4
  103. package/es/internal/OptimizedResize.d.ts +18 -0
  104. package/es/internal/OptimizedResize.js +21 -24
  105. package/es/internal/keyboard/index.d.ts +9 -0
  106. package/es/internal/keyboard/keys.d.ts +23 -0
  107. package/es/internal/keyboard/keys.js +2 -2
  108. package/es/internal/keyboard/match.d.ts +26 -0
  109. package/es/internal/keyboard/match.js +17 -41
  110. package/es/internal/keyboard/navigation.d.ts +37 -0
  111. package/es/internal/keyboard/navigation.js +15 -27
  112. package/es/internal/useMergedRefs.js +3 -0
  113. package/lib/components/Accordion/AccordionItem.js +2 -2
  114. package/lib/components/Button/Button.d.ts +2 -3
  115. package/lib/components/Button/Button.js +1 -2
  116. package/lib/components/Button/ButtonBase.js +1 -1
  117. package/lib/components/ChatButton/ChatButton.d.ts +2 -3
  118. package/lib/components/ChatButton/ChatButton.js +1 -2
  119. package/lib/components/ComboBox/ComboBox.js +40 -30
  120. package/lib/components/ComboButton/index.js +0 -1
  121. package/lib/components/ComposedModal/ComposedModal.js +64 -50
  122. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
  123. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
  124. package/lib/components/ContentSwitcher/ContentSwitcher.js +3 -3
  125. package/lib/components/ContextMenu/useContextMenu.d.ts +0 -1
  126. package/lib/components/ContextMenu/useContextMenu.js +1 -2
  127. package/lib/components/DataTable/TableBatchAction.d.ts +3 -3
  128. package/lib/components/DataTable/TableBatchAction.js +1 -1
  129. package/lib/components/DataTable/TableContainer.d.ts +1 -1
  130. package/lib/components/DataTable/TableContainer.js +3 -3
  131. package/lib/components/DataTable/TableExpandHeader.d.ts +6 -5
  132. package/lib/components/DataTable/TableToolbarMenu.d.ts +2 -2
  133. package/lib/components/DataTable/TableToolbarMenu.js +1 -1
  134. package/lib/components/DatePicker/DatePicker.js +2 -2
  135. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
  136. package/lib/components/Dialog/index.d.ts +42 -4
  137. package/lib/components/Dialog/index.js +190 -0
  138. package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -2
  139. package/lib/components/FeatureFlags/index.d.ts +3 -1
  140. package/lib/components/FeatureFlags/index.js +3 -0
  141. package/lib/components/FileUploader/FileUploader.d.ts +1 -1
  142. package/lib/components/FileUploader/FileUploader.js +2 -2
  143. package/lib/components/FileUploader/FileUploaderButton.js +2 -2
  144. package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
  145. package/lib/components/FileUploader/FileUploaderDropContainer.js +6 -4
  146. package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
  147. package/lib/components/FileUploader/FileUploaderItem.js +2 -2
  148. package/lib/components/Grid/CSSGrid.js +18 -14
  149. package/lib/components/Grid/FlexGrid.js +7 -6
  150. package/lib/components/Grid/GridTypes.d.ts +5 -3
  151. package/lib/components/IconButton/index.js +3 -3
  152. package/lib/components/Layer/index.d.ts +4 -6
  153. package/lib/components/Layer/index.js +5 -6
  154. package/lib/components/Link/Link.d.ts +2 -3
  155. package/lib/components/Link/Link.js +1 -2
  156. package/lib/components/ListBox/ListBoxMenuItem.d.ts +3 -3
  157. package/lib/components/ListBox/ListBoxMenuItem.js +36 -14
  158. package/lib/components/Menu/Menu.d.ts +1 -0
  159. package/lib/components/Menu/Menu.js +7 -9
  160. package/lib/components/Menu/MenuContext.d.ts +4 -4
  161. package/lib/components/Menu/MenuContext.js +6 -1
  162. package/lib/components/Menu/MenuItem.d.ts +2 -2
  163. package/lib/components/Menu/MenuItem.js +15 -23
  164. package/lib/components/MenuButton/index.js +14 -2
  165. package/lib/components/Modal/Modal.js +123 -51
  166. package/lib/components/ModalWrapper/ModalWrapper.js +1 -1
  167. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
  168. package/lib/components/MultiSelect/MultiSelect.js +2 -2
  169. package/lib/components/Notification/Notification.d.ts +5 -13
  170. package/lib/components/Notification/Notification.js +7 -9
  171. package/lib/components/OverflowMenu/OverflowMenu.d.ts +4 -8
  172. package/lib/components/OverflowMenu/OverflowMenu.js +3 -3
  173. package/lib/components/OverflowMenu/next/index.d.ts +2 -2
  174. package/lib/components/OverflowMenu/next/index.js +1 -1
  175. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  176. package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -2
  177. package/lib/components/RadioTile/RadioTile.js +2 -2
  178. package/lib/components/Search/Search.d.ts +2 -3
  179. package/lib/components/Search/Search.js +4 -6
  180. package/lib/components/Slider/Slider.d.ts +16 -15
  181. package/lib/components/Slider/Slider.js +22 -22
  182. package/lib/components/Tabs/Tabs.d.ts +3 -6
  183. package/lib/components/Tabs/Tabs.js +8 -9
  184. package/lib/components/Tag/DismissibleTag.d.ts +3 -5
  185. package/lib/components/Tag/DismissibleTag.js +1 -2
  186. package/lib/components/Tag/OperationalTag.d.ts +2 -3
  187. package/lib/components/Tag/OperationalTag.js +1 -2
  188. package/lib/components/Tag/SelectableTag.d.ts +3 -5
  189. package/lib/components/Tag/SelectableTag.js +1 -2
  190. package/lib/components/Tag/Tag.d.ts +2 -3
  191. package/lib/components/Tag/Tag.js +1 -2
  192. package/lib/components/Tile/Tile.d.ts +3 -5
  193. package/lib/components/Tile/Tile.js +8 -6
  194. package/lib/components/Toggletip/index.js +2 -2
  195. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  196. package/lib/components/Tooltip/Tooltip.d.ts +1 -1
  197. package/lib/components/Tooltip/Tooltip.js +2 -2
  198. package/lib/components/TreeView/TreeNode.d.ts +3 -5
  199. package/lib/components/TreeView/TreeNode.js +3 -4
  200. package/lib/components/TreeView/TreeView.js +2 -2
  201. package/lib/components/UIShell/HeaderContainer.js +2 -2
  202. package/lib/components/UIShell/HeaderMenu.js +2 -2
  203. package/lib/components/UIShell/HeaderPanel.js +2 -2
  204. package/lib/components/UIShell/SideNav.d.ts +1 -1
  205. package/lib/components/UIShell/SideNav.js +2 -2
  206. package/lib/components/UIShell/SideNavHeader.d.ts +2 -3
  207. package/lib/components/UIShell/SideNavHeader.js +1 -2
  208. package/lib/components/UIShell/SideNavLink.d.ts +2 -2
  209. package/lib/components/UIShell/SideNavLink.js +1 -1
  210. package/lib/components/UIShell/SideNavMenu.d.ts +2 -2
  211. package/lib/components/UIShell/SideNavMenu.js +3 -3
  212. package/lib/components/UIShell/SwitcherItem.js +2 -2
  213. package/lib/internal/FloatingMenu.js +5 -5
  214. package/lib/internal/OptimizedResize.d.ts +18 -0
  215. package/lib/internal/OptimizedResize.js +21 -24
  216. package/lib/internal/keyboard/index.d.ts +9 -0
  217. package/lib/internal/keyboard/keys.d.ts +23 -0
  218. package/lib/internal/keyboard/keys.js +2 -2
  219. package/lib/internal/keyboard/match.d.ts +26 -0
  220. package/lib/internal/keyboard/match.js +17 -41
  221. package/lib/internal/keyboard/navigation.d.ts +37 -0
  222. package/lib/internal/keyboard/navigation.js +15 -27
  223. package/lib/internal/useMergedRefs.js +3 -0
  224. package/package.json +7 -7
  225. package/scss/components/dialog/_dialog.scss +9 -0
  226. package/scss/components/dialog/_index.scss +9 -0
  227. package/telemetry.yml +1 -0
  228. package/es/components/Modal/next/index.d.ts +0 -171
  229. package/es/internal/focus/index.js +0 -15
  230. package/lib/components/Modal/next/index.d.ts +0 -171
  231. package/lib/internal/focus/index.js +0 -19
@@ -12,9 +12,28 @@ export interface DialogProps extends ReactAttr<HTMLDialogElement> {
12
12
  */
13
13
  children?: React.ReactNode;
14
14
  /**
15
- * Specifies whether the dialog is modal or non-modal
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 { unstable__Dialog };
30
- export default unstable__Dialog;
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
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
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.
@@ -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 {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
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.
@@ -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 addedFiles = validateFiles(files);
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 addedFiles = validateFiles(files);
82
+ const filesToValidate = multiple ? files : [files[0]];
83
+ const addedFiles = validateFiles(filesToValidate);
82
84
  return onAddFiles(event, {
83
85
  addedFiles
84
86
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
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.
@@ -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
- function CSSGrid(_ref) {
15
+ const CSSGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
16
16
  let {
17
17
  align,
18
- as: BaseComponent = 'div',
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
- as: BaseComponent,
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 BaseComponentAsAny = BaseComponent;
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(BaseComponentAsAny, _extends({
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: BaseComponent = 'div',
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>
@@ -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
- function FlexGrid(_ref) {
15
+ const FlexGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
16
16
  let {
17
- as: BaseComponent = 'div',
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 BaseComponentAsAny = BaseComponent;
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(BaseComponentAsAny, _extends({
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 { PolymorphicProps } from '../../types/common';
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> = PolymorphicProps<T, GridBaseProps>;
32
+ export type GridProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, GridBaseProps>;
33
33
  export interface GridComponent {
34
- <T extends React.ElementType>(props: GridProps<T>, context?: any): React.ReactElement<any, any> | null;
34
+ <T extends React.ElementType = 'div'>(props: GridProps<T>): React.ReactElement | null;
35
+ displayName?: string;
36
+ propTypes?: React.WeakValidationMap<GridProps<any>>;
35
37
  }
@@ -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
- className: cx(`${prefix}--btn--icon-only`, {
80
- [`${prefix}--btn--selected`]: isSelected
81
- }, className),
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,
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import { LayerLevel } from './LayerLevel';
9
- import { PolymorphicProps } from '../../types/common';
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> = PolymorphicProps<T, LayerBaseProps>;
34
- export interface LayerComponent {
35
- <T extends React.ElementType>(props: LayerProps<T>, context?: any): React.ReactElement<any, any> | null;
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 };
@@ -24,9 +24,9 @@ function useLayer() {
24
24
  level
25
25
  };
26
26
  }
27
- const LayerRenderFunction = /*#__PURE__*/React__default.forwardRef(function Layer(_ref, ref) {
27
+ const Layer = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
28
28
  let {
29
- as = 'div',
29
+ as,
30
30
  className: customClassName,
31
31
  children,
32
32
  level: overrideLevel,
@@ -38,7 +38,7 @@ const LayerRenderFunction = /*#__PURE__*/React__default.forwardRef(function Laye
38
38
  const className = cx(`${prefix}--layer-${levels[level]}`, customClassName);
39
39
  // The level should be between MIN_LEVEL and MAX_LEVEL
40
40
  const value = Math.max(MIN_LEVEL, Math.min(level + 1, MAX_LEVEL));
41
- const BaseComponent = as;
41
+ const BaseComponent = as || 'div';
42
42
  return /*#__PURE__*/React__default.createElement(LayerContext.Provider, {
43
43
  value: value
44
44
  }, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
@@ -47,8 +47,8 @@ const LayerRenderFunction = /*#__PURE__*/React__default.forwardRef(function Laye
47
47
  className: className
48
48
  }), children));
49
49
  });
50
- LayerRenderFunction.displayName = 'Layer';
51
- LayerRenderFunction.propTypes = {
50
+ Layer.displayName = 'Layer';
51
+ Layer.propTypes = {
52
52
  /**
53
53
  * Specify a custom component or element to be rendered as the top-level
54
54
  * element in the component
@@ -68,6 +68,5 @@ LayerRenderFunction.propTypes = {
68
68
  */
69
69
  level: PropTypes.oneOf([0, 1, 2])
70
70
  };
71
- const Layer = LayerRenderFunction;
72
71
 
73
72
  export { Layer, useLayer };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
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.
@@ -31,8 +31,7 @@ export interface LinkBaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
31
31
  */
32
32
  inline?: boolean;
33
33
  /**
34
- * @description Optional prop to render an icon next to the link.
35
- * Can be a React component class
34
+ * A component used to render an icon.
36
35
  */
37
36
  renderIcon?: ComponentType;
38
37
  /**
@@ -82,8 +82,7 @@ Link.propTypes = {
82
82
  */
83
83
  inline: PropTypes.bool,
84
84
  /**
85
- * Optional prop to render an icon next to the link.
86
- * Can be a React component class
85
+ * A component used to render an icon.
87
86
  */
88
87
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
89
88
  /**