@carbon/react 1.91.0 → 1.92.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 +989 -1014
- package/es/components/Accordion/AccordionItem.d.ts +12 -1
- package/es/components/Accordion/AccordionItem.js +9 -2
- package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/es/components/Checkbox/Checkbox.js +2 -2
- package/es/components/ComboBox/ComboBox.js +39 -23
- package/es/components/ComboButton/index.js +1 -1
- package/es/components/ComposedModal/ComposedModal.js +66 -17
- package/es/components/ComposedModal/ComposedModalPresence.d.ts +34 -0
- package/es/components/ComposedModal/ComposedModalPresence.js +42 -0
- package/es/components/ComposedModal/index.d.ts +1 -0
- package/es/components/ComposedModal/useComposedModalState.d.ts +7 -0
- package/es/components/ComposedModal/useComposedModalState.js +24 -0
- package/es/components/DataTable/TableBatchActions.js +2 -2
- package/es/components/DatePicker/DatePicker.js +14 -6
- package/es/components/DatePickerInput/DatePickerInput.js +3 -3
- package/es/components/Dialog/Dialog.js +2 -2
- package/es/components/Dropdown/Dropdown.js +5 -5
- package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
- package/es/components/FeatureFlags/index.d.ts +2 -1
- package/es/components/FeatureFlags/index.js +3 -1
- package/es/components/FileUploader/FileUploader.js +2 -2
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/FluidTextInput/FluidPasswordInput.js +24 -5
- package/es/components/FluidTextInput/index.js +1 -1
- package/es/components/FormLabel/FormLabel.js +1 -1
- package/es/components/ListBox/ListBox.d.ts +1 -1
- package/es/components/ListBox/ListBox.js +1 -2
- package/es/components/ListItem/ListItem.js +1 -1
- package/es/components/Menu/MenuItem.js +2 -2
- package/es/components/MenuButton/index.d.ts +2 -2
- package/es/components/MenuButton/index.js +2 -2
- package/es/components/Modal/Modal.js +60 -10
- package/es/components/Modal/ModalPresence.d.ts +32 -0
- package/es/components/Modal/ModalPresence.js +37 -0
- package/es/components/Modal/index.d.ts +2 -1
- package/es/components/Modal/index.js +1 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
- package/es/components/MultiSelect/MultiSelect.js +6 -5
- package/es/components/Notification/Notification.js +2 -2
- package/es/components/NumberInput/NumberInput.d.ts +21 -11
- package/es/components/NumberInput/NumberInput.js +40 -26
- package/es/components/OverflowMenu/OverflowMenu.js +2 -3
- package/es/components/OverflowMenu/next/index.js +1 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
- package/es/components/PageHeader/PageHeader.js +2 -2
- package/es/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/es/components/RadioButton/RadioButton.js +3 -3
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
- package/es/components/RadioTile/RadioTile.js +2 -2
- package/es/components/Select/Select.js +2 -2
- package/es/components/Slider/Slider.js +2 -2
- package/es/components/StructuredList/StructuredList.js +2 -2
- package/es/components/Tabs/Tabs.js +2 -2
- package/es/components/Tag/DismissibleTag.js +3 -3
- package/es/components/Tag/OperationalTag.js +3 -3
- package/es/components/Tag/SelectableTag.js +3 -3
- package/es/components/Tag/Tag.js +2 -2
- package/es/components/Text/Text.d.ts +1 -1
- package/es/components/Text/Text.js +0 -1
- package/es/components/Text/TextDirection.d.ts +1 -1
- package/es/components/Text/TextDirection.js +0 -1
- package/es/components/Text/createTextComponent.d.ts +2 -8
- package/es/components/Text/createTextComponent.js +2 -2
- package/es/components/Text/index.d.ts +0 -8
- package/es/components/TextArea/TextArea.js +2 -2
- package/es/components/TextInput/TextInput.js +2 -2
- package/es/components/Tile/Tile.js +2 -2
- package/es/components/Toggle/Toggle.js +2 -2
- package/es/components/UIShell/Switcher.js +0 -26
- package/es/index.d.ts +1 -1
- package/es/index.js +6 -4
- package/es/internal/useNormalizedInputProps.js +2 -2
- package/es/internal/usePresence.d.ts +17 -0
- package/es/internal/usePresence.js +66 -0
- package/es/internal/usePresenceContext.d.ts +25 -0
- package/es/internal/usePresenceContext.js +46 -0
- package/es/tools/mergeRefs.d.ts +5 -5
- package/es/tools/mergeRefs.js +16 -12
- package/lib/components/Accordion/AccordionItem.d.ts +12 -1
- package/lib/components/Accordion/AccordionItem.js +9 -2
- package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/components/Checkbox/Checkbox.js +2 -2
- package/lib/components/ComboBox/ComboBox.js +39 -23
- package/lib/components/ComboButton/index.js +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +65 -16
- package/lib/components/ComposedModal/ComposedModalPresence.d.ts +34 -0
- package/lib/components/ComposedModal/ComposedModalPresence.js +46 -0
- package/lib/components/ComposedModal/index.d.ts +1 -0
- package/lib/components/ComposedModal/useComposedModalState.d.ts +7 -0
- package/lib/components/ComposedModal/useComposedModalState.js +26 -0
- package/lib/components/DataTable/TableBatchActions.js +2 -2
- package/lib/components/DatePicker/DatePicker.js +14 -6
- package/lib/components/DatePickerInput/DatePickerInput.js +3 -3
- package/lib/components/Dialog/Dialog.js +2 -2
- package/lib/components/Dropdown/Dropdown.js +3 -3
- package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -1
- package/lib/components/FeatureFlags/index.d.ts +2 -1
- package/lib/components/FeatureFlags/index.js +3 -1
- package/lib/components/FileUploader/FileUploader.js +2 -2
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/FluidTextInput/FluidPasswordInput.js +26 -5
- package/lib/components/FluidTextInput/index.js +2 -1
- package/lib/components/FormLabel/FormLabel.js +1 -1
- package/lib/components/ListBox/ListBox.d.ts +1 -1
- package/lib/components/ListBox/ListBox.js +1 -2
- package/lib/components/ListItem/ListItem.js +1 -1
- package/lib/components/Menu/MenuItem.js +2 -2
- package/lib/components/MenuButton/index.d.ts +2 -2
- package/lib/components/MenuButton/index.js +2 -2
- package/lib/components/Modal/Modal.js +59 -9
- package/lib/components/Modal/ModalPresence.d.ts +32 -0
- package/lib/components/Modal/ModalPresence.js +41 -0
- package/lib/components/Modal/index.d.ts +2 -1
- package/lib/components/Modal/index.js +1 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
- package/lib/components/MultiSelect/MultiSelect.js +4 -3
- package/lib/components/Notification/Notification.js +2 -2
- package/lib/components/NumberInput/NumberInput.d.ts +21 -11
- package/lib/components/NumberInput/NumberInput.js +40 -26
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -3
- package/lib/components/OverflowMenu/next/index.js +1 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
- package/lib/components/PageHeader/PageHeader.js +2 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/lib/components/RadioButton/RadioButton.js +3 -3
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +3 -3
- package/lib/components/RadioTile/RadioTile.js +2 -2
- package/lib/components/Select/Select.js +2 -2
- package/lib/components/Slider/Slider.js +2 -2
- package/lib/components/StructuredList/StructuredList.js +2 -2
- package/lib/components/Tabs/Tabs.js +2 -2
- package/lib/components/Tag/DismissibleTag.js +3 -3
- package/lib/components/Tag/OperationalTag.js +3 -3
- package/lib/components/Tag/SelectableTag.js +3 -3
- package/lib/components/Tag/Tag.js +2 -2
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.js +0 -1
- package/lib/components/Text/TextDirection.d.ts +1 -1
- package/lib/components/Text/TextDirection.js +0 -1
- package/lib/components/Text/createTextComponent.d.ts +2 -8
- package/lib/components/Text/createTextComponent.js +2 -2
- package/lib/components/Text/index.d.ts +0 -8
- package/lib/components/TextArea/TextArea.js +2 -2
- package/lib/components/TextInput/TextInput.js +2 -2
- package/lib/components/Tile/Tile.js +2 -2
- package/lib/components/Toggle/Toggle.js +2 -2
- package/lib/components/UIShell/Switcher.js +0 -26
- package/lib/index.d.ts +1 -1
- package/lib/index.js +13 -8
- package/lib/internal/useNormalizedInputProps.js +2 -2
- package/lib/internal/usePresence.d.ts +17 -0
- package/lib/internal/usePresence.js +68 -0
- package/lib/internal/usePresenceContext.d.ts +25 -0
- package/lib/internal/usePresenceContext.js +48 -0
- package/lib/tools/mergeRefs.d.ts +5 -5
- package/lib/tools/mergeRefs.js +16 -14
- package/package.json +7 -7
- package/telemetry.yml +4 -0
- package/es/components/Text/index.js +0 -16
- package/lib/components/Text/index.js +0 -20
|
@@ -88,7 +88,7 @@ const MenuButton = /*#__PURE__*/React.forwardRef(({
|
|
|
88
88
|
middleware: middlewares,
|
|
89
89
|
whileElementsMounted: react.autoUpdate
|
|
90
90
|
});
|
|
91
|
-
const ref = mergeRefs.
|
|
91
|
+
const ref = mergeRefs.mergeRefs(forwardRef, triggerRef);
|
|
92
92
|
const {
|
|
93
93
|
open,
|
|
94
94
|
handleClick: hookOnClick,
|
|
@@ -179,7 +179,7 @@ MenuButton.propTypes = {
|
|
|
179
179
|
*/
|
|
180
180
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
181
181
|
// @ts-ignore-next-line -- avoid spurious (?) TS2322 error
|
|
182
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
182
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
183
183
|
/**
|
|
184
184
|
* Specify the tabIndex of the button.
|
|
185
185
|
*/
|
|
@@ -24,13 +24,15 @@ var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropI
|
|
|
24
24
|
var wrapFocus = require('../../internal/wrapFocus.js');
|
|
25
25
|
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
26
26
|
var useId = require('../../internal/useId.js');
|
|
27
|
+
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
27
28
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
28
29
|
var usePreviousValue = require('../../internal/usePreviousValue.js');
|
|
29
30
|
var keys = require('../../internal/keyboard/keys.js');
|
|
30
31
|
var match = require('../../internal/keyboard/match.js');
|
|
31
32
|
var index$2 = require('../IconButton/index.js');
|
|
32
33
|
var noopFn = require('../../internal/noopFn.js');
|
|
33
|
-
require('../Text/
|
|
34
|
+
var Text = require('../Text/Text.js');
|
|
35
|
+
require('../Text/TextDirection.js');
|
|
34
36
|
var index = require('../FeatureFlags/index.js');
|
|
35
37
|
var events = require('../../tools/events.js');
|
|
36
38
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
@@ -38,12 +40,40 @@ var Dialog = require('../Dialog/Dialog.js');
|
|
|
38
40
|
var index$1 = require('../AILabel/index.js');
|
|
39
41
|
var utils = require('../../internal/utils.js');
|
|
40
42
|
var warning = require('../../internal/warning.js');
|
|
43
|
+
var ModalPresence = require('./ModalPresence.js');
|
|
41
44
|
var debounce = require('../../node_modules/es-toolkit/dist/compat/function/debounce.js');
|
|
42
|
-
var Text = require('../Text/Text.js');
|
|
43
45
|
|
|
44
46
|
const ModalSizes = ['xs', 'sm', 'md', 'lg'];
|
|
45
47
|
const invalidOutsideClickMessage = '`<Modal>` prop `preventCloseOnClickOutside` should not be `false` when ' + '`passiveModal` is `false`. Transactional, non-passive Modals should ' + 'not be dissmissable by clicking outside. ' + 'See: https://carbondesignsystem.com/components/modal/usage/#transactional-modal';
|
|
46
48
|
const Modal = /*#__PURE__*/React.forwardRef(function Modal({
|
|
49
|
+
open,
|
|
50
|
+
...props
|
|
51
|
+
}, ref) {
|
|
52
|
+
const id = useId.useId();
|
|
53
|
+
const enablePresence = index.useFeatureFlag('enable-presence');
|
|
54
|
+
const hasPresenceContext = Boolean(React.useContext(ModalPresence.ModalPresenceContext));
|
|
55
|
+
const hasPresenceOptIn = enablePresence || hasPresenceContext;
|
|
56
|
+
const exclusivePresenceContext = ModalPresence.useExclusiveModalPresenceContext(id);
|
|
57
|
+
|
|
58
|
+
// if opt in and not exclusive to a presence context, wrap with presence
|
|
59
|
+
if (hasPresenceOptIn && !exclusivePresenceContext) {
|
|
60
|
+
return /*#__PURE__*/React.createElement(ModalPresence.ModalPresence, {
|
|
61
|
+
open: open ?? false,
|
|
62
|
+
_presenceId: id
|
|
63
|
+
// do not auto enable styles for opt-in by feature flag
|
|
64
|
+
,
|
|
65
|
+
_autoEnablePresence: hasPresenceContext
|
|
66
|
+
}, /*#__PURE__*/React.createElement(ModalDialog, _rollupPluginBabelHelpers.extends({
|
|
67
|
+
open: true,
|
|
68
|
+
ref: ref
|
|
69
|
+
}, props)));
|
|
70
|
+
}
|
|
71
|
+
return /*#__PURE__*/React.createElement(ModalDialog, _rollupPluginBabelHelpers.extends({
|
|
72
|
+
ref: ref,
|
|
73
|
+
open: open
|
|
74
|
+
}, props));
|
|
75
|
+
});
|
|
76
|
+
const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
|
|
47
77
|
'aria-label': ariaLabelProp,
|
|
48
78
|
children,
|
|
49
79
|
className,
|
|
@@ -54,7 +84,7 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal({
|
|
|
54
84
|
passiveModal = false,
|
|
55
85
|
secondaryButtonText,
|
|
56
86
|
primaryButtonText,
|
|
57
|
-
open,
|
|
87
|
+
open: externalOpen,
|
|
58
88
|
onRequestClose = noopFn.noopFn,
|
|
59
89
|
onRequestSubmit = noopFn.noopFn,
|
|
60
90
|
onSecondarySubmit,
|
|
@@ -87,7 +117,6 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal({
|
|
|
87
117
|
const endTrap = React.useRef(null);
|
|
88
118
|
const wrapFocusTimeout = React.useRef(null);
|
|
89
119
|
const [isScrollable, setIsScrollable] = React.useState(false);
|
|
90
|
-
const prevOpen = usePreviousValue.usePreviousValue(open);
|
|
91
120
|
const modalInstanceId = `modal-${useId.useId()}`;
|
|
92
121
|
const modalLabelId = `${prefix}--modal-header__label--${modalInstanceId}`;
|
|
93
122
|
const modalHeadingId = `${prefix}--modal-header__heading--${modalInstanceId}`;
|
|
@@ -97,6 +126,13 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal({
|
|
|
97
126
|
[`${prefix}--btn--loading`]: loadingStatus !== 'inactive'
|
|
98
127
|
});
|
|
99
128
|
const loadingActive = loadingStatus !== 'inactive';
|
|
129
|
+
const presenceContext = React.useContext(ModalPresence.ModalPresenceContext);
|
|
130
|
+
const mergedRefs = useMergedRefs.useMergedRefs([ref, presenceContext?.presenceRef]);
|
|
131
|
+
const enablePresence = index.useFeatureFlag('enable-presence') || presenceContext?.autoEnablePresence;
|
|
132
|
+
|
|
133
|
+
// always mark as open when mounted with presence
|
|
134
|
+
const open = externalOpen || enablePresence;
|
|
135
|
+
const prevOpen = usePreviousValue.usePreviousValue(open);
|
|
100
136
|
const focusTrapWithoutSentinels = index.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
|
|
101
137
|
const enableDialogElement = index.useFeatureFlag('enable-dialog-element');
|
|
102
138
|
process.env.NODE_ENV !== "production" ? warning.warning(!(focusTrapWithoutSentinels && enableDialogElement), '`<Modal>` detected both `focusTrapWithoutSentinels` and ' + '`enableDialogElement` feature flags are enabled. The native dialog ' + 'element handles focus, so `enableDialogElement` must be off for ' + '`focusTrapWithoutSentinels` to have any effect.') : void 0;
|
|
@@ -192,7 +228,8 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal({
|
|
|
192
228
|
const onSecondaryButtonClick = onSecondarySubmit ? onSecondarySubmit : onRequestClose;
|
|
193
229
|
const modalClasses = cx(`${prefix}--modal`, {
|
|
194
230
|
[`${prefix}--modal-tall`]: !passiveModal,
|
|
195
|
-
'is-visible': open,
|
|
231
|
+
'is-visible': enablePresence || open,
|
|
232
|
+
[`${prefix}--modal--enable-presence`]: presenceContext?.autoEnablePresence,
|
|
196
233
|
[`${prefix}--modal--danger`]: danger,
|
|
197
234
|
[`${prefix}--modal--slug`]: slug,
|
|
198
235
|
[`${prefix}--modal--decorator`]: decorator
|
|
@@ -256,14 +293,25 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal({
|
|
|
256
293
|
}
|
|
257
294
|
}, [open, prefix, enableDialogElement]);
|
|
258
295
|
React.useEffect(() => {
|
|
259
|
-
if (!enableDialogElement && prevOpen && !open && launcherButtonRef) {
|
|
296
|
+
if (!enableDialogElement && !enablePresence && prevOpen && !open && launcherButtonRef) {
|
|
260
297
|
setTimeout(() => {
|
|
261
298
|
if ('current' in launcherButtonRef) {
|
|
262
299
|
launcherButtonRef.current?.focus();
|
|
263
300
|
}
|
|
264
301
|
});
|
|
265
302
|
}
|
|
266
|
-
}, [open, prevOpen, launcherButtonRef, enableDialogElement]);
|
|
303
|
+
}, [open, prevOpen, launcherButtonRef, enableDialogElement, enablePresence]);
|
|
304
|
+
// Focus launcherButtonRef on unmount
|
|
305
|
+
React.useEffect(() => {
|
|
306
|
+
const launcherButton = launcherButtonRef?.current;
|
|
307
|
+
return () => {
|
|
308
|
+
if (enablePresence && launcherButton) {
|
|
309
|
+
setTimeout(() => {
|
|
310
|
+
launcherButton.focus();
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
}, [enablePresence, launcherButtonRef]);
|
|
267
315
|
React.useEffect(() => {
|
|
268
316
|
if (!enableDialogElement) {
|
|
269
317
|
const initialFocus = focusContainerElement => {
|
|
@@ -335,7 +383,8 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal({
|
|
|
335
383
|
role: isAlertDialog ? 'alertdialog' : '',
|
|
336
384
|
"aria-describedby": isAlertDialog ? modalBodyId : '',
|
|
337
385
|
className: containerClasses,
|
|
338
|
-
"aria-label": ariaLabel
|
|
386
|
+
"aria-label": ariaLabel,
|
|
387
|
+
"data-exiting": presenceContext?.isExiting || undefined
|
|
339
388
|
}, /*#__PURE__*/React.createElement("div", {
|
|
340
389
|
className: `${prefix}--modal-header`
|
|
341
390
|
}, modalLabel && /*#__PURE__*/React.createElement(Text.Text, {
|
|
@@ -462,7 +511,8 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal({
|
|
|
462
511
|
onBlur: handleBlur,
|
|
463
512
|
className: modalClasses,
|
|
464
513
|
role: "presentation",
|
|
465
|
-
ref:
|
|
514
|
+
ref: mergedRefs,
|
|
515
|
+
"data-exiting": presenceContext?.isExiting || undefined
|
|
466
516
|
}), modalBody);
|
|
467
517
|
});
|
|
468
518
|
Modal.propTypes = {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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 PropsWithChildren } from 'react';
|
|
8
|
+
import { type PresenceContext } from '../../internal/usePresenceContext';
|
|
9
|
+
export interface ModalPresenceProps {
|
|
10
|
+
/**
|
|
11
|
+
* Specify whether the Modal is currently open
|
|
12
|
+
*/
|
|
13
|
+
open: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Internal property for backwards compatibility. Specify whether the Modal should opt in to presence mode.
|
|
16
|
+
*/
|
|
17
|
+
_autoEnablePresence?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Internal property to predefine the presence context's id for exclusivity.
|
|
20
|
+
*/
|
|
21
|
+
_presenceId?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const ModalPresence: ({ open, _presenceId: presenceId, _autoEnablePresence: autoEnablePresence, children, }: PropsWithChildren<ModalPresenceProps>) => import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
+
interface ModalPresenceContextProps extends PresenceContext {
|
|
25
|
+
autoEnablePresence: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const ModalPresenceContext: React.Context<ModalPresenceContextProps | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Handles occurrences where only a single modal must consume a context.
|
|
30
|
+
*/
|
|
31
|
+
export declare const useExclusiveModalPresenceContext: (id: string) => ModalPresenceContextProps | undefined;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var React = require('react');
|
|
11
|
+
var usePresenceContext = require('../../internal/usePresenceContext.js');
|
|
12
|
+
|
|
13
|
+
const ModalPresence = ({
|
|
14
|
+
open,
|
|
15
|
+
_presenceId: presenceId,
|
|
16
|
+
_autoEnablePresence: autoEnablePresence = true,
|
|
17
|
+
children
|
|
18
|
+
}) => {
|
|
19
|
+
const [isPresent, context] = usePresenceContext.usePresenceContext(open, presenceId);
|
|
20
|
+
const contextValue = React.useMemo(() => ({
|
|
21
|
+
autoEnablePresence,
|
|
22
|
+
...context
|
|
23
|
+
}), [autoEnablePresence, context]);
|
|
24
|
+
if (!isPresent) return null;
|
|
25
|
+
return /*#__PURE__*/React.createElement(ModalPresenceContext.Provider, {
|
|
26
|
+
value: contextValue
|
|
27
|
+
}, children);
|
|
28
|
+
};
|
|
29
|
+
const ModalPresenceContext = /*#__PURE__*/React.createContext(undefined);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Handles occurrences where only a single modal must consume a context.
|
|
33
|
+
*/
|
|
34
|
+
const useExclusiveModalPresenceContext = id => {
|
|
35
|
+
const ctx = React.useContext(ModalPresenceContext);
|
|
36
|
+
return ctx?.isPresenceExclusive(id) ? ctx : undefined;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.ModalPresence = ModalPresence;
|
|
40
|
+
exports.ModalPresenceContext = ModalPresenceContext;
|
|
41
|
+
exports.useExclusiveModalPresenceContext = useExclusiveModalPresenceContext;
|
|
@@ -5,5 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import Modal, { type ModalProps } from './Modal';
|
|
8
|
+
import { ModalPresence, type ModalPresenceProps } from './ModalPresence';
|
|
8
9
|
export default Modal;
|
|
9
|
-
export { Modal, type ModalProps };
|
|
10
|
+
export { Modal, ModalPresence, type ModalProps, type ModalPresenceProps };
|
|
@@ -625,14 +625,14 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
625
625
|
setIsFocused(evt?.type === 'focus' ? true : false);
|
|
626
626
|
}
|
|
627
627
|
};
|
|
628
|
-
const mergedRef = mergeRefs.
|
|
628
|
+
const mergedRef = mergeRefs.mergeRefs(textInput, inputProp.ref);
|
|
629
629
|
const readOnlyEventHandlers = readOnly ? {
|
|
630
630
|
onClick: evt => {
|
|
631
631
|
// NOTE: does not prevent click
|
|
632
632
|
evt.preventDefault();
|
|
633
633
|
// focus on the element as per readonly input behavior
|
|
634
|
-
if (
|
|
635
|
-
|
|
634
|
+
if (textInput.current) {
|
|
635
|
+
textInput.current.focus();
|
|
636
636
|
}
|
|
637
637
|
},
|
|
638
638
|
onKeyDown: evt => {
|
|
@@ -235,7 +235,8 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
|
-
const
|
|
238
|
+
const toggleButtonRef = React.useRef(null);
|
|
239
|
+
const mergedRef = mergeRefs.mergeRefs(toggleButtonProps.ref, ref, toggleButtonRef);
|
|
239
240
|
const selectedItems = selectedItem;
|
|
240
241
|
|
|
241
242
|
/**
|
|
@@ -390,8 +391,8 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
390
391
|
// NOTE: does not prevent click
|
|
391
392
|
evt.preventDefault();
|
|
392
393
|
// focus on the element as per readonly input behavior
|
|
393
|
-
if (
|
|
394
|
-
|
|
394
|
+
if (toggleButtonRef.current) {
|
|
395
|
+
toggleButtonRef.current.focus();
|
|
395
396
|
}
|
|
396
397
|
},
|
|
397
398
|
onKeyDown: evt => {
|
|
@@ -13,7 +13,8 @@ var React = require('react');
|
|
|
13
13
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
14
14
|
var cx = require('classnames');
|
|
15
15
|
var iconsReact = require('@carbon/icons-react');
|
|
16
|
-
require('../Text/
|
|
16
|
+
var Text = require('../Text/Text.js');
|
|
17
|
+
require('../Text/TextDirection.js');
|
|
17
18
|
var Button = require('../Button/Button.js');
|
|
18
19
|
require('../Button/Button.Skeleton.js');
|
|
19
20
|
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
@@ -27,7 +28,6 @@ var wrapFocus = require('../../internal/wrapFocus.js');
|
|
|
27
28
|
var index = require('../FeatureFlags/index.js');
|
|
28
29
|
var warning = require('../../internal/warning.js');
|
|
29
30
|
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
30
|
-
var Text = require('../Text/Text.js');
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Conditionally call a callback when the escape key is pressed
|
|
@@ -17,6 +17,26 @@ export declare const translationIds: {
|
|
|
17
17
|
type TranslationKey = keyof typeof translationIds;
|
|
18
18
|
type ExcludedAttributes = 'defaultValue' | 'id' | 'min' | 'max' | 'onChange' | 'onClick' | 'size' | 'step' | 'value';
|
|
19
19
|
export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<TranslationKey> {
|
|
20
|
+
/**
|
|
21
|
+
* Optional validation function that is called with the input value and locale.
|
|
22
|
+
* This is called before other validations, giving consumers the ability
|
|
23
|
+
* to short-circuit or extend validation without replacing built-in rules
|
|
24
|
+
* @example
|
|
25
|
+
* // Using the built-in separator validation
|
|
26
|
+
* <NumberInput validate={validateNumberSeparators} />
|
|
27
|
+
*
|
|
28
|
+
* // Combining with custom validation
|
|
29
|
+
* <NumberInput
|
|
30
|
+
* validate={(value, locale) => {
|
|
31
|
+
* return validateNumberSeparators(value, locale) && customValidation(value)
|
|
32
|
+
* }}
|
|
33
|
+
* />
|
|
34
|
+
* - Return `false` to immediately fail validation.
|
|
35
|
+
* - Return `true` to pass this validation, but still run other checks (min, max, required, etc.).
|
|
36
|
+
* - Return `undefined` to defer entirely to built-in validation logic.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
validate?: (value: string, locale: string) => boolean | undefined;
|
|
20
40
|
/**
|
|
21
41
|
* `true` to allow empty string.
|
|
22
42
|
*/
|
|
@@ -186,16 +206,6 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
186
206
|
*/
|
|
187
207
|
warnText?: ReactNode;
|
|
188
208
|
}
|
|
209
|
+
export declare const validateNumberSeparators: (input: string, locale: string) => boolean;
|
|
189
210
|
declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
190
|
-
export interface Label {
|
|
191
|
-
disabled?: boolean;
|
|
192
|
-
hideLabel?: boolean;
|
|
193
|
-
id?: string;
|
|
194
|
-
label?: ReactNode;
|
|
195
|
-
}
|
|
196
|
-
export interface HelperTextProps {
|
|
197
|
-
id?: string;
|
|
198
|
-
description?: ReactNode;
|
|
199
|
-
disabled?: boolean;
|
|
200
|
-
}
|
|
201
211
|
export { NumberInput };
|
|
@@ -18,7 +18,8 @@ var usePrefix = require('../../internal/usePrefix.js');
|
|
|
18
18
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
19
19
|
require('../FluidForm/FluidForm.js');
|
|
20
20
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
21
|
-
require('../Text/
|
|
21
|
+
var Text = require('../Text/Text.js');
|
|
22
|
+
require('../Text/TextDirection.js');
|
|
22
23
|
var clamp = require('../../internal/clamp.js');
|
|
23
24
|
var useControllableState = require('../../internal/useControllableState.js');
|
|
24
25
|
var utilities = require('@carbon/utilities');
|
|
@@ -27,7 +28,6 @@ var match = require('../../internal/keyboard/match.js');
|
|
|
27
28
|
var NumberFormatPropTypes = require('./NumberFormatPropTypes.js');
|
|
28
29
|
var index = require('../AILabel/index.js');
|
|
29
30
|
var utils = require('../../internal/utils.js');
|
|
30
|
-
var Text = require('../Text/Text.js');
|
|
31
31
|
|
|
32
32
|
var _Subtract, _Add;
|
|
33
33
|
const translationIds = {
|
|
@@ -43,6 +43,7 @@ const defaultTranslations = {
|
|
|
43
43
|
[translationIds['increment.number']]: 'Increment number',
|
|
44
44
|
[translationIds['decrement.number']]: 'Decrement number'
|
|
45
45
|
};
|
|
46
|
+
|
|
46
47
|
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
47
48
|
const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
48
49
|
const {
|
|
@@ -77,6 +78,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
77
78
|
translateWithId: t = id => defaultTranslations[id],
|
|
78
79
|
type = 'number',
|
|
79
80
|
defaultValue = type === 'number' ? 0 : NaN,
|
|
81
|
+
validate,
|
|
80
82
|
warn = false,
|
|
81
83
|
warnText = '',
|
|
82
84
|
stepStartValue = 0,
|
|
@@ -123,7 +125,6 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
123
125
|
* Only used when type="text"
|
|
124
126
|
*/
|
|
125
127
|
const [previousNumberValue, setPreviousNumberValue] = React.useState(numberValue);
|
|
126
|
-
|
|
127
128
|
/**
|
|
128
129
|
* The current text value of the input.
|
|
129
130
|
* Only used when type=text
|
|
@@ -154,9 +155,11 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
154
155
|
const isInputValid = getInputValidity({
|
|
155
156
|
allowEmpty,
|
|
156
157
|
invalid,
|
|
157
|
-
value: type === 'number' ? value : numberValue,
|
|
158
|
+
value: validate ? inputValue : type === 'number' ? value : numberValue,
|
|
158
159
|
max,
|
|
159
|
-
min
|
|
160
|
+
min,
|
|
161
|
+
validate,
|
|
162
|
+
locale
|
|
160
163
|
});
|
|
161
164
|
const normalizedProps = useNormalizedInputProps.useNormalizedInputProps({
|
|
162
165
|
id,
|
|
@@ -214,8 +217,6 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
214
217
|
}
|
|
215
218
|
if (type === 'text') {
|
|
216
219
|
const _value = allowEmpty && event.target.value === '' ? '' : event.target.value;
|
|
217
|
-
|
|
218
|
-
// When isControlled, setNumberValue will not update numberValue in useControllableState.
|
|
219
220
|
setNumberValue(numberParser.parse(_value));
|
|
220
221
|
setInputValue(_value);
|
|
221
222
|
// The onChange prop isn't called here because it will be called on blur
|
|
@@ -265,7 +266,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
265
266
|
rawValue = currentValue - step;
|
|
266
267
|
}
|
|
267
268
|
const precision = Math.max(getDecimalPlaces(currentValue), getDecimalPlaces(step));
|
|
268
|
-
const floatValue = parseFloat(rawValue.toFixed(precision));
|
|
269
|
+
const floatValue = parseFloat(Number(rawValue).toFixed(precision));
|
|
269
270
|
const newValue = clamp.clamp(floatValue, min ?? -Infinity, max ?? Infinity);
|
|
270
271
|
const state = {
|
|
271
272
|
value: newValue,
|
|
@@ -376,13 +377,15 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
376
377
|
// they've passed in.
|
|
377
378
|
const _numberValue = isControlled ? numberParser.parse(inputValue) : numberValue;
|
|
378
379
|
const formattedValue = isNaN(_numberValue) ? '' : format(_numberValue);
|
|
379
|
-
|
|
380
|
-
|
|
380
|
+
const rawValue = e.target.value;
|
|
381
|
+
// Validate raw input
|
|
382
|
+
const isValid = validate ? validate(rawValue, locale) : true;
|
|
383
|
+
setInputValue(isValid ? formattedValue : rawValue);
|
|
381
384
|
// Calling format() can alter the number (such as rounding it)
|
|
382
385
|
// causing the _numberValue to mismatch the formatted value in
|
|
383
386
|
// the input. To avoid this, formattedValue is re-parsed.
|
|
384
387
|
const parsedFormattedNewValue = numberParser.parse(formattedValue);
|
|
385
|
-
if (onChange) {
|
|
388
|
+
if (onChange && isValid) {
|
|
386
389
|
const state = {
|
|
387
390
|
value: parsedFormattedNewValue,
|
|
388
391
|
direction: previousNumberValue < parsedFormattedNewValue ? 'up' : 'down'
|
|
@@ -616,7 +619,18 @@ NumberInput.propTypes = {
|
|
|
616
619
|
/**
|
|
617
620
|
* Provide the text that is displayed when the control is in warning state
|
|
618
621
|
*/
|
|
619
|
-
warnText: PropTypes.node
|
|
622
|
+
warnText: PropTypes.node,
|
|
623
|
+
/**
|
|
624
|
+
* Optional validation function that is called with the input value and locale.
|
|
625
|
+
*
|
|
626
|
+
* - Return `false` to immediately fail validation.
|
|
627
|
+
* - Return `true` to pass this validation, but still run other checks (min, max, required, etc.).
|
|
628
|
+
* - Return `undefined` to defer entirely to built-in validation logic.
|
|
629
|
+
*
|
|
630
|
+
* This is called before other validations, giving consumers the ability
|
|
631
|
+
* to short-circuit or extend validation without replacing built-in rules.
|
|
632
|
+
*/
|
|
633
|
+
validate: PropTypes.func
|
|
620
634
|
};
|
|
621
635
|
const Label = ({
|
|
622
636
|
disabled,
|
|
@@ -639,17 +653,11 @@ const Label = ({
|
|
|
639
653
|
}
|
|
640
654
|
return null;
|
|
641
655
|
};
|
|
642
|
-
|
|
643
|
-
disabled: PropTypes.bool,
|
|
644
|
-
hideLabel: PropTypes.bool,
|
|
645
|
-
id: PropTypes.string,
|
|
646
|
-
label: PropTypes.node
|
|
647
|
-
};
|
|
648
|
-
function HelperText({
|
|
656
|
+
const HelperText = ({
|
|
649
657
|
disabled,
|
|
650
658
|
description,
|
|
651
659
|
id
|
|
652
|
-
}) {
|
|
660
|
+
}) => {
|
|
653
661
|
const prefix = usePrefix.usePrefix();
|
|
654
662
|
const className = cx(`${prefix}--form__helper-text`, {
|
|
655
663
|
[`${prefix}--form__helper-text--disabled`]: disabled
|
|
@@ -662,11 +670,6 @@ function HelperText({
|
|
|
662
670
|
}, description);
|
|
663
671
|
}
|
|
664
672
|
return null;
|
|
665
|
-
}
|
|
666
|
-
HelperText.propTypes = {
|
|
667
|
-
description: PropTypes.node,
|
|
668
|
-
disabled: PropTypes.bool,
|
|
669
|
-
id: PropTypes.string
|
|
670
673
|
};
|
|
671
674
|
|
|
672
675
|
/**
|
|
@@ -680,6 +683,8 @@ HelperText.propTypes = {
|
|
|
680
683
|
* @param {number} config.value
|
|
681
684
|
* @param {number} config.max
|
|
682
685
|
* @param {number} config.min
|
|
686
|
+
* @param {Function} config.validate
|
|
687
|
+
* @param {string} config.locale
|
|
683
688
|
* @returns {boolean}
|
|
684
689
|
*/
|
|
685
690
|
function getInputValidity({
|
|
@@ -687,8 +692,17 @@ function getInputValidity({
|
|
|
687
692
|
invalid,
|
|
688
693
|
value,
|
|
689
694
|
max,
|
|
690
|
-
min
|
|
695
|
+
min,
|
|
696
|
+
validate,
|
|
697
|
+
locale
|
|
691
698
|
}) {
|
|
699
|
+
if (typeof validate === 'function') {
|
|
700
|
+
const result = validate(value, locale);
|
|
701
|
+
if (result === false) {
|
|
702
|
+
return false; // immediate invalid
|
|
703
|
+
}
|
|
704
|
+
// If true or undefined, continue to further validations
|
|
705
|
+
}
|
|
692
706
|
if (invalid) {
|
|
693
707
|
return false;
|
|
694
708
|
}
|
|
@@ -175,8 +175,7 @@ const OverflowMenu = /*#__PURE__*/React.forwardRef(({
|
|
|
175
175
|
if (onCloseMenu) {
|
|
176
176
|
onCloseMenu();
|
|
177
177
|
}
|
|
178
|
-
|
|
179
|
-
}, [onClose]);
|
|
178
|
+
}, []);
|
|
180
179
|
const closeMenuAndFocus = React.useCallback(() => {
|
|
181
180
|
const wasClicked = click;
|
|
182
181
|
const wasOpen = open;
|
|
@@ -321,7 +320,7 @@ const OverflowMenu = /*#__PURE__*/React.forwardRef(({
|
|
|
321
320
|
}, /*#__PURE__*/React.cloneElement(menuBody, {
|
|
322
321
|
'data-floating-menu-direction': direction
|
|
323
322
|
}));
|
|
324
|
-
const combinedRef = innerRef ? mergeRefs.
|
|
323
|
+
const combinedRef = innerRef ? mergeRefs.mergeRefs(triggerRef, innerRef, ref) : mergeRefs.mergeRefs(triggerRef, ref);
|
|
325
324
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
326
325
|
className: `${prefix}--overflow-menu__wrapper`,
|
|
327
326
|
"aria-owns": open ? menuBodyId : undefined,
|
|
@@ -99,7 +99,7 @@ const OverflowMenu = /*#__PURE__*/React.forwardRef(({
|
|
|
99
99
|
const triggerClasses = cx(`${prefix}--overflow-menu`, {
|
|
100
100
|
[`${prefix}--overflow-menu--open`]: open
|
|
101
101
|
}, size !== defaultSize && `${prefix}--overflow-menu--${size}`);
|
|
102
|
-
const floatingRef = mergeRefs.
|
|
102
|
+
const floatingRef = mergeRefs.mergeRefs(triggerRef, refs.setReference);
|
|
103
103
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
|
104
104
|
className: containerClasses,
|
|
105
105
|
"aria-owns": open ? id : undefined,
|
|
@@ -17,8 +17,8 @@ var keys = require('../../internal/keyboard/keys.js');
|
|
|
17
17
|
var match = require('../../internal/keyboard/match.js');
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
19
|
var warning = require('../../internal/warning.js');
|
|
20
|
-
require('../Text/index.js');
|
|
21
20
|
var Text = require('../Text/Text.js');
|
|
21
|
+
require('../Text/TextDirection.js');
|
|
22
22
|
|
|
23
23
|
const frFn = React.forwardRef;
|
|
24
24
|
const OverflowMenuItem = frFn((props, ref) => {
|
|
@@ -14,7 +14,8 @@ var cx = require('classnames');
|
|
|
14
14
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
15
15
|
var layout = require('@carbon/layout');
|
|
16
16
|
var useMatchMedia = require('../../internal/useMatchMedia.js');
|
|
17
|
-
require('../Text/
|
|
17
|
+
var Text = require('../Text/Text.js');
|
|
18
|
+
require('../Text/TextDirection.js');
|
|
18
19
|
var index$1 = require('../MenuButton/index.js');
|
|
19
20
|
require('../Menu/Menu.js');
|
|
20
21
|
var MenuItem = require('../Menu/MenuItem.js');
|
|
@@ -36,7 +37,6 @@ require('../Grid/Row.js');
|
|
|
36
37
|
var Column = require('../Grid/Column.js');
|
|
37
38
|
require('../Grid/ColumnHang.js');
|
|
38
39
|
require('../Grid/GridContext.js');
|
|
39
|
-
var Text = require('../Text/Text.js');
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* ----------
|
|
@@ -15,8 +15,8 @@ var keys = require('../../internal/keyboard/keys.js');
|
|
|
15
15
|
var match = require('../../internal/keyboard/match.js');
|
|
16
16
|
var iconsReact = require('@carbon/icons-react');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
-
require('../Text/index.js');
|
|
19
18
|
var Text = require('../Text/Text.js');
|
|
19
|
+
require('../Text/TextDirection.js');
|
|
20
20
|
|
|
21
21
|
const defaultTranslations = {
|
|
22
22
|
'carbon.progress-step.complete': 'Complete',
|
|
@@ -13,14 +13,14 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
|
-
require('../Text/
|
|
16
|
+
var Text = require('../Text/Text.js');
|
|
17
|
+
require('../Text/TextDirection.js');
|
|
17
18
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
18
19
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
20
|
var useId = require('../../internal/useId.js');
|
|
20
21
|
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
21
22
|
var index = require('../AILabel/index.js');
|
|
22
23
|
var utils = require('../../internal/utils.js');
|
|
23
|
-
var Text = require('../Text/Text.js');
|
|
24
24
|
|
|
25
25
|
const RadioButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
26
26
|
const {
|
|
@@ -65,7 +65,7 @@ const RadioButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
65
65
|
className: `${prefix}--radio-button`,
|
|
66
66
|
onChange: handleOnChange,
|
|
67
67
|
id: uniqueId,
|
|
68
|
-
ref: mergeRefs.
|
|
68
|
+
ref: mergeRefs.mergeRefs(inputRef, ref),
|
|
69
69
|
disabled: disabled,
|
|
70
70
|
value: value,
|
|
71
71
|
name: name,
|
|
@@ -13,7 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
|
-
var
|
|
16
|
+
var createTextComponent = require('../Text/createTextComponent.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
18
|
var iconsReact = require('@carbon/icons-react');
|
|
19
19
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
@@ -117,13 +117,13 @@ const RadioButtonGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
117
117
|
}) : null;
|
|
118
118
|
return /*#__PURE__*/React.createElement("div", {
|
|
119
119
|
className: wrapperClasses,
|
|
120
|
-
ref: mergeRefs.
|
|
120
|
+
ref: mergeRefs.mergeRefs(divRef, ref)
|
|
121
121
|
}, /*#__PURE__*/React.createElement("fieldset", _rollupPluginBabelHelpers.extends({
|
|
122
122
|
className: fieldsetClasses,
|
|
123
123
|
disabled: disabled,
|
|
124
124
|
"data-invalid": invalid ? true : undefined,
|
|
125
125
|
"aria-describedby": showHelper && helperText ? helperId : undefined
|
|
126
|
-
}, rest), legendText && /*#__PURE__*/React.createElement(
|
|
126
|
+
}, rest), legendText && /*#__PURE__*/React.createElement(createTextComponent.Legend, {
|
|
127
127
|
className: `${prefix}--label`
|
|
128
128
|
}, legendText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
129
129
|
className: `${prefix}--radio-button-group-inner--decorator`
|