@carbon/react 1.59.0-rc.0 → 1.60.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 +1025 -1177
- package/es/_virtual/_rollupPluginBabelHelpers.js +23 -34
- package/es/components/Button/ButtonBase.d.ts +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.d.ts +27 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +5 -5
- package/es/components/ComboBox/ComboBox.d.ts +6 -0
- package/es/components/ComboBox/ComboBox.js +36 -3
- package/es/components/ComboButton/index.d.ts +1 -1
- package/es/components/ComposedModal/ModalHeader.js +0 -1
- package/es/components/DataTable/DataTable.d.ts +3 -0
- package/es/components/DataTable/DataTable.js +4 -1
- package/es/components/DataTable/TableSelectAll.d.ts +14 -3
- package/es/components/DataTable/TableSelectAll.js +10 -3
- package/es/components/DataTable/TableSelectRow.d.ts +16 -4
- package/es/components/DataTable/TableSelectRow.js +11 -4
- package/es/components/DatePicker/DatePicker.d.ts +1 -1
- package/es/components/DatePicker/DatePicker.js +0 -1
- package/es/components/DatePicker/index.d.ts +2 -2
- package/es/components/DatePicker/plugins/rangePlugin.js +0 -1
- package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/es/components/DatePickerInput/index.d.ts +2 -2
- package/es/components/FileUploader/FileUploaderItem.js +7 -4
- package/es/components/Heading/index.d.ts +1 -1
- package/es/components/Link/Link.d.ts +1 -1
- package/es/components/ListBox/ListBoxMenu.js +0 -1
- package/es/components/Menu/Menu.d.ts +1 -0
- package/es/components/Menu/Menu.js +13 -10
- package/es/components/MenuButton/index.d.ts +2 -1
- package/es/components/MenuButton/index.js +50 -29
- package/es/components/MultiSelect/MultiSelect.js +0 -1
- package/es/components/Popover/index.js +0 -1
- package/es/components/PrimaryButton/PrimaryButton.d.ts +1 -1
- package/es/components/RadioButton/RadioButton.d.ts +2 -2
- package/es/components/RadioButton/index.d.ts +2 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -3
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +8 -10
- package/es/components/RadioButtonGroup/index.d.ts +2 -1
- package/es/components/SecondaryButton/SecondaryButton.d.ts +1 -1
- package/es/components/Tabs/Tabs.js +7 -4
- package/es/components/Tag/DismissibleTag.d.ts +1 -1
- package/es/components/Tag/OperationalTag.d.ts +1 -1
- package/es/components/Tag/SelectableTag.d.ts +1 -1
- package/es/components/Tag/Tag.d.ts +1 -1
- package/es/components/Text/index.d.ts +2 -2
- package/es/components/TextArea/TextArea.js +1 -0
- package/es/components/Toggletip/index.d.ts +1 -1
- package/es/components/Tooltip/DefinitionTooltip.js +22 -1
- package/es/components/UIShell/Content.d.ts +4 -7
- package/es/components/UIShell/Link.d.ts +1 -1
- package/es/components/UIShell/Link.js +1 -0
- package/es/components/UIShell/SideNav.js +1 -0
- package/es/components/UIShell/SwitcherItem.d.ts +1 -1
- package/es/index.js +1 -1
- package/lib/_virtual/_rollupPluginBabelHelpers.js +23 -34
- package/lib/components/Button/ButtonBase.d.ts +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +27 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +5 -5
- package/lib/components/ComboBox/ComboBox.d.ts +6 -0
- package/lib/components/ComboBox/ComboBox.js +35 -2
- package/lib/components/ComboButton/index.d.ts +1 -1
- package/lib/components/ComposedModal/ModalHeader.js +0 -1
- package/lib/components/DataTable/DataTable.d.ts +3 -0
- package/lib/components/DataTable/DataTable.js +4 -1
- package/lib/components/DataTable/TableSelectAll.d.ts +14 -3
- package/lib/components/DataTable/TableSelectAll.js +10 -3
- package/lib/components/DataTable/TableSelectRow.d.ts +16 -4
- package/lib/components/DataTable/TableSelectRow.js +11 -4
- package/lib/components/DatePicker/DatePicker.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.js +0 -1
- package/lib/components/DatePicker/index.d.ts +2 -2
- package/lib/components/DatePicker/plugins/rangePlugin.js +0 -1
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/lib/components/DatePickerInput/index.d.ts +2 -2
- package/lib/components/FileUploader/FileUploaderItem.js +7 -4
- package/lib/components/Heading/index.d.ts +1 -1
- package/lib/components/Link/Link.d.ts +1 -1
- package/lib/components/ListBox/ListBoxMenu.js +0 -1
- package/lib/components/Menu/Menu.d.ts +1 -0
- package/lib/components/Menu/Menu.js +13 -10
- package/lib/components/MenuButton/index.d.ts +2 -1
- package/lib/components/MenuButton/index.js +46 -25
- package/lib/components/MultiSelect/MultiSelect.js +0 -1
- package/lib/components/Popover/index.js +0 -1
- package/lib/components/PrimaryButton/PrimaryButton.d.ts +1 -1
- package/lib/components/RadioButton/RadioButton.d.ts +2 -2
- package/lib/components/RadioButton/index.d.ts +2 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -3
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +8 -10
- package/lib/components/RadioButtonGroup/index.d.ts +2 -1
- package/lib/components/SecondaryButton/SecondaryButton.d.ts +1 -1
- package/lib/components/Tabs/Tabs.js +7 -4
- package/lib/components/Tag/DismissibleTag.d.ts +1 -1
- package/lib/components/Tag/OperationalTag.d.ts +1 -1
- package/lib/components/Tag/SelectableTag.d.ts +1 -1
- package/lib/components/Tag/Tag.d.ts +1 -1
- package/lib/components/Text/index.d.ts +2 -2
- package/lib/components/TextArea/TextArea.js +1 -0
- package/lib/components/Toggletip/index.d.ts +1 -1
- package/lib/components/Tooltip/DefinitionTooltip.js +22 -1
- package/lib/components/UIShell/Content.d.ts +4 -7
- package/lib/components/UIShell/Link.d.ts +1 -1
- package/lib/components/UIShell/Link.js +1 -0
- package/lib/components/UIShell/SideNav.js +1 -0
- package/lib/components/UIShell/SwitcherItem.d.ts +1 -1
- package/lib/index.js +2 -2
- package/package.json +10 -9
|
@@ -32,6 +32,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
|
|
|
32
32
|
onOpen,
|
|
33
33
|
open,
|
|
34
34
|
size = 'sm',
|
|
35
|
+
legacyAutoalign = 'true',
|
|
35
36
|
// TODO: #16004
|
|
36
37
|
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
37
38
|
target = document.body,
|
|
@@ -86,16 +87,18 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
|
|
|
86
87
|
function handleOpen() {
|
|
87
88
|
if (menu.current) {
|
|
88
89
|
focusReturn.current = document.activeElement;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
if (legacyAutoalign) {
|
|
91
|
+
const pos = calculatePosition();
|
|
92
|
+
if ((document?.dir === 'rtl' || direction === 'rtl') && !rest?.id?.includes('MenuButton')) {
|
|
93
|
+
menu.current.style.insetInlineStart = `initial`;
|
|
94
|
+
menu.current.style.insetInlineEnd = `${pos[0]}px`;
|
|
95
|
+
} else {
|
|
96
|
+
menu.current.style.insetInlineStart = `${pos[0]}px`;
|
|
97
|
+
menu.current.style.insetInlineEnd = `initial`;
|
|
98
|
+
}
|
|
99
|
+
menu.current.style.insetBlockStart = `${pos[1]}px`;
|
|
100
|
+
setPosition(pos);
|
|
96
101
|
}
|
|
97
|
-
menu.current.style.insetBlockStart = `${pos[1]}px`;
|
|
98
|
-
setPosition(pos);
|
|
99
102
|
menu.current.focus();
|
|
100
103
|
if (onOpen) {
|
|
101
104
|
onOpen();
|
|
@@ -277,7 +280,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
|
|
|
277
280
|
// to avoid a flicker effect when opening.
|
|
278
281
|
[`${prefix}--menu--box-shadow-top`]: menuAlignment && menuAlignment.slice(0, 3) === 'top',
|
|
279
282
|
[`${prefix}--menu--open`]: open,
|
|
280
|
-
[`${prefix}--menu--shown`]: position[0] >= 0 && position[1] >= 0,
|
|
283
|
+
[`${prefix}--menu--shown`]: open && !legacyAutoalign || position[0] >= 0 && position[1] >= 0,
|
|
281
284
|
[`${prefix}--menu--with-icons`]: childContext.state.hasIcons
|
|
282
285
|
});
|
|
283
286
|
const rendered = /*#__PURE__*/React__default.createElement(MenuContext.Provider, {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { ComponentProps, ReactNode } from 'react';
|
|
8
|
+
export type MenuAlignment = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end';
|
|
8
9
|
export interface MenuButtonProps extends ComponentProps<'div'> {
|
|
9
10
|
/**
|
|
10
11
|
* A collection of MenuItems to be rendered as actions for this MenuButton.
|
|
@@ -29,7 +30,7 @@ export interface MenuButtonProps extends ComponentProps<'div'> {
|
|
|
29
30
|
/**
|
|
30
31
|
* Experimental property. Specify how the menu should align with the button element
|
|
31
32
|
*/
|
|
32
|
-
menuAlignment:
|
|
33
|
+
menuAlignment: MenuAlignment;
|
|
33
34
|
/**
|
|
34
35
|
* Specify the size of the button and menu.
|
|
35
36
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default, { forwardRef, useRef,
|
|
9
|
+
import React__default, { forwardRef, useRef, useLayoutEffect } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { ChevronDown } from '@carbon/icons-react';
|
|
@@ -16,10 +16,10 @@ import { Menu } from '../Menu/Menu.js';
|
|
|
16
16
|
import '../Menu/MenuItem.js';
|
|
17
17
|
import { useAttachedMenu } from '../../internal/useAttachedMenu.js';
|
|
18
18
|
import { useId } from '../../internal/useId.js';
|
|
19
|
-
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
20
19
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
20
|
+
import { flip, size, useFloating, autoUpdate } from '@floating-ui/react';
|
|
21
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
21
22
|
|
|
22
|
-
const spacing = 0; // top and bottom spacing between the button and the menu. in px
|
|
23
23
|
const validButtonKinds = ['primary', 'tertiary', 'ghost'];
|
|
24
24
|
const defaultButtonKind = 'primary';
|
|
25
25
|
const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(_ref, forwardRef) {
|
|
@@ -29,7 +29,7 @@ const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(_ref, forwardRef)
|
|
|
29
29
|
disabled,
|
|
30
30
|
kind = defaultButtonKind,
|
|
31
31
|
label,
|
|
32
|
-
size = 'lg',
|
|
32
|
+
size: size$1 = 'lg',
|
|
33
33
|
menuAlignment = 'bottom',
|
|
34
34
|
tabIndex = 0,
|
|
35
35
|
...rest
|
|
@@ -37,35 +37,57 @@ const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(_ref, forwardRef)
|
|
|
37
37
|
const id = useId('MenuButton');
|
|
38
38
|
const prefix = usePrefix();
|
|
39
39
|
const triggerRef = useRef(null);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const middlewares = [flip({
|
|
41
|
+
crossAxis: false
|
|
42
|
+
})];
|
|
43
|
+
if (menuAlignment === 'bottom' || menuAlignment === 'top') {
|
|
44
|
+
middlewares.push(size({
|
|
45
|
+
apply(_ref2) {
|
|
46
|
+
let {
|
|
47
|
+
rects,
|
|
48
|
+
elements
|
|
49
|
+
} = _ref2;
|
|
50
|
+
Object.assign(elements.floating.style, {
|
|
51
|
+
width: `${rects.reference.width}px`
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
const {
|
|
57
|
+
refs,
|
|
58
|
+
floatingStyles,
|
|
59
|
+
placement,
|
|
60
|
+
middlewareData
|
|
61
|
+
} = useFloating({
|
|
62
|
+
placement: menuAlignment,
|
|
63
|
+
// The floating element is positioned relative to its nearest
|
|
64
|
+
// containing block (usually the viewport). It will in many cases also
|
|
65
|
+
// “break” the floating element out of a clipping ancestor.
|
|
66
|
+
// https://floating-ui.com/docs/misc#clipping
|
|
67
|
+
strategy: 'fixed',
|
|
68
|
+
// Middleware order matters, arrow should be last
|
|
69
|
+
middleware: middlewares,
|
|
70
|
+
whileElementsMounted: autoUpdate
|
|
71
|
+
});
|
|
72
|
+
const ref = mergeRefs(forwardRef, triggerRef);
|
|
43
73
|
const {
|
|
44
74
|
open,
|
|
45
|
-
x,
|
|
46
|
-
y,
|
|
47
75
|
handleClick: hookOnClick,
|
|
48
76
|
handleMousedown,
|
|
49
77
|
handleClose
|
|
50
78
|
} = useAttachedMenu(triggerRef);
|
|
79
|
+
useLayoutEffect(() => {
|
|
80
|
+
Object.keys(floatingStyles).forEach(style => {
|
|
81
|
+
if (refs.floating.current) {
|
|
82
|
+
refs.floating.current.style[style] = floatingStyles[style];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}, [floatingStyles, refs.floating, middlewareData, placement, open]);
|
|
51
86
|
function handleClick() {
|
|
52
87
|
if (triggerRef.current) {
|
|
53
|
-
const {
|
|
54
|
-
width: w
|
|
55
|
-
} = triggerRef.current.getBoundingClientRect();
|
|
56
|
-
setWidth(w);
|
|
57
88
|
hookOnClick();
|
|
58
89
|
}
|
|
59
90
|
}
|
|
60
|
-
function handleOpen() {
|
|
61
|
-
if (menuRef.current) {
|
|
62
|
-
menuRef.current.style.inlineSize = `${width}px`;
|
|
63
|
-
menuRef.current.style.minInlineSize = `${width}px`;
|
|
64
|
-
if (menuAlignment !== 'bottom' && menuAlignment !== 'top') {
|
|
65
|
-
menuRef.current.style.inlineSize = `fit-content`;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
91
|
const containerClasses = cx(`${prefix}--menu-button__container`, className);
|
|
70
92
|
const triggerClasses = cx(`${prefix}--menu-button__trigger`, {
|
|
71
93
|
[`${prefix}--menu-button__trigger--open`]: open
|
|
@@ -76,8 +98,9 @@ const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(_ref, forwardRef)
|
|
|
76
98
|
"aria-owns": open ? id : undefined,
|
|
77
99
|
className: containerClasses
|
|
78
100
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
101
|
+
ref: refs.setReference,
|
|
79
102
|
className: triggerClasses,
|
|
80
|
-
size: size,
|
|
103
|
+
size: size$1,
|
|
81
104
|
tabIndex: tabIndex,
|
|
82
105
|
kind: kind,
|
|
83
106
|
renderIcon: ChevronDown,
|
|
@@ -91,16 +114,14 @@ const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(_ref, forwardRef)
|
|
|
91
114
|
containerRef: triggerRef,
|
|
92
115
|
menuAlignment: menuAlignment,
|
|
93
116
|
className: menuClasses,
|
|
94
|
-
ref:
|
|
117
|
+
ref: refs.setFloating,
|
|
95
118
|
id: id,
|
|
119
|
+
legacyAutoalign: false,
|
|
96
120
|
label: label,
|
|
97
121
|
mode: "basic",
|
|
98
|
-
size: size,
|
|
122
|
+
size: size$1,
|
|
99
123
|
open: open,
|
|
100
|
-
onClose: handleClose
|
|
101
|
-
onOpen: handleOpen,
|
|
102
|
-
x: x,
|
|
103
|
-
y: [y[0] - spacing, y[1] + spacing]
|
|
124
|
+
onClose: handleClose
|
|
104
125
|
}, children));
|
|
105
126
|
});
|
|
106
127
|
MenuButton.propTypes = {
|
|
@@ -132,7 +132,6 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
|
|
|
132
132
|
whileElementsMounted: autoUpdate
|
|
133
133
|
} : {} // When autoAlign is turned off, floating-ui will not be used
|
|
134
134
|
);
|
|
135
|
-
|
|
136
135
|
const value = useMemo(() => {
|
|
137
136
|
return {
|
|
138
137
|
floating,
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ButtonProps } from '../Button';
|
|
9
|
-
declare const PrimaryButton: <T extends React.ElementType<any>>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const PrimaryButton: <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default PrimaryButton;
|
|
@@ -49,7 +49,7 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
49
49
|
* Provide an optional `onChange` hook that is called each time the value of
|
|
50
50
|
* the underlying `<input>` changes
|
|
51
51
|
*/
|
|
52
|
-
onChange?: (value:
|
|
52
|
+
onChange?: (value: RadioButtonProps['value'], name: RadioButtonProps['name'], event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
53
53
|
/**
|
|
54
54
|
* Provide a handler that is invoked when a user clicks on the control
|
|
55
55
|
*/
|
|
@@ -67,5 +67,5 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
67
67
|
*/
|
|
68
68
|
required?: boolean;
|
|
69
69
|
}
|
|
70
|
-
declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<
|
|
70
|
+
declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<HTMLInputElement>>;
|
|
71
71
|
export default RadioButton;
|
|
@@ -4,6 +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 RadioButton from './RadioButton';
|
|
7
|
+
import RadioButton, { RadioButtonProps } from './RadioButton';
|
|
8
8
|
export default RadioButton;
|
|
9
9
|
export { RadioButton };
|
|
10
|
+
export type { RadioButtonProps };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { ReactNode } from 'react';
|
|
8
|
+
import type { RadioButtonProps } from '../RadioButton';
|
|
8
9
|
export declare const RadioButtonGroupContext: React.Context<null>;
|
|
9
10
|
type ExcludedAttributes = 'onChange';
|
|
10
11
|
export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HTMLFieldSetElement>, ExcludedAttributes> {
|
|
@@ -19,7 +20,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
19
20
|
/**
|
|
20
21
|
* Specify the `<RadioButton>` to be selected by default
|
|
21
22
|
*/
|
|
22
|
-
defaultSelected?:
|
|
23
|
+
defaultSelected?: RadioButtonProps['value'];
|
|
23
24
|
/**
|
|
24
25
|
* Specify whether the group is disabled
|
|
25
26
|
*/
|
|
@@ -53,7 +54,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
53
54
|
* Provide an optional `onChange` hook that is called whenever the value of
|
|
54
55
|
* the group changes
|
|
55
56
|
*/
|
|
56
|
-
onChange?: (selection:
|
|
57
|
+
onChange?: (selection: RadioButtonProps['value'], name: RadioButtonGroupProps['name'], event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
57
58
|
/**
|
|
58
59
|
* Provide where radio buttons should be placed
|
|
59
60
|
*/
|
|
@@ -77,7 +78,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
77
78
|
/**
|
|
78
79
|
* Specify the value that is currently selected in the group
|
|
79
80
|
*/
|
|
80
|
-
valueSelected?:
|
|
81
|
+
valueSelected?: RadioButtonProps['value'];
|
|
81
82
|
/**
|
|
82
83
|
* `true` to specify if input selection in group is required.
|
|
83
84
|
*/
|
|
@@ -55,23 +55,21 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
|
|
|
55
55
|
}
|
|
56
56
|
function getRadioButtons() {
|
|
57
57
|
const mappedChildren = React__default.Children.map(children, radioButton => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
58
|
+
if (!radioButton) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
61
|
const newProps = {
|
|
62
62
|
name: name,
|
|
63
|
-
key: value,
|
|
64
|
-
value: value,
|
|
63
|
+
key: radioButton.props.value,
|
|
64
|
+
value: radioButton.props.value,
|
|
65
65
|
onChange: handleOnChange,
|
|
66
|
-
checked: value === selected,
|
|
66
|
+
checked: radioButton.props.value === selected,
|
|
67
67
|
required: required
|
|
68
68
|
};
|
|
69
|
-
if (!selected && radioButton
|
|
69
|
+
if (!selected && radioButton.props.checked) {
|
|
70
70
|
newProps.checked = true;
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
return /*#__PURE__*/React__default.cloneElement(radioButton, newProps);
|
|
74
|
-
}
|
|
72
|
+
return /*#__PURE__*/React__default.cloneElement(radioButton, newProps);
|
|
75
73
|
});
|
|
76
74
|
return mappedChildren;
|
|
77
75
|
}
|
|
@@ -4,6 +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 RadioButtonGroup from './RadioButtonGroup';
|
|
7
|
+
import RadioButtonGroup, { RadioButtonGroupProps } from './RadioButtonGroup';
|
|
8
8
|
export default RadioButtonGroup;
|
|
9
9
|
export { RadioButtonGroup };
|
|
10
|
+
export type { RadioButtonGroupProps };
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ButtonProps } from '../Button';
|
|
9
|
-
declare const SecondaryButton: <T extends React.ElementType<any>>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const SecondaryButton: <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default SecondaryButton;
|
|
@@ -251,13 +251,14 @@ function TabList(_ref2) {
|
|
|
251
251
|
}
|
|
252
252
|
});
|
|
253
253
|
useEffect(() => {
|
|
254
|
-
|
|
254
|
+
//adding 1 in calculation for firefox support
|
|
255
|
+
setIsNextButtonVisible(ref.current ? scrollLeft + buttonWidth + ref.current.clientWidth + 1 < ref.current.scrollWidth : false);
|
|
255
256
|
if (dismissable) {
|
|
256
257
|
if (ref.current) {
|
|
257
258
|
setIsScrollable(ref.current.scrollWidth > ref.current.clientWidth);
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
|
-
}, [scrollLeft, children, dismissable]);
|
|
261
|
+
}, [scrollLeft, children, dismissable, isScrollable]);
|
|
261
262
|
useEffectOnce(() => {
|
|
262
263
|
if (tabs.current[selectedIndex]?.disabled) {
|
|
263
264
|
const activeTabs = tabs.current.filter(tab => {
|
|
@@ -271,11 +272,13 @@ function TabList(_ref2) {
|
|
|
271
272
|
});
|
|
272
273
|
useIsomorphicEffect(() => {
|
|
273
274
|
if (ref.current) {
|
|
274
|
-
|
|
275
|
+
//adding 1 in calculation for firefox support
|
|
276
|
+
setIsScrollable(ref.current.scrollWidth > ref.current.clientWidth + 1);
|
|
275
277
|
}
|
|
276
278
|
function handler() {
|
|
277
279
|
if (ref.current) {
|
|
278
|
-
|
|
280
|
+
//adding 1 in calculation for firefox support
|
|
281
|
+
setIsScrollable(ref.current.scrollWidth > ref.current.clientWidth + 1);
|
|
279
282
|
}
|
|
280
283
|
}
|
|
281
284
|
const debouncedHandler = debounce(handler, 200);
|
|
@@ -54,7 +54,7 @@ export interface DismissibleTagBaseProps {
|
|
|
54
54
|
}
|
|
55
55
|
export type DismissibleTagProps<T extends React.ElementType> = PolymorphicProps<T, DismissibleTagBaseProps>;
|
|
56
56
|
declare const DismissibleTag: {
|
|
57
|
-
<T extends React.ElementType<any>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
<T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
58
58
|
propTypes: {
|
|
59
59
|
/**
|
|
60
60
|
* Provide a custom className that is applied to the containing <span>
|
|
@@ -59,7 +59,7 @@ export interface OperationalTagBaseProps {
|
|
|
59
59
|
}
|
|
60
60
|
export type OperationalTagProps<T extends React.ElementType> = PolymorphicProps<T, OperationalTagBaseProps>;
|
|
61
61
|
declare const OperationalTag: {
|
|
62
|
-
<T extends React.ElementType<any>>({ className, disabled, id, renderIcon, slug, size, text, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
<T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, slug, size, text, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
63
63
|
propTypes: {
|
|
64
64
|
/**
|
|
65
65
|
* Provide a custom className that is applied to the containing <span>
|
|
@@ -46,7 +46,7 @@ export interface SelectableTagBaseProps {
|
|
|
46
46
|
}
|
|
47
47
|
export type SelectableTagProps<T extends React.ElementType> = PolymorphicProps<T, SelectableTagBaseProps>;
|
|
48
48
|
declare const SelectableTag: {
|
|
49
|
-
<T extends React.ElementType<any>>({ className, disabled, id, renderIcon, selected, slug, size, text, ...other }: SelectableTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
<T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, selected, slug, size, text, ...other }: SelectableTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
50
50
|
propTypes: {
|
|
51
51
|
/**
|
|
52
52
|
* Provide a custom className that is applied to the containing <span>
|
|
@@ -74,6 +74,6 @@ export interface TagBaseProps {
|
|
|
74
74
|
type?: keyof typeof TYPES;
|
|
75
75
|
}
|
|
76
76
|
export type TagProps<T extends React.ElementType> = PolymorphicProps<T, TagBaseProps>;
|
|
77
|
-
declare const Tag: React.ForwardRefExoticComponent<Omit<TagProps<React.ElementType<any>>, "ref"> & React.RefAttributes<HTMLElement | undefined>>;
|
|
77
|
+
declare const Tag: React.ForwardRefExoticComponent<Omit<TagProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLElement | undefined>>;
|
|
78
78
|
export declare const types: string[];
|
|
79
79
|
export default Tag;
|
|
@@ -9,10 +9,10 @@ import { Text, TextBaseProps, TextProps } from './Text';
|
|
|
9
9
|
export { TextDirection, Text };
|
|
10
10
|
export type { TextBaseProps, TextProps, TextDirectionProps, GetTextDirection, TextDir, };
|
|
11
11
|
export declare const Label: {
|
|
12
|
-
(props: TextProps<import("react").ElementType<any>>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
(props: TextProps<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const Legend: {
|
|
16
|
-
(props: TextProps<import("react").ElementType<any>>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
(props: TextProps<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
displayName: string;
|
|
18
18
|
};
|
|
@@ -154,6 +154,7 @@ const TextArea = /*#__PURE__*/React__default.forwardRef((props, forwardRef) => {
|
|
|
154
154
|
};
|
|
155
155
|
const formItemClasses = cx(`${prefix}--form-item`, className);
|
|
156
156
|
const textAreaWrapperClasses = cx(`${prefix}--text-area__wrapper`, {
|
|
157
|
+
[`${prefix}--text-area__wrapper--cols`]: other.cols,
|
|
157
158
|
[`${prefix}--text-area__wrapper--readonly`]: other.readOnly,
|
|
158
159
|
[`${prefix}--text-area__wrapper--warn`]: warn,
|
|
159
160
|
[`${prefix}--text-area__wrapper--slug`]: slug
|
|
@@ -89,7 +89,7 @@ export type ToggleTipButtonProps<T extends React.ElementType> = PolymorphicProps
|
|
|
89
89
|
* `ToggletipButton` controls the visibility of the Toggletip through mouse
|
|
90
90
|
* clicks and keyboard interactions.
|
|
91
91
|
*/
|
|
92
|
-
export declare const ToggletipButton: React.ForwardRefExoticComponent<Omit<ToggleTipButtonProps<React.ElementType<any>>, "ref"> & React.RefAttributes<unknown>>;
|
|
92
|
+
export declare const ToggletipButton: React.ForwardRefExoticComponent<Omit<ToggleTipButtonProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
|
|
93
93
|
interface ToggletipContentProps {
|
|
94
94
|
children?: ReactNode;
|
|
95
95
|
className?: string | undefined;
|
|
@@ -74,7 +74,28 @@ DefinitionTooltip.propTypes = {
|
|
|
74
74
|
/**
|
|
75
75
|
* Specify how the trigger should align with the tooltip
|
|
76
76
|
*/
|
|
77
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
77
|
+
align: PropTypes.oneOf(['top', 'top-left',
|
|
78
|
+
// deprecated use top-start instead
|
|
79
|
+
'top-right',
|
|
80
|
+
// deprecated use top-end instead
|
|
81
|
+
|
|
82
|
+
'bottom', 'bottom-left',
|
|
83
|
+
// deprecated use bottom-start instead
|
|
84
|
+
'bottom-right',
|
|
85
|
+
// deprecated use bottom-end instead
|
|
86
|
+
|
|
87
|
+
'left', 'left-bottom',
|
|
88
|
+
// deprecated use left-end instead
|
|
89
|
+
'left-top',
|
|
90
|
+
// deprecated use left-start instead
|
|
91
|
+
|
|
92
|
+
'right', 'right-bottom',
|
|
93
|
+
// deprecated use right-end instead
|
|
94
|
+
'right-top',
|
|
95
|
+
// deprecated use right-start instead
|
|
96
|
+
|
|
97
|
+
// new values to match floating-ui
|
|
98
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
78
99
|
/**
|
|
79
100
|
* The `children` prop will be used as the value that is being defined
|
|
80
101
|
*/
|
|
@@ -29,7 +29,7 @@ declare const Content: {
|
|
|
29
29
|
suppressHydrationWarning?: boolean | undefined;
|
|
30
30
|
accessKey?: string | undefined;
|
|
31
31
|
autoFocus?: boolean | undefined;
|
|
32
|
-
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
|
|
32
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
33
33
|
contextMenu?: string | undefined;
|
|
34
34
|
dir?: string | undefined;
|
|
35
35
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -37,7 +37,6 @@ declare const Content: {
|
|
|
37
37
|
id?: string | undefined;
|
|
38
38
|
lang?: string | undefined;
|
|
39
39
|
nonce?: string | undefined;
|
|
40
|
-
placeholder?: string | undefined;
|
|
41
40
|
slot?: string | undefined;
|
|
42
41
|
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
43
42
|
style?: React.CSSProperties | undefined;
|
|
@@ -69,7 +68,7 @@ declare const Content: {
|
|
|
69
68
|
results?: number | undefined;
|
|
70
69
|
security?: string | undefined;
|
|
71
70
|
unselectable?: "on" | "off" | undefined;
|
|
72
|
-
inputMode?: "search" | "
|
|
71
|
+
inputMode?: "search" | "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
73
72
|
is?: string | undefined;
|
|
74
73
|
"aria-activedescendant"?: string | undefined;
|
|
75
74
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
@@ -83,7 +82,7 @@ declare const Content: {
|
|
|
83
82
|
"aria-colindextext"?: string | undefined;
|
|
84
83
|
"aria-colspan"?: number | undefined;
|
|
85
84
|
"aria-controls"?: string | undefined;
|
|
86
|
-
"aria-current"?: boolean | "
|
|
85
|
+
"aria-current"?: boolean | "true" | "false" | "time" | "page" | "step" | "location" | "date" | undefined;
|
|
87
86
|
"aria-describedby"?: string | undefined;
|
|
88
87
|
"aria-description"?: string | undefined;
|
|
89
88
|
"aria-details"?: string | undefined;
|
|
@@ -93,7 +92,7 @@ declare const Content: {
|
|
|
93
92
|
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
94
93
|
"aria-flowto"?: string | undefined;
|
|
95
94
|
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
96
|
-
"aria-haspopup"?: boolean | "
|
|
95
|
+
"aria-haspopup"?: boolean | "true" | "false" | "dialog" | "grid" | "listbox" | "menu" | "tree" | undefined;
|
|
97
96
|
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
98
97
|
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
99
98
|
"aria-keyshortcuts"?: string | undefined;
|
|
@@ -266,9 +265,7 @@ declare const Content: {
|
|
|
266
265
|
onPointerCancel?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
267
266
|
onPointerCancelCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
268
267
|
onPointerEnter?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
269
|
-
onPointerEnterCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
270
268
|
onPointerLeave?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
271
|
-
onPointerLeaveCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
272
269
|
onPointerOver?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
273
270
|
onPointerOverCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
274
271
|
onPointerOut?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
@@ -21,7 +21,7 @@ export type LinkProps<E extends ElementType> = PolymorphicProps<E, LinkBaseProps
|
|
|
21
21
|
* in their own components to support use-cases like `react-router` or
|
|
22
22
|
* `@reach/router`
|
|
23
23
|
*/
|
|
24
|
-
declare const Link: (<E extends React.ElementType<any> = "a">(props: LinkProps<E>) => JSX.Element) & {
|
|
24
|
+
declare const Link: (<E extends React.ElementType<any, keyof React.JSX.IntrinsicElements> = "a">(props: LinkProps<E>) => JSX.Element) & {
|
|
25
25
|
displayName?: string | undefined;
|
|
26
26
|
propTypes?: React.WeakValidationMap<LinkProps<any>> | undefined;
|
|
27
27
|
};
|
|
@@ -12,6 +12,7 @@ import deprecate from '../../prop-types/deprecate.js';
|
|
|
12
12
|
|
|
13
13
|
// Note: Maybe we should use `as` instead of `element`? `as` appears to be
|
|
14
14
|
// standard and is used in other places in this project.
|
|
15
|
+
|
|
15
16
|
function LinkRenderFunction(_ref, ref) {
|
|
16
17
|
let {
|
|
17
18
|
element,
|
|
@@ -22,6 +22,7 @@ import { Tab, Escape } from '../../internal/keyboard/keys.js';
|
|
|
22
22
|
|
|
23
23
|
// TO-DO: comment back in when footer is added for rails
|
|
24
24
|
// import SideNavFooter from './SideNavFooter';
|
|
25
|
+
|
|
25
26
|
const SideNavContext = /*#__PURE__*/createContext({});
|
|
26
27
|
function SideNavRenderFunction(_ref, ref) {
|
|
27
28
|
let {
|
|
@@ -57,5 +57,5 @@ interface SwitcherItemWithAriaLabelledBy extends BaseSwitcherItemProps {
|
|
|
57
57
|
'aria-labelledby': string;
|
|
58
58
|
}
|
|
59
59
|
type SwitcherItemProps = SwitcherItemWithAriaLabel | SwitcherItemWithAriaLabelledBy;
|
|
60
|
-
declare const SwitcherItem: React.ForwardRefExoticComponent<SwitcherItemProps & React.RefAttributes<React.ElementType<any>>>;
|
|
60
|
+
declare const SwitcherItem: React.ForwardRefExoticComponent<SwitcherItemProps & React.RefAttributes<React.ElementType<any, keyof React.JSX.IntrinsicElements>>>;
|
|
61
61
|
export default SwitcherItem;
|
package/es/index.js
CHANGED
|
@@ -181,7 +181,6 @@ export { default as unstable__FluidTextInput } from './components/FluidTextInput
|
|
|
181
181
|
export { default as unstable__FluidTextInputSkeleton } from './components/FluidTextInput/FluidTextInput.Skeleton.js';
|
|
182
182
|
export { default as unstable_PageSelector } from './components/Pagination/experimental/PageSelector.js';
|
|
183
183
|
export { default as unstable_Pagination } from './components/Pagination/experimental/Pagination.js';
|
|
184
|
-
export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup.js';
|
|
185
184
|
export { default as ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
|
|
186
185
|
export { default as ContainedList } from './components/ContainedList/ContainedList.js';
|
|
187
186
|
export { default as useContextMenu } from './components/ContextMenu/useContextMenu.js';
|
|
@@ -208,6 +207,7 @@ export { default as unstable__ChatButton } from './components/ChatButton/ChatBut
|
|
|
208
207
|
export { default as unstable__ChatButtonSkeleton } from './components/ChatButton/ChatButton.Skeleton.js';
|
|
209
208
|
export { Text as unstable_Text } from './components/Text/Text.js';
|
|
210
209
|
export { TextDirection as unstable_TextDirection } from './components/Text/TextDirection.js';
|
|
210
|
+
export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup.js';
|
|
211
211
|
export { default as DataTable } from './components/DataTable/DataTable.js';
|
|
212
212
|
export { Table } from './components/DataTable/Table.js';
|
|
213
213
|
export { default as TableActionList } from './components/DataTable/TableActionList.js';
|