@carbon/react 1.31.3 → 1.32.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/README.md +1 -1
- package/es/components/Accordion/Accordion.Skeleton.d.ts +64 -0
- package/es/components/Accordion/Accordion.Skeleton.js +3 -3
- package/es/components/Accordion/Accordion.d.ts +65 -0
- package/es/components/Accordion/Accordion.js +5 -6
- package/es/components/Accordion/AccordionItem.d.ts +105 -0
- package/es/components/Accordion/AccordionItem.js +12 -9
- package/es/components/Accordion/AccordionProvider.d.ts +20 -0
- package/es/components/Accordion/AccordionProvider.js +25 -0
- package/es/components/Accordion/index.d.ts +11 -0
- package/es/components/Button/Button.Skeleton.d.ts +28 -0
- package/es/components/Button/Button.Skeleton.js +5 -3
- package/es/components/Button/Button.d.ts +72 -0
- package/es/components/Button/Button.js +13 -10
- package/es/components/Button/index.d.ts +11 -0
- package/es/components/Button/index.js +2 -1
- package/es/components/ButtonSet/ButtonSet.d.ts +17 -0
- package/es/components/ButtonSet/ButtonSet.js +1 -2
- package/es/components/ButtonSet/index.d.ts +9 -0
- package/es/components/CodeSnippet/CodeSnippet.js +1 -0
- package/es/components/ComboButton/index.js +1 -0
- package/es/components/ComposedModal/ComposedModal.d.ts +70 -0
- package/es/components/ComposedModal/ComposedModal.js +58 -67
- package/es/components/ComposedModal/ModalFooter.d.ts +71 -0
- package/es/components/ComposedModal/ModalFooter.js +22 -19
- package/es/components/ComposedModal/ModalHeader.d.ts +58 -0
- package/es/components/ComposedModal/ModalHeader.js +8 -25
- package/es/components/ComposedModal/index.d.ts +9 -0
- package/es/components/ContainedList/ContainedList.js +12 -1
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
- package/es/components/ContentSwitcher/ContentSwitcher.js +14 -6
- package/es/components/DangerButton/DangerButton.d.ts +9 -0
- package/es/components/DangerButton/DangerButton.js +2 -2
- package/es/components/DangerButton/index.d.ts +9 -0
- package/es/components/DataTable/TableBatchAction.js +1 -0
- package/es/components/DataTable/TableBatchActions.js +1 -0
- package/es/components/DataTable/TableBody.d.ts +29 -0
- package/es/components/DataTable/TableBody.js +2 -3
- package/es/components/DataTable/TableContainer.d.ts +51 -0
- package/es/components/DataTable/TableContainer.js +3 -4
- package/es/components/DataTable/TableExpandHeader.d.ts +86 -0
- package/es/components/DataTable/TableExpandHeader.js +4 -5
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
- package/es/components/Dropdown/Dropdown.js +1 -0
- package/es/components/FluidTextInput/FluidTextInput.js +1 -0
- package/es/components/FormGroup/FormGroup.d.ts +80 -0
- package/es/components/IconButton/index.js +3 -2
- package/es/components/Layout/index.d.ts +74 -0
- package/es/components/Layout/index.js +14 -5
- package/es/components/Link/Link.d.ts +2 -2
- package/es/components/Link/Link.js +2 -1
- package/es/components/MenuButton/index.js +1 -0
- package/es/components/Modal/Modal.js +1 -0
- package/es/components/ModalWrapper/ModalWrapper.js +1 -0
- package/es/components/Notification/Notification.d.ts +531 -0
- package/es/components/Notification/Notification.js +40 -6
- package/es/components/Notification/index.d.ts +7 -0
- package/es/components/PrimaryButton/PrimaryButton.js +1 -0
- package/es/components/SecondaryButton/SecondaryButton.js +1 -0
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/SkeletonText/SkeletonText.d.ts +61 -0
- package/es/components/SkeletonText/SkeletonText.js +15 -17
- package/es/components/SkeletonText/index.d.ts +9 -0
- package/es/components/Switch/Switch.d.ts +56 -0
- package/es/components/Switch/Switch.js +4 -4
- package/es/components/Tab/index.d.ts +9 -0
- package/es/components/TabContent/TabContent.d.ts +40 -0
- package/es/components/TabContent/TabContent.js +6 -12
- package/es/components/TabContent/index.d.ts +10 -0
- package/es/components/Tabs/Tabs.Skeleton.d.ts +33 -0
- package/es/components/Tabs/Tabs.Skeleton.js +2 -2
- package/es/components/Tabs/Tabs.d.ts +311 -0
- package/es/components/Tabs/Tabs.js +151 -97
- package/es/components/Tabs/index.d.ts +10 -0
- package/es/components/Tabs/usePressable.js +11 -0
- package/es/components/TextInput/ControlledPasswordInput.d.ts +90 -0
- package/es/components/TextInput/ControlledPasswordInput.js +5 -6
- package/es/components/Tile/Tile.d.ts +153 -0
- package/es/components/Tile/Tile.js +62 -74
- package/es/components/Tile/index.d.ts +7 -0
- package/es/components/Toggle/Toggle.Skeleton.d.ts +3 -47
- package/es/components/Toggle/Toggle.Skeleton.js +24 -64
- package/es/components/Toggle/Toggle.js +1 -1
- package/es/components/UIShell/HeaderGlobalAction.js +1 -0
- package/es/components/UIShell/HeaderPanel.js +61 -5
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/components/UIShell/Switcher.js +45 -5
- package/es/components/UIShell/SwitcherItem.js +45 -6
- package/es/index.js +16 -16
- package/es/internal/keyboard/match.js +2 -2
- package/es/internal/useControllableState.js +2 -2
- package/es/internal/useMatchMedia.js +44 -0
- package/es/internal/wrapFocus.js +6 -6
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/es/prop-types/types.js +3 -0
- package/lib/components/Accordion/Accordion.Skeleton.d.ts +64 -0
- package/lib/components/Accordion/Accordion.Skeleton.js +3 -3
- package/lib/components/Accordion/Accordion.d.ts +65 -0
- package/lib/components/Accordion/Accordion.js +5 -6
- package/lib/components/Accordion/AccordionItem.d.ts +105 -0
- package/lib/components/Accordion/AccordionItem.js +11 -8
- package/lib/components/Accordion/AccordionProvider.d.ts +20 -0
- package/lib/components/Accordion/AccordionProvider.js +34 -0
- package/lib/components/Accordion/index.d.ts +11 -0
- package/lib/components/Button/Button.Skeleton.d.ts +28 -0
- package/lib/components/Button/Button.Skeleton.js +5 -3
- package/lib/components/Button/Button.d.ts +72 -0
- package/lib/components/Button/Button.js +18 -11
- package/lib/components/Button/index.d.ts +11 -0
- package/lib/components/Button/index.js +6 -0
- package/lib/components/ButtonSet/ButtonSet.d.ts +17 -0
- package/lib/components/ButtonSet/ButtonSet.js +1 -2
- package/lib/components/ButtonSet/index.d.ts +9 -0
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
- package/lib/components/ComboButton/index.js +1 -0
- package/lib/components/ComposedModal/ComposedModal.d.ts +70 -0
- package/lib/components/ComposedModal/ComposedModal.js +58 -67
- package/lib/components/ComposedModal/ModalFooter.d.ts +71 -0
- package/lib/components/ComposedModal/ModalFooter.js +22 -19
- package/lib/components/ComposedModal/ModalHeader.d.ts +58 -0
- package/lib/components/ComposedModal/ModalHeader.js +8 -25
- package/lib/components/ComposedModal/index.d.ts +9 -0
- package/lib/components/ContainedList/ContainedList.js +12 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
- package/lib/components/ContentSwitcher/ContentSwitcher.js +14 -6
- package/lib/components/DangerButton/DangerButton.d.ts +9 -0
- package/lib/components/DangerButton/DangerButton.js +2 -2
- package/lib/components/DangerButton/index.d.ts +9 -0
- package/lib/components/DataTable/TableBatchAction.js +1 -0
- package/lib/components/DataTable/TableBatchActions.js +1 -0
- package/lib/components/DataTable/TableBody.d.ts +29 -0
- package/lib/components/DataTable/TableBody.js +3 -4
- package/lib/components/DataTable/TableContainer.d.ts +51 -0
- package/lib/components/DataTable/TableContainer.js +3 -4
- package/lib/components/DataTable/TableExpandHeader.d.ts +86 -0
- package/lib/components/DataTable/TableExpandHeader.js +4 -5
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
- package/lib/components/Dropdown/Dropdown.js +1 -0
- package/lib/components/FluidTextInput/FluidTextInput.js +1 -0
- package/lib/components/FormGroup/FormGroup.d.ts +80 -0
- package/lib/components/IconButton/index.js +3 -2
- package/lib/components/Layout/index.d.ts +74 -0
- package/lib/components/Layout/index.js +14 -5
- package/lib/components/Link/Link.d.ts +2 -2
- package/lib/components/Link/Link.js +2 -1
- package/lib/components/MenuButton/index.js +1 -0
- package/lib/components/Modal/Modal.js +1 -0
- package/lib/components/ModalWrapper/ModalWrapper.js +1 -0
- package/lib/components/Notification/Notification.d.ts +531 -0
- package/lib/components/Notification/Notification.js +40 -6
- package/lib/components/Notification/index.d.ts +7 -0
- package/lib/components/PrimaryButton/PrimaryButton.js +1 -0
- package/lib/components/SecondaryButton/SecondaryButton.js +1 -0
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/SkeletonText/SkeletonText.d.ts +61 -0
- package/lib/components/SkeletonText/SkeletonText.js +15 -17
- package/lib/components/SkeletonText/index.d.ts +9 -0
- package/lib/components/Switch/Switch.d.ts +56 -0
- package/lib/components/Switch/Switch.js +4 -4
- package/lib/components/Tab/index.d.ts +9 -0
- package/lib/components/TabContent/TabContent.d.ts +40 -0
- package/lib/components/TabContent/TabContent.js +6 -12
- package/lib/components/TabContent/index.d.ts +10 -0
- package/lib/components/Tabs/Tabs.Skeleton.d.ts +33 -0
- package/lib/components/Tabs/Tabs.Skeleton.js +2 -2
- package/lib/components/Tabs/Tabs.d.ts +311 -0
- package/lib/components/Tabs/Tabs.js +150 -96
- package/lib/components/Tabs/index.d.ts +10 -0
- package/lib/components/Tabs/usePressable.js +11 -0
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +90 -0
- package/lib/components/TextInput/ControlledPasswordInput.js +5 -6
- package/lib/components/Tile/Tile.d.ts +153 -0
- package/lib/components/Tile/Tile.js +62 -74
- package/lib/components/Tile/index.d.ts +7 -0
- package/lib/components/Toggle/Toggle.Skeleton.d.ts +3 -47
- package/lib/components/Toggle/Toggle.Skeleton.js +22 -62
- package/lib/components/Toggle/Toggle.js +1 -1
- package/lib/components/UIShell/HeaderGlobalAction.js +1 -0
- package/lib/components/UIShell/HeaderPanel.js +60 -4
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/components/UIShell/Switcher.js +44 -4
- package/lib/components/UIShell/SwitcherItem.js +45 -6
- package/lib/index.js +51 -47
- package/lib/internal/keyboard/match.js +2 -2
- package/lib/internal/useControllableState.js +2 -2
- package/lib/internal/useMatchMedia.js +48 -0
- package/lib/internal/wrapFocus.js +6 -6
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/lib/prop-types/types.js +3 -0
- package/package.json +4 -3
|
@@ -60,12 +60,12 @@ const ControlledPasswordInput = /*#__PURE__*/React__default.forwardRef(function
|
|
|
60
60
|
id,
|
|
61
61
|
onChange: evt => {
|
|
62
62
|
if (!other.disabled) {
|
|
63
|
-
onChange(evt);
|
|
63
|
+
onChange?.(evt);
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
onClick: evt => {
|
|
67
67
|
if (!other.disabled) {
|
|
68
|
-
onClick(evt);
|
|
68
|
+
onClick?.(evt);
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
placeholder,
|
|
@@ -104,7 +104,7 @@ const ControlledPasswordInput = /*#__PURE__*/React__default.forwardRef(function
|
|
|
104
104
|
invalid,
|
|
105
105
|
sharedTextInputProps,
|
|
106
106
|
invalidId: errorId,
|
|
107
|
-
hasHelper: !error && helperText,
|
|
107
|
+
hasHelper: !error && helperText ? true : false,
|
|
108
108
|
helperId
|
|
109
109
|
}), {
|
|
110
110
|
"data-toggle-password-visibility": type === 'password'
|
|
@@ -221,8 +221,7 @@ ControlledPasswordInput.defaultProps = {
|
|
|
221
221
|
invalid: false,
|
|
222
222
|
invalidText: '',
|
|
223
223
|
helperText: '',
|
|
224
|
-
size:
|
|
224
|
+
size: undefined
|
|
225
225
|
};
|
|
226
|
-
var ControlledPasswordInput$1 = ControlledPasswordInput;
|
|
227
226
|
|
|
228
|
-
export { ControlledPasswordInput
|
|
227
|
+
export { ControlledPasswordInput as default };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React, { type ReactNode, type MouseEvent, type KeyboardEvent, type HTMLAttributes, type ChangeEvent, type ComponentType } from 'react';
|
|
2
|
+
export interface TileProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
/** @deprecated */
|
|
6
|
+
light?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const Tile: React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
/** @deprecated */
|
|
13
|
+
light?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Boolean for whether a tile has been clicked.
|
|
16
|
+
*/
|
|
17
|
+
clicked?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Specify whether the ClickableTile should be disabled
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The href for the link.
|
|
24
|
+
*/
|
|
25
|
+
href?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional prop to allow overriding the icon rendering.
|
|
28
|
+
*/
|
|
29
|
+
renderIcon?: ComponentType<{
|
|
30
|
+
className?: string;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Specify the function to run when the ClickableTile is clicked
|
|
34
|
+
*/
|
|
35
|
+
onClick?(event: MouseEvent): void;
|
|
36
|
+
/**
|
|
37
|
+
* Specify the function to run when the ClickableTile is interacted with via a keyboard
|
|
38
|
+
*/
|
|
39
|
+
onKeyDown?(event: KeyboardEvent): void;
|
|
40
|
+
/**
|
|
41
|
+
* The rel property for the link.
|
|
42
|
+
*/
|
|
43
|
+
rel?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare const ClickableTile: React.ForwardRefExoticComponent<ClickableTileProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
46
|
+
export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
className?: string;
|
|
49
|
+
/** @deprecated */
|
|
50
|
+
light?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Specify whether the SelectableTile should be disabled
|
|
53
|
+
*/
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The ID of the `<input>`.
|
|
57
|
+
*/
|
|
58
|
+
id?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The `name` of the `<input>`.
|
|
61
|
+
* @deprecated
|
|
62
|
+
*/
|
|
63
|
+
name?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The empty handler of the `<input>`.
|
|
66
|
+
*/
|
|
67
|
+
onChange?(event: ChangeEvent<HTMLDivElement>): void;
|
|
68
|
+
/**
|
|
69
|
+
* Specify the function to run when the SelectableTile is clicked
|
|
70
|
+
*/
|
|
71
|
+
onClick?(event: MouseEvent<HTMLDivElement>): void;
|
|
72
|
+
/**
|
|
73
|
+
* Specify the function to run when the SelectableTile is interacted with via a keyboard
|
|
74
|
+
*/
|
|
75
|
+
onKeyDown?(event: KeyboardEvent<HTMLDivElement>): void;
|
|
76
|
+
/**
|
|
77
|
+
* `true` to select this tile.
|
|
78
|
+
*/
|
|
79
|
+
selected?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Specify the tab index of the wrapper element
|
|
82
|
+
*/
|
|
83
|
+
tabIndex?: number;
|
|
84
|
+
/**
|
|
85
|
+
* The `title` of the `<input>`.
|
|
86
|
+
*/
|
|
87
|
+
title?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The value of the `<input>`.
|
|
90
|
+
* @deprecated
|
|
91
|
+
*/
|
|
92
|
+
value: string | number;
|
|
93
|
+
}
|
|
94
|
+
export declare const SelectableTile: React.ForwardRefExoticComponent<SelectableTileProps & React.RefAttributes<HTMLDivElement>>;
|
|
95
|
+
export interface ExpandableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
96
|
+
children?: ReactNode;
|
|
97
|
+
className?: string;
|
|
98
|
+
/** @deprecated */
|
|
99
|
+
light?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* `true` if the tile is expanded.
|
|
102
|
+
*/
|
|
103
|
+
expanded?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* An ID that can be provided to aria-labelledby
|
|
106
|
+
*/
|
|
107
|
+
id?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Specify the function to run when the ExpandableTile is clicked
|
|
110
|
+
*/
|
|
111
|
+
onClick?(event: MouseEvent): void;
|
|
112
|
+
/**
|
|
113
|
+
* optional handler to trigger a function when a key is pressed
|
|
114
|
+
*/
|
|
115
|
+
onKeyUp?(event: KeyboardEvent): void;
|
|
116
|
+
/**
|
|
117
|
+
* The `tabindex` attribute.
|
|
118
|
+
*/
|
|
119
|
+
tabIndex?: number;
|
|
120
|
+
/**
|
|
121
|
+
* The description of the "collapsed" icon that can be read by screen readers.
|
|
122
|
+
*/
|
|
123
|
+
tileCollapsedIconText?: string;
|
|
124
|
+
/**
|
|
125
|
+
* When "collapsed", a label to appear next to the chevron (e.g., "View more").
|
|
126
|
+
*/
|
|
127
|
+
tileCollapsedLabel?: string;
|
|
128
|
+
/**
|
|
129
|
+
* The description of the "expanded" icon that can be read by screen readers.
|
|
130
|
+
*/
|
|
131
|
+
tileExpandedIconText?: string;
|
|
132
|
+
/**
|
|
133
|
+
* When "expanded", a label to appear next to the chevron (e.g., "View less").
|
|
134
|
+
*/
|
|
135
|
+
tileExpandedLabel?: string;
|
|
136
|
+
tileMaxHeight?: number;
|
|
137
|
+
tilePadding?: number;
|
|
138
|
+
}
|
|
139
|
+
export declare const ExpandableTile: React.ForwardRefExoticComponent<ExpandableTileProps & React.RefAttributes<HTMLElement>>;
|
|
140
|
+
export interface TileAboveTheFoldContentProps {
|
|
141
|
+
/**
|
|
142
|
+
* The child nodes.
|
|
143
|
+
*/
|
|
144
|
+
children?: ReactNode;
|
|
145
|
+
}
|
|
146
|
+
export declare const TileAboveTheFoldContent: React.ForwardRefExoticComponent<TileAboveTheFoldContentProps & React.RefAttributes<HTMLSpanElement>>;
|
|
147
|
+
export interface TileBelowTheFoldContentProps {
|
|
148
|
+
/**
|
|
149
|
+
* The child nodes.
|
|
150
|
+
*/
|
|
151
|
+
children?: ReactNode;
|
|
152
|
+
}
|
|
153
|
+
export declare const TileBelowTheFoldContent: React.ForwardRefExoticComponent<TileBelowTheFoldContentProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -30,9 +30,7 @@ const Tile = /*#__PURE__*/React__default.forwardRef(function Tile(_ref, ref) {
|
|
|
30
30
|
...rest
|
|
31
31
|
} = _ref;
|
|
32
32
|
const prefix = usePrefix();
|
|
33
|
-
const tileClasses = cx(`${prefix}--tile`, {
|
|
34
|
-
[`${prefix}--tile--light`]: light
|
|
35
|
-
}, className);
|
|
33
|
+
const tileClasses = cx(`${prefix}--tile`, light && `${prefix}--tile--light`, className);
|
|
36
34
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
37
35
|
className: tileClasses,
|
|
38
36
|
ref: ref
|
|
@@ -51,6 +49,8 @@ Tile.propTypes = {
|
|
|
51
49
|
/**
|
|
52
50
|
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
53
51
|
* Don't use this to make tile background color same as container background color.
|
|
52
|
+
*
|
|
53
|
+
* @deprecated
|
|
54
54
|
*/
|
|
55
55
|
light: deprecate(PropTypes.bool, 'The `light` prop for `Tile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead.')
|
|
56
56
|
};
|
|
@@ -68,10 +68,7 @@ const ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableT
|
|
|
68
68
|
...rest
|
|
69
69
|
} = _ref2;
|
|
70
70
|
const prefix = usePrefix();
|
|
71
|
-
const classes = cx(`${prefix}--tile`, `${prefix}--tile--clickable`, {
|
|
72
|
-
[`${prefix}--tile--is-clicked`]: clicked,
|
|
73
|
-
[`${prefix}--tile--light`]: light
|
|
74
|
-
}, className);
|
|
71
|
+
const classes = cx(`${prefix}--tile`, `${prefix}--tile--clickable`, clicked && `${prefix}--tile--is-clicked`, light && `${prefix}--tile--light`, className);
|
|
75
72
|
const [isSelected, setIsSelected] = useState(clicked);
|
|
76
73
|
function handleOnClick(evt) {
|
|
77
74
|
evt.persist();
|
|
@@ -103,7 +100,7 @@ const ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableT
|
|
|
103
100
|
return /*#__PURE__*/React__default.createElement(Link, _extends({
|
|
104
101
|
className: classes,
|
|
105
102
|
href: href,
|
|
106
|
-
onClick: !disabled ? handleOnClick :
|
|
103
|
+
onClick: !disabled ? handleOnClick : undefined,
|
|
107
104
|
onKeyDown: handleOnKeyDown,
|
|
108
105
|
ref: ref,
|
|
109
106
|
disabled: disabled
|
|
@@ -155,6 +152,7 @@ ClickableTile.propTypes = {
|
|
|
155
152
|
* Optional prop to allow overriding the icon rendering.
|
|
156
153
|
* Can be a React component class
|
|
157
154
|
*/
|
|
155
|
+
// @ts-expect-error: Invalid derived prop type, seemingly no real solution.
|
|
158
156
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
159
157
|
};
|
|
160
158
|
const SelectableTile = /*#__PURE__*/React__default.forwardRef(function SelectableTile(_ref3, ref) {
|
|
@@ -164,14 +162,12 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
|
|
|
164
162
|
disabled,
|
|
165
163
|
id,
|
|
166
164
|
light,
|
|
167
|
-
name,
|
|
168
165
|
onClick = () => {},
|
|
169
166
|
onChange = () => {},
|
|
170
167
|
onKeyDown = () => {},
|
|
171
168
|
selected = false,
|
|
172
169
|
tabIndex = 0,
|
|
173
170
|
title = 'title',
|
|
174
|
-
value = 'value',
|
|
175
171
|
...rest
|
|
176
172
|
} = _ref3;
|
|
177
173
|
const prefix = usePrefix();
|
|
@@ -179,11 +175,7 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
|
|
|
179
175
|
const keyDownHandler = onKeyDown;
|
|
180
176
|
const [isSelected, setIsSelected] = useState(selected);
|
|
181
177
|
const [prevSelected, setPrevSelected] = useState(selected);
|
|
182
|
-
const classes = cx(`${prefix}--tile`, `${prefix}--tile--selectable`, {
|
|
183
|
-
[`${prefix}--tile--is-selected`]: isSelected,
|
|
184
|
-
[`${prefix}--tile--light`]: light,
|
|
185
|
-
[`${prefix}--tile--disabled`]: disabled
|
|
186
|
-
}, className);
|
|
178
|
+
const classes = cx(`${prefix}--tile`, `${prefix}--tile--selectable`, isSelected && `${prefix}--tile--is-selected`, light && `${prefix}--tile--light`, disabled && `${prefix}--tile--disabled`, className);
|
|
187
179
|
|
|
188
180
|
// TODO: rename to handleClick when handleClick prop is deprecated
|
|
189
181
|
function handleOnClick(evt) {
|
|
@@ -212,38 +204,33 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
|
|
|
212
204
|
setIsSelected(selected);
|
|
213
205
|
setPrevSelected(selected);
|
|
214
206
|
}
|
|
215
|
-
return
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
207
|
+
return (
|
|
208
|
+
/*#__PURE__*/
|
|
209
|
+
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
|
210
|
+
React__default.createElement("div", _extends({
|
|
211
|
+
className: classes,
|
|
212
|
+
onClick: !disabled ? handleOnClick : undefined,
|
|
213
|
+
role: "checkbox",
|
|
214
|
+
"aria-checked": isSelected,
|
|
215
|
+
onKeyDown: !disabled ? handleOnKeyDown : undefined
|
|
216
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
217
|
+
,
|
|
218
|
+
tabIndex: !disabled ? tabIndex : undefined,
|
|
219
|
+
ref: ref,
|
|
220
|
+
id: id,
|
|
221
|
+
onChange: !disabled ? handleChange : undefined,
|
|
222
|
+
title: title
|
|
223
|
+
}, rest), /*#__PURE__*/React__default.createElement("span", {
|
|
224
|
+
className: `${prefix}--tile__checkmark ${prefix}--tile__checkmark--persistent`
|
|
225
|
+
}, isSelected ? _CheckboxCheckedFille || (_CheckboxCheckedFille = /*#__PURE__*/React__default.createElement(CheckboxCheckedFilled, null)) : _Checkbox || (_Checkbox = /*#__PURE__*/React__default.createElement(Checkbox, null))), /*#__PURE__*/React__default.createElement("label", {
|
|
226
|
+
htmlFor: id,
|
|
227
|
+
className: `${prefix}--tile-content`
|
|
228
|
+
}, children))
|
|
229
|
+
);
|
|
237
230
|
});
|
|
238
231
|
SelectableTile.displayName = 'SelectableTile';
|
|
239
232
|
SelectableTile.propTypes = {
|
|
240
|
-
/**
|
|
241
|
-
* The child nodes.
|
|
242
|
-
*/
|
|
243
233
|
children: PropTypes.node,
|
|
244
|
-
/**
|
|
245
|
-
* The CSS class names.
|
|
246
|
-
*/
|
|
247
234
|
className: PropTypes.string,
|
|
248
235
|
/**
|
|
249
236
|
* Specify whether the SelectableTile should be disabled
|
|
@@ -260,6 +247,7 @@ SelectableTile.propTypes = {
|
|
|
260
247
|
light: deprecate(PropTypes.bool, 'The `light` prop for `SelectableTile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead.'),
|
|
261
248
|
/**
|
|
262
249
|
* The `name` of the `<input>`.
|
|
250
|
+
* @deprecated
|
|
263
251
|
*/
|
|
264
252
|
name: PropTypes.string,
|
|
265
253
|
/**
|
|
@@ -288,23 +276,24 @@ SelectableTile.propTypes = {
|
|
|
288
276
|
title: PropTypes.string,
|
|
289
277
|
/**
|
|
290
278
|
* The value of the `<input>`.
|
|
279
|
+
* @deprecated
|
|
291
280
|
*/
|
|
292
281
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
|
|
293
282
|
};
|
|
294
283
|
const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function ExpandableTile(_ref4, forwardRef) {
|
|
295
284
|
let {
|
|
296
|
-
tabIndex,
|
|
285
|
+
tabIndex = 0,
|
|
297
286
|
className,
|
|
298
287
|
children,
|
|
299
|
-
expanded,
|
|
300
|
-
tileMaxHeight,
|
|
288
|
+
expanded = false,
|
|
289
|
+
tileMaxHeight = 0,
|
|
301
290
|
// eslint-disable-line
|
|
302
|
-
tilePadding,
|
|
291
|
+
tilePadding = 0,
|
|
303
292
|
// eslint-disable-line
|
|
304
293
|
onClick,
|
|
305
294
|
onKeyUp,
|
|
306
|
-
tileCollapsedIconText,
|
|
307
|
-
tileExpandedIconText,
|
|
295
|
+
tileCollapsedIconText = 'Interact to expand Tile',
|
|
296
|
+
tileExpandedIconText = 'Interact to collapse Tile',
|
|
308
297
|
tileCollapsedLabel,
|
|
309
298
|
tileExpandedLabel,
|
|
310
299
|
light,
|
|
@@ -321,8 +310,8 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
|
|
|
321
310
|
const belowTheFold = useRef(null);
|
|
322
311
|
const tileContent = useRef(null);
|
|
323
312
|
const tile = useRef(null);
|
|
324
|
-
const prefix = usePrefix();
|
|
325
313
|
const ref = useMergedRefs([forwardRef, tile]);
|
|
314
|
+
const prefix = usePrefix();
|
|
326
315
|
if (expanded !== prevExpanded) {
|
|
327
316
|
setIsExpanded(expanded);
|
|
328
317
|
setPrevExpanded(expanded);
|
|
@@ -337,10 +326,12 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
|
|
|
337
326
|
setPrevTilePadding(tilePadding);
|
|
338
327
|
}
|
|
339
328
|
function setMaxHeight() {
|
|
340
|
-
if (isExpanded) {
|
|
341
|
-
setIsTileMaxHeight(tileContent.current.getBoundingClientRect()
|
|
329
|
+
if (isExpanded && tileContent.current) {
|
|
330
|
+
setIsTileMaxHeight(tileContent.current.getBoundingClientRect()?.height);
|
|
331
|
+
}
|
|
332
|
+
if (aboveTheFold.current) {
|
|
333
|
+
setIsTileMaxHeight(aboveTheFold.current.getBoundingClientRect().height);
|
|
342
334
|
}
|
|
343
|
-
setIsTileMaxHeight(aboveTheFold.current.getBoundingClientRect().height);
|
|
344
335
|
}
|
|
345
336
|
function handleClick(evt) {
|
|
346
337
|
evt.persist();
|
|
@@ -361,13 +352,13 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
|
|
|
361
352
|
[`${prefix}--tile--is-expanded`]: isExpanded,
|
|
362
353
|
[`${prefix}--tile--light`]: light
|
|
363
354
|
}, className);
|
|
364
|
-
const interactiveClassNames = cx(`${prefix}--tile`, `${prefix}--tile--expandable`, `${prefix}--tile--expandable--interactive`, {
|
|
365
|
-
[`${prefix}--tile--is-expanded`]: isExpanded,
|
|
366
|
-
[`${prefix}--tile--light`]: light
|
|
367
|
-
}, className);
|
|
355
|
+
const interactiveClassNames = cx(`${prefix}--tile`, `${prefix}--tile--expandable`, `${prefix}--tile--expandable--interactive`, isExpanded && `${prefix}--tile--is-expanded`, light && `${prefix}--tile--light`, className);
|
|
368
356
|
const chevronInteractiveClassNames = cx(`${prefix}--tile__chevron`, `${prefix}--tile__chevron--interactive`);
|
|
369
357
|
const childrenAsArray = getChildren();
|
|
370
358
|
useIsomorphicEffect(() => {
|
|
359
|
+
if (!tile.current || !aboveTheFold.current) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
371
362
|
const getStyle = window.getComputedStyle(tile.current, null);
|
|
372
363
|
const {
|
|
373
364
|
current: node
|
|
@@ -381,6 +372,9 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
|
|
|
381
372
|
setIsTilePadding(paddingTop + paddingBottom);
|
|
382
373
|
}, [isTileMaxHeight]);
|
|
383
374
|
useIsomorphicEffect(() => {
|
|
375
|
+
if (!aboveTheFold.current || !belowTheFold.current) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
384
378
|
if (!getInteractiveContent(belowTheFold.current)) {
|
|
385
379
|
setInteractive(false);
|
|
386
380
|
return;
|
|
@@ -389,13 +383,19 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
|
|
|
389
383
|
}
|
|
390
384
|
}, []);
|
|
391
385
|
useIsomorphicEffect(() => {
|
|
386
|
+
if (!tile.current) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
392
389
|
if (isExpanded) {
|
|
393
|
-
tile.current.style.maxHeight =
|
|
390
|
+
tile.current.style.maxHeight = '';
|
|
394
391
|
} else {
|
|
395
392
|
tile.current.style.maxHeight = isTileMaxHeight + isTilePadding + 'px';
|
|
396
393
|
}
|
|
397
394
|
}, [isExpanded, isTileMaxHeight, isTilePadding]);
|
|
398
395
|
useEffect(() => {
|
|
396
|
+
if (!aboveTheFold.current) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
399
|
const resizeObserver = new ResizeObserver(entries => {
|
|
400
400
|
const [aboveTheFold] = entries;
|
|
401
401
|
setIsTileMaxHeight(aboveTheFold.contentRect.height);
|
|
@@ -404,6 +404,7 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
|
|
|
404
404
|
return () => resizeObserver.disconnect();
|
|
405
405
|
}, []);
|
|
406
406
|
return interactive ? /*#__PURE__*/React__default.createElement("div", _extends({
|
|
407
|
+
// @ts-expect-error: Needlesly strict & deep typing for the element type
|
|
407
408
|
ref: ref,
|
|
408
409
|
className: interactiveClassNames,
|
|
409
410
|
"aria-expanded": isExpanded
|
|
@@ -423,7 +424,9 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
|
|
|
423
424
|
ref: belowTheFold,
|
|
424
425
|
className: `${prefix}--tile-content`
|
|
425
426
|
}, childrenAsArray[1]))) : /*#__PURE__*/React__default.createElement("button", _extends({
|
|
426
|
-
type: "button"
|
|
427
|
+
type: "button"
|
|
428
|
+
// @ts-expect-error: Needlesly strict & deep typing for the element type
|
|
429
|
+
,
|
|
427
430
|
ref: ref,
|
|
428
431
|
className: classNames,
|
|
429
432
|
"aria-expanded": isExpanded,
|
|
@@ -445,13 +448,7 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
|
|
|
445
448
|
}, childrenAsArray[1])));
|
|
446
449
|
});
|
|
447
450
|
ExpandableTile.propTypes = {
|
|
448
|
-
/**
|
|
449
|
-
* The child nodes.
|
|
450
|
-
*/
|
|
451
451
|
children: PropTypes.node,
|
|
452
|
-
/**
|
|
453
|
-
* The CSS class names.
|
|
454
|
-
*/
|
|
455
452
|
className: PropTypes.string,
|
|
456
453
|
/**
|
|
457
454
|
* `true` if the tile is expanded.
|
|
@@ -495,15 +492,6 @@ ExpandableTile.propTypes = {
|
|
|
495
492
|
*/
|
|
496
493
|
tileExpandedLabel: PropTypes.string
|
|
497
494
|
};
|
|
498
|
-
ExpandableTile.defaultProps = {
|
|
499
|
-
tabIndex: 0,
|
|
500
|
-
expanded: false,
|
|
501
|
-
tileMaxHeight: 0,
|
|
502
|
-
tilePadding: 0,
|
|
503
|
-
onClick: () => {},
|
|
504
|
-
tileCollapsedIconText: 'Interact to expand Tile',
|
|
505
|
-
tileExpandedIconText: 'Interact to collapse Tile'
|
|
506
|
-
};
|
|
507
495
|
ExpandableTile.displayName = 'ExpandableTile';
|
|
508
496
|
const TileAboveTheFoldContent = /*#__PURE__*/React__default.forwardRef(function TilAboveTheFoldContent(_ref5, ref) {
|
|
509
497
|
let {
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
export { Tile, type TileProps, ClickableTile, type ClickableTileProps, SelectableTile, type SelectableTileProps, ExpandableTile, type ExpandableTileProps, TileAboveTheFoldContent, type TileAboveTheFoldContentProps, TileBelowTheFoldContent, type TileBelowTheFoldContentProps, } from './Tile';
|
|
@@ -4,55 +4,11 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
8
7
|
import React from 'react';
|
|
9
|
-
|
|
10
|
-
'aria-label'
|
|
11
|
-
/**
|
|
12
|
-
* Specify an optional className to add to the form item wrapper.
|
|
13
|
-
*/
|
|
8
|
+
interface ToggleSkeletonProps {
|
|
9
|
+
'aria-label'?: string;
|
|
14
10
|
className?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Provide an id that unique represents the underlying `<input>`
|
|
17
|
-
*/
|
|
18
|
-
id?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Provide the text that will be read by a screen reader when visiting this
|
|
21
|
-
* control
|
|
22
|
-
* `aria-label` is always required but will be null if `labelText` is also
|
|
23
|
-
* provided
|
|
24
|
-
*/
|
|
25
|
-
labelText?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Specify the size of the Toggle. Currently only supports 'sm' or 'md' (default)
|
|
28
|
-
*/
|
|
29
|
-
size?: 'sm' | 'md';
|
|
30
|
-
} & React.HTMLAttributes<HTMLDivElement>;
|
|
31
|
-
declare class ToggleSkeleton extends React.Component<ToggleSkeletonProps> {
|
|
32
|
-
static propTypes: {
|
|
33
|
-
"aria-label": PropTypes.Validator<string>;
|
|
34
|
-
/**
|
|
35
|
-
* Specify an optional className to add to the form item wrapper.
|
|
36
|
-
*/
|
|
37
|
-
className: PropTypes.Requireable<string>;
|
|
38
|
-
/**
|
|
39
|
-
* Provide an id that unique represents the underlying `<input>`
|
|
40
|
-
*/
|
|
41
|
-
id: PropTypes.Requireable<string>;
|
|
42
|
-
/**
|
|
43
|
-
* Provide the text that will be read by a screen reader when visiting this
|
|
44
|
-
* control
|
|
45
|
-
* `aria-label` is always required but will be undefined if `labelText` is also
|
|
46
|
-
* provided
|
|
47
|
-
*/
|
|
48
|
-
labelText: PropTypes.Requireable<string>;
|
|
49
|
-
/**
|
|
50
|
-
* Specify the size of the Toggle. Currently only supports 'sm' or 'md' (default)
|
|
51
|
-
*/
|
|
52
|
-
size: PropTypes.Requireable<string>;
|
|
53
|
-
};
|
|
54
|
-
static defaultProps: Partial<ToggleSkeletonProps>;
|
|
55
|
-
render(): JSX.Element;
|
|
56
11
|
}
|
|
12
|
+
declare const ToggleSkeleton: React.FC<ToggleSkeletonProps>;
|
|
57
13
|
export default ToggleSkeleton;
|
|
58
14
|
export { ToggleSkeleton };
|
|
@@ -5,73 +5,33 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { extends as _extends
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
-
import {
|
|
12
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
htmlFor: id,
|
|
37
|
-
"aria-label": labelText ? undefined : this.props['aria-label']
|
|
38
|
-
}, labelText ? _div || (_div = /*#__PURE__*/React__default.createElement("div", null, labelText)) : null, /*#__PURE__*/React__default.createElement("span", {
|
|
39
|
-
className: `${prefix}--toggle__switch`
|
|
40
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
41
|
-
className: `${prefix}--toggle__text--left`
|
|
42
|
-
}), /*#__PURE__*/React__default.createElement("span", {
|
|
43
|
-
className: `${prefix}--toggle__appearance`
|
|
44
|
-
}), /*#__PURE__*/React__default.createElement("span", {
|
|
45
|
-
className: `${prefix}--toggle__text--right`
|
|
46
|
-
}))));
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
_defineProperty(ToggleSkeleton, "propTypes", {
|
|
51
|
-
['aria-label']: PropTypes.string.isRequired,
|
|
52
|
-
/**
|
|
53
|
-
* Specify an optional className to add to the form item wrapper.
|
|
54
|
-
*/
|
|
55
|
-
className: PropTypes.string,
|
|
56
|
-
/**
|
|
57
|
-
* Provide an id that unique represents the underlying `<input>`
|
|
58
|
-
*/
|
|
59
|
-
id: PropTypes.string,
|
|
60
|
-
/**
|
|
61
|
-
* Provide the text that will be read by a screen reader when visiting this
|
|
62
|
-
* control
|
|
63
|
-
* `aria-label` is always required but will be undefined if `labelText` is also
|
|
64
|
-
* provided
|
|
65
|
-
*/
|
|
66
|
-
labelText: PropTypes.string,
|
|
67
|
-
/**
|
|
68
|
-
* Specify the size of the Toggle. Currently only supports 'sm' or 'md' (default)
|
|
69
|
-
*/
|
|
70
|
-
size: PropTypes.oneOf(['sm', 'md'])
|
|
71
|
-
});
|
|
72
|
-
_defineProperty(ToggleSkeleton, "defaultProps", {
|
|
73
|
-
['aria-label']: 'Toggle is loading',
|
|
74
|
-
size: 'md'
|
|
75
|
-
});
|
|
14
|
+
const ToggleSkeleton = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
'aria-label': ariaLabel = 'Toggle is loading',
|
|
17
|
+
className,
|
|
18
|
+
...rest
|
|
19
|
+
} = _ref;
|
|
20
|
+
const prefix = usePrefix();
|
|
21
|
+
const skeletonClassNames = cx(`${prefix}--toggle ${prefix}--toggle--skeleton`, className);
|
|
22
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
23
|
+
className: skeletonClassNames
|
|
24
|
+
}, rest, {
|
|
25
|
+
"aria-label": ariaLabel
|
|
26
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
27
|
+
className: `${prefix}--toggle__skeleton-circle`
|
|
28
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
29
|
+
className: `${prefix}--toggle__skeleton-rectangle`
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
ToggleSkeleton.propTypes = {
|
|
33
|
+
'aria-label': PropTypes.string,
|
|
34
|
+
className: PropTypes.string
|
|
35
|
+
};
|
|
76
36
|
|
|
77
37
|
export { ToggleSkeleton, ToggleSkeleton as default };
|
|
@@ -74,7 +74,7 @@ function Toggle(_ref) {
|
|
|
74
74
|
// the keyboard event which already calls handleClick. if we wouldn't catch this, the
|
|
75
75
|
// onClick and onToggle functions would be called twice whenever the user activates the
|
|
76
76
|
// toggle by keyboard and props['aria-labelledby'] is passed.
|
|
77
|
-
if (buttonElement.current && e.target !== buttonElement.current) {
|
|
77
|
+
if (buttonElement.current && e.target !== buttonElement.current && !disabled) {
|
|
78
78
|
handleClick(e);
|
|
79
79
|
buttonElement.current.focus();
|
|
80
80
|
}
|
|
@@ -11,6 +11,7 @@ import React__default from 'react';
|
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
|
|
13
13
|
import Button from '../Button/Button.js';
|
|
14
|
+
import '../Button/Button.Skeleton.js';
|
|
14
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
16
|
|
|
16
17
|
/**
|