@carbon/react 1.46.1 → 1.47.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 +1071 -955
- package/es/components/Accordion/AccordionItem.js +3 -1
- package/es/components/ContentSwitcher/index.d.ts +11 -0
- package/es/components/DataTable/TableExpandRow.d.ts +1 -1
- package/es/components/DataTable/TableHeader.d.ts +1 -1
- package/es/components/ErrorBoundary/ErrorBoundary.d.ts +47 -0
- package/es/components/ErrorBoundary/ErrorBoundary.js +2 -0
- package/es/components/ErrorBoundary/ErrorBoundaryContext.d.ts +11 -0
- package/es/components/ErrorBoundary/index.d.ts +8 -0
- package/es/components/FeatureFlags/index.js +2 -2
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +3 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +8 -1
- package/es/components/ModalWrapper/ModalWrapper.d.ts +75 -0
- package/es/components/ModalWrapper/ModalWrapper.js +15 -14
- package/es/components/ModalWrapper/index.d.ts +9 -0
- package/es/components/OverflowMenu/OverflowMenu.js +1 -1
- package/es/components/PrimaryButton/PrimaryButton.d.ts +10 -0
- package/es/components/PrimaryButton/PrimaryButton.js +1 -2
- package/es/components/PrimaryButton/index.d.ts +9 -0
- package/es/components/ProgressBar/ProgressBar.d.ts +88 -0
- package/es/components/ProgressBar/ProgressBar.js +13 -11
- package/es/components/ProgressBar/index.d.ts +9 -0
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.d.ts +33 -0
- package/es/components/ProgressIndicator/ProgressIndicator.d.ts +179 -0
- package/es/components/ProgressIndicator/ProgressIndicator.js +4 -6
- package/es/components/ProgressIndicator/index.d.ts +8 -0
- package/es/components/Search/Search.js +3 -2
- package/es/components/SecondaryButton/SecondaryButton.d.ts +10 -0
- package/es/components/SecondaryButton/SecondaryButton.js +1 -2
- package/es/components/SecondaryButton/index.d.ts +9 -0
- package/es/components/SkeletonIcon/SkeletonIcon.js +1 -2
- package/es/components/SkeletonIcon/index.d.ts +9 -0
- package/es/components/Slider/Slider.Skeleton.js +1 -2
- package/es/components/Slider/Slider.d.ts +1 -1
- package/es/components/Slider/index.d.ts +11 -0
- package/es/components/Stack/Stack.d.ts +58 -0
- package/es/components/Stack/Stack.js +0 -1
- package/es/components/Stack/index.d.ts +11 -0
- package/es/components/Switch/Switch.js +1 -2
- package/es/components/Switch/index.d.ts +10 -0
- package/es/components/TextArea/TextArea.d.ts +5 -0
- package/es/components/TextArea/TextArea.js +9 -0
- package/es/components/TileGroup/TileGroup.d.ts +83 -0
- package/es/components/TileGroup/TileGroup.js +67 -79
- package/es/components/Toggle/Toggle.d.ts +1 -1
- package/es/components/TreeView/TreeNode.js +3 -0
- package/es/components/UIShell/SideNavMenu.js +0 -8
- package/es/components/UIShell/SideNavSwitcher.d.ts +1 -1
- package/es/index.js +12 -12
- package/es/internal/createClassWrapper.d.ts +12 -0
- package/es/internal/createClassWrapper.js +0 -3
- package/lib/components/Accordion/AccordionItem.js +3 -1
- package/lib/components/ContentSwitcher/index.d.ts +11 -0
- package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +1 -1
- package/lib/components/ErrorBoundary/ErrorBoundary.d.ts +47 -0
- package/lib/components/ErrorBoundary/ErrorBoundary.js +2 -0
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.d.ts +11 -0
- package/lib/components/ErrorBoundary/index.d.ts +8 -0
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +3 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +8 -1
- package/lib/components/ModalWrapper/ModalWrapper.d.ts +75 -0
- package/lib/components/ModalWrapper/ModalWrapper.js +15 -14
- package/lib/components/ModalWrapper/index.d.ts +9 -0
- package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
- package/lib/components/PrimaryButton/PrimaryButton.d.ts +10 -0
- package/lib/components/PrimaryButton/PrimaryButton.js +1 -2
- package/lib/components/PrimaryButton/index.d.ts +9 -0
- package/lib/components/ProgressBar/ProgressBar.d.ts +88 -0
- package/lib/components/ProgressBar/ProgressBar.js +13 -11
- package/lib/components/ProgressBar/index.d.ts +9 -0
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.d.ts +33 -0
- package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +179 -0
- package/lib/components/ProgressIndicator/ProgressIndicator.js +4 -6
- package/lib/components/ProgressIndicator/index.d.ts +8 -0
- package/lib/components/Search/Search.js +3 -2
- package/lib/components/SecondaryButton/SecondaryButton.d.ts +10 -0
- package/lib/components/SecondaryButton/SecondaryButton.js +1 -2
- package/lib/components/SecondaryButton/index.d.ts +9 -0
- package/lib/components/SkeletonIcon/SkeletonIcon.js +1 -2
- package/lib/components/SkeletonIcon/index.d.ts +9 -0
- package/lib/components/Slider/Slider.Skeleton.js +1 -2
- package/lib/components/Slider/Slider.d.ts +1 -1
- package/lib/components/Slider/index.d.ts +11 -0
- package/lib/components/Stack/Stack.d.ts +58 -0
- package/lib/components/Stack/Stack.js +0 -1
- package/lib/components/Stack/index.d.ts +11 -0
- package/lib/components/Switch/Switch.js +1 -2
- package/lib/components/Switch/index.d.ts +10 -0
- package/lib/components/TextArea/TextArea.d.ts +5 -0
- package/lib/components/TextArea/TextArea.js +9 -0
- package/lib/components/TileGroup/TileGroup.d.ts +83 -0
- package/lib/components/TileGroup/TileGroup.js +64 -76
- package/lib/components/Toggle/Toggle.d.ts +1 -1
- package/lib/components/TreeView/TreeNode.js +3 -0
- package/lib/components/UIShell/SideNavMenu.js +0 -8
- package/lib/components/UIShell/SideNavSwitcher.d.ts +1 -1
- package/lib/index.js +25 -25
- package/lib/internal/createClassWrapper.d.ts +12 -0
- package/lib/internal/createClassWrapper.js +0 -3
- package/package.json +6 -5
|
@@ -64,7 +64,9 @@ function AccordionItem(_ref) {
|
|
|
64
64
|
content.current.style.maxBlockSize = '';
|
|
65
65
|
} else {
|
|
66
66
|
// accordion opens
|
|
67
|
-
content.current.style.maxBlockSize =
|
|
67
|
+
content.current.style.maxBlockSize =
|
|
68
|
+
// Scroll height plus top/bottom padding
|
|
69
|
+
content.current.scrollHeight + 32 + 'px';
|
|
68
70
|
}
|
|
69
71
|
const nextValue = !isOpen;
|
|
70
72
|
setIsOpen(nextValue);
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
8
|
+
import { ContentSwitcherProps } from './ContentSwitcher';
|
|
9
|
+
declare const ContentSwitcher: import("react").FunctionComponent<ContentSwitcherProps>;
|
|
10
|
+
export default ContentSwitcher;
|
|
11
|
+
export { ContentSwitcher };
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { MouseEventHandler, PropsWithChildren } from 'react';
|
|
7
|
+
import React, { type MouseEventHandler, type PropsWithChildren } from 'react';
|
|
8
8
|
import { TableRowProps } from './TableRow';
|
|
9
9
|
interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
|
|
10
10
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { ReactNodeLike } from 'prop-types';
|
|
8
|
-
import React, { MouseEventHandler } from 'react';
|
|
8
|
+
import React, { type MouseEventHandler } from 'react';
|
|
9
9
|
import { ReactAttr } from '../../types/common';
|
|
10
10
|
interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonElement> {
|
|
11
11
|
/**
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
import React, { ErrorInfo, ReactNode } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { ErrorBoundaryContext } from './ErrorBoundaryContext';
|
|
10
|
+
/**
|
|
11
|
+
* React introduced additional lifecycle methods in v16 for capturing errors
|
|
12
|
+
* that occur in a specific sub-tree of components. This component helps to
|
|
13
|
+
* consolidate some of the duplication that occurs when using these lifecycle
|
|
14
|
+
* methods across a codebase. In addition, it allows you to specify the fallback
|
|
15
|
+
* UI to display when an error occurs in the sub-tree through the `fallback`
|
|
16
|
+
* prop.
|
|
17
|
+
*
|
|
18
|
+
* This component roughly follows the React.js docs example code for these
|
|
19
|
+
* methods. In addition, it takes advantage of an `ErrorBoundaryContext` so that
|
|
20
|
+
* consumers can specify their own logic for logging errors. For example,
|
|
21
|
+
* reporting an error in the UI to an external service for every `ErrorBoundary`
|
|
22
|
+
* used.
|
|
23
|
+
*
|
|
24
|
+
* Reference:
|
|
25
|
+
* https://reactjs.org/docs/error-boundaries.html#introducing-error-boundaries
|
|
26
|
+
*/
|
|
27
|
+
interface ErrorBoundaryProps {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
fallback?: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
interface ErrorBoundaryState {
|
|
32
|
+
hasError: boolean;
|
|
33
|
+
}
|
|
34
|
+
export default class ErrorBoundary extends React.Component<ErrorBoundaryProps> {
|
|
35
|
+
static propTypes: {
|
|
36
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
37
|
+
fallback: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
38
|
+
};
|
|
39
|
+
static contextType: React.Context<import("./ErrorBoundaryContext").ErrorBoundaryContextType>;
|
|
40
|
+
context: React.ContextType<typeof ErrorBoundaryContext>;
|
|
41
|
+
static getDerivedStateFromError(): ErrorBoundaryState;
|
|
42
|
+
state: ErrorBoundaryState;
|
|
43
|
+
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
44
|
+
componentDidUpdate(prevProps: ErrorBoundaryProps): void;
|
|
45
|
+
render(): React.ReactNode;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -27,9 +27,11 @@ import { ErrorBoundaryContext } from './ErrorBoundaryContext.js';
|
|
|
27
27
|
* Reference:
|
|
28
28
|
* https://reactjs.org/docs/error-boundaries.html#introducing-error-boundaries
|
|
29
29
|
*/
|
|
30
|
+
|
|
30
31
|
class ErrorBoundary extends React__default.Component {
|
|
31
32
|
constructor() {
|
|
32
33
|
super(...arguments);
|
|
34
|
+
_defineProperty(this, "context", void 0);
|
|
33
35
|
_defineProperty(this, "state", {
|
|
34
36
|
hasError: false
|
|
35
37
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
import { ErrorInfo } from 'react';
|
|
8
|
+
export interface ErrorBoundaryContextType {
|
|
9
|
+
log: (error: Error, errorInfo: ErrorInfo) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const ErrorBoundaryContext: import("react").Context<ErrorBoundaryContextType>;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 { default as ErrorBoundary } from './ErrorBoundary';
|
|
8
|
+
export { ErrorBoundaryContext } from './ErrorBoundaryContext';
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { FeatureFlags as FeatureFlags$1, createScope } from '@carbon/feature-flags';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default, { useContext, useState, useRef, useEffect
|
|
10
|
+
import React__default, { createContext, useContext, useState, useRef, useEffect } from 'react';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
|
@@ -17,9 +17,10 @@ const FluidDropdownSkeleton = _ref => {
|
|
|
17
17
|
...rest
|
|
18
18
|
} = _ref;
|
|
19
19
|
const prefix = usePrefix();
|
|
20
|
-
const
|
|
20
|
+
const wrapperContainerClasses = cx(className, `${prefix}--list-box__wrapper--fluid`);
|
|
21
|
+
const wrapperClasses = cx(`${prefix}--skeleton`, `${prefix}--list-box`);
|
|
21
22
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
22
|
-
className:
|
|
23
|
+
className: wrapperContainerClasses
|
|
23
24
|
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
24
25
|
className: wrapperClasses
|
|
25
26
|
}, rest), /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -35,7 +35,7 @@ const InlineCheckbox = /*#__PURE__*/React__default.forwardRef(function InlineChe
|
|
|
35
35
|
disabled,
|
|
36
36
|
id,
|
|
37
37
|
name,
|
|
38
|
-
onClick,
|
|
38
|
+
onClick: onClick ? onClickCheckBoxInput : onClick,
|
|
39
39
|
onChange: evt => {
|
|
40
40
|
onChange(evt.target.checked, id, evt);
|
|
41
41
|
},
|
|
@@ -51,6 +51,13 @@ const InlineCheckbox = /*#__PURE__*/React__default.forwardRef(function InlineChe
|
|
|
51
51
|
inputRef.current.indeterminate = indeterminate;
|
|
52
52
|
}
|
|
53
53
|
}, [indeterminate]);
|
|
54
|
+
function onClickCheckBoxInput(evt) {
|
|
55
|
+
// If the previous "indeterminate" is true, change "checked" to false. If it is not undefined, we're working on `TableSelectAll`
|
|
56
|
+
if (indeterminate) {
|
|
57
|
+
evt.target.checked = false;
|
|
58
|
+
}
|
|
59
|
+
onClick(evt);
|
|
60
|
+
}
|
|
54
61
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
55
62
|
className: `${prefix}--checkbox--inline`
|
|
56
63
|
}, /*#__PURE__*/React__default.createElement("input", inputProps),
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
9
|
+
import { ButtonKinds } from '../Button';
|
|
10
|
+
interface ModalWrapperProps {
|
|
11
|
+
buttonTriggerClassName?: string;
|
|
12
|
+
buttonTriggerText?: ReactNode;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
handleOpen?: React.MouseEventHandler<HTMLButtonElement>;
|
|
16
|
+
handleSubmit?: React.ReactEventHandler<HTMLElement>;
|
|
17
|
+
id?: string;
|
|
18
|
+
modalBeforeContent?: boolean;
|
|
19
|
+
modalHeading?: string;
|
|
20
|
+
modalLabel?: string;
|
|
21
|
+
modalText?: string;
|
|
22
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
23
|
+
passiveModal?: boolean;
|
|
24
|
+
preventCloseOnClickOutside?: boolean;
|
|
25
|
+
primaryButtonText?: string;
|
|
26
|
+
renderTriggerButtonIcon: React.ElementType;
|
|
27
|
+
secondaryButtonText?: string;
|
|
28
|
+
selectorPrimaryFocus?: string;
|
|
29
|
+
shouldCloseAfterSubmit?: boolean;
|
|
30
|
+
status?: string;
|
|
31
|
+
triggerButtonIconDescription?: string;
|
|
32
|
+
triggerButtonKind: (typeof ButtonKinds)[number];
|
|
33
|
+
withHeader?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface ModelWrapperState {
|
|
36
|
+
isOpen: boolean;
|
|
37
|
+
}
|
|
38
|
+
export default class ModalWrapper extends React.Component<ModalWrapperProps, ModelWrapperState> {
|
|
39
|
+
if(__DEV__: any): void;
|
|
40
|
+
static propTypes: {
|
|
41
|
+
buttonTriggerClassName: PropTypes.Requireable<string>;
|
|
42
|
+
buttonTriggerText: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
43
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
44
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
45
|
+
handleOpen: PropTypes.Requireable<(...args: any[]) => any>;
|
|
46
|
+
handleSubmit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
+
id: PropTypes.Requireable<string>;
|
|
48
|
+
modalBeforeContent: PropTypes.Requireable<boolean>;
|
|
49
|
+
modalHeading: PropTypes.Requireable<string>;
|
|
50
|
+
modalLabel: PropTypes.Requireable<string>;
|
|
51
|
+
modalText: PropTypes.Requireable<string>;
|
|
52
|
+
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
|
+
passiveModal: PropTypes.Requireable<boolean>;
|
|
54
|
+
preventCloseOnClickOutside: PropTypes.Requireable<boolean>;
|
|
55
|
+
primaryButtonText: PropTypes.Requireable<string>;
|
|
56
|
+
renderTriggerButtonIcon: PropTypes.Requireable<object>;
|
|
57
|
+
secondaryButtonText: PropTypes.Requireable<string>;
|
|
58
|
+
selectorPrimaryFocus: PropTypes.Requireable<string>;
|
|
59
|
+
shouldCloseAfterSubmit: PropTypes.Requireable<boolean>;
|
|
60
|
+
status: PropTypes.Requireable<string>;
|
|
61
|
+
triggerButtonIconDescription: PropTypes.Requireable<string>;
|
|
62
|
+
triggerButtonKind: PropTypes.Requireable<"primary" | "secondary" | "ghost" | "tertiary" | "danger" | "danger--primary" | "danger--ghost" | "danger--tertiary">;
|
|
63
|
+
withHeader: PropTypes.Requireable<boolean>;
|
|
64
|
+
};
|
|
65
|
+
triggerButton: React.RefObject<HTMLButtonElement>;
|
|
66
|
+
modal: React.RefObject<HTMLDivElement>;
|
|
67
|
+
state: {
|
|
68
|
+
isOpen: boolean;
|
|
69
|
+
};
|
|
70
|
+
handleOpen: () => void;
|
|
71
|
+
handleClose: (evt: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
72
|
+
handleOnRequestSubmit: (evt: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
73
|
+
render(): JSX.Element;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
@@ -9,11 +9,12 @@ import { defineProperty as _defineProperty, extends as _extends } from '../../_v
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import Modal from '../Modal/Modal.js';
|
|
12
|
-
import Button from '../Button/Button.js';
|
|
12
|
+
import Button, { ButtonKinds } from '../Button/Button.js';
|
|
13
13
|
import '../Button/Button.Skeleton.js';
|
|
14
|
-
import { ButtonKinds } from '../../prop-types/types.js';
|
|
15
14
|
import { warning } from '../../internal/warning.js';
|
|
16
15
|
import { noopFn } from '../../internal/noopFn.js';
|
|
16
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
17
|
+
import { Escape } from '../../internal/keyboard/keys.js';
|
|
17
18
|
|
|
18
19
|
let didWarnAboutDeprecation = false;
|
|
19
20
|
class ModalWrapper extends React__default.Component {
|
|
@@ -30,25 +31,25 @@ class ModalWrapper extends React__default.Component {
|
|
|
30
31
|
});
|
|
31
32
|
});
|
|
32
33
|
_defineProperty(this, "handleClose", evt => {
|
|
33
|
-
const innerModal = this.modal.current
|
|
34
|
-
if (this.modal.current && evt && !innerModal
|
|
34
|
+
const innerModal = this.modal.current?.querySelector('div');
|
|
35
|
+
if (this.modal.current && evt && !innerModal?.contains(evt.target) && this.props.preventCloseOnClickOutside) {
|
|
35
36
|
return;
|
|
36
37
|
} else {
|
|
37
38
|
this.setState({
|
|
38
39
|
isOpen: false
|
|
39
|
-
}, () => this.triggerButton.current
|
|
40
|
+
}, () => this.triggerButton.current?.focus());
|
|
40
41
|
}
|
|
41
42
|
});
|
|
42
|
-
_defineProperty(this, "handleOnRequestSubmit",
|
|
43
|
+
_defineProperty(this, "handleOnRequestSubmit", evt => {
|
|
43
44
|
const {
|
|
44
45
|
handleSubmit,
|
|
45
46
|
shouldCloseAfterSubmit
|
|
46
47
|
} = this.props;
|
|
47
48
|
if (handleSubmit && shouldCloseAfterSubmit) {
|
|
48
|
-
handleSubmit();
|
|
49
|
-
this.handleClose();
|
|
49
|
+
handleSubmit(evt);
|
|
50
|
+
this.handleClose(evt);
|
|
50
51
|
}
|
|
51
|
-
handleSubmit();
|
|
52
|
+
handleSubmit?.(evt);
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
if(__DEV__) {
|
|
@@ -68,12 +69,12 @@ class ModalWrapper extends React__default.Component {
|
|
|
68
69
|
triggerButtonKind = 'primary',
|
|
69
70
|
disabled = false,
|
|
70
71
|
handleSubmit,
|
|
71
|
-
// eslint-disable-line no-unused-vars
|
|
72
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
72
73
|
shouldCloseAfterSubmit = true,
|
|
73
|
-
// eslint-disable-line no-unused-vars
|
|
74
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
74
75
|
selectorPrimaryFocus = '[data-modal-primary-focus]',
|
|
75
76
|
preventCloseOnClickOutside = false,
|
|
76
|
-
// eslint-disable-line no-unused-vars
|
|
77
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
77
78
|
...other
|
|
78
79
|
} = this.props;
|
|
79
80
|
const props = {
|
|
@@ -86,8 +87,8 @@ class ModalWrapper extends React__default.Component {
|
|
|
86
87
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
87
88
|
role: "presentation",
|
|
88
89
|
onKeyDown: evt => {
|
|
89
|
-
if (evt
|
|
90
|
-
this.handleClose();
|
|
90
|
+
if (match(evt, Escape)) {
|
|
91
|
+
this.handleClose(evt);
|
|
91
92
|
onKeyDown(evt);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
import ModalWrapper from './ModalWrapper';
|
|
8
|
+
export default ModalWrapper;
|
|
9
|
+
export { ModalWrapper };
|
|
@@ -241,7 +241,7 @@ class OverflowMenu extends Component {
|
|
|
241
241
|
current: triggerEl
|
|
242
242
|
} = this._triggerRef;
|
|
243
243
|
if (typeof target.matches === 'function') {
|
|
244
|
-
if (!menuBody.contains(target) && triggerEl && !target.matches(`.${this.context}--overflow-menu,.${this.context}--overflow-menu-options`)) {
|
|
244
|
+
if (!menuBody.contains(target) && triggerEl && !target.matches(`.${this.context}--overflow-menu:first-child,.${this.context}--overflow-menu-options:first-child`)) {
|
|
245
245
|
this.closeMenuAndFocus();
|
|
246
246
|
}
|
|
247
247
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
import React from 'react';
|
|
8
|
+
import { ButtonProps } from '../Button';
|
|
9
|
+
declare const PrimaryButton: <T extends React.ElementType<any>>(props: ButtonProps<T>) => JSX.Element;
|
|
10
|
+
export default PrimaryButton;
|
|
@@ -13,6 +13,5 @@ import '../Button/Button.Skeleton.js';
|
|
|
13
13
|
const PrimaryButton = props => /*#__PURE__*/React__default.createElement(Button, _extends({
|
|
14
14
|
kind: "primary"
|
|
15
15
|
}, props));
|
|
16
|
-
var PrimaryButton$1 = PrimaryButton;
|
|
17
16
|
|
|
18
|
-
export { PrimaryButton
|
|
17
|
+
export { PrimaryButton as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
import PrimaryButton from './PrimaryButton';
|
|
8
|
+
export default PrimaryButton;
|
|
9
|
+
export { PrimaryButton };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2021
|
|
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
|
+
/// <reference types="react" />
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
interface ProgressBarProps {
|
|
10
|
+
/**
|
|
11
|
+
* Additional CSS class names.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The current progress as a textual representation.
|
|
16
|
+
*/
|
|
17
|
+
helperText?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the label should be visually hidden.
|
|
20
|
+
*/
|
|
21
|
+
hideLabel?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* A label describing the progress bar.
|
|
24
|
+
*/
|
|
25
|
+
label: string;
|
|
26
|
+
/**
|
|
27
|
+
* The maximum value.
|
|
28
|
+
*/
|
|
29
|
+
max?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Specify the size of the progress bar.
|
|
32
|
+
*/
|
|
33
|
+
size?: 'small' | 'big';
|
|
34
|
+
/**
|
|
35
|
+
* Specify the status.
|
|
36
|
+
*/
|
|
37
|
+
status?: 'active' | 'finished' | 'error';
|
|
38
|
+
/**
|
|
39
|
+
* Defines the alignment variant of the progress bar.
|
|
40
|
+
*/
|
|
41
|
+
type?: 'default' | 'inline' | 'indented';
|
|
42
|
+
/**
|
|
43
|
+
* The current value.
|
|
44
|
+
*/
|
|
45
|
+
value?: number;
|
|
46
|
+
}
|
|
47
|
+
declare function ProgressBar({ className, helperText, hideLabel, label, max, size, status, type, value, }: ProgressBarProps): JSX.Element;
|
|
48
|
+
declare namespace ProgressBar {
|
|
49
|
+
var propTypes: {
|
|
50
|
+
/**
|
|
51
|
+
* Additional CSS class names.
|
|
52
|
+
*/
|
|
53
|
+
className: PropTypes.Requireable<string>;
|
|
54
|
+
/**
|
|
55
|
+
* The current progress as a textual representation.
|
|
56
|
+
*/
|
|
57
|
+
helperText: PropTypes.Requireable<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the label should be visually hidden.
|
|
60
|
+
*/
|
|
61
|
+
hideLabel: PropTypes.Requireable<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* A label describing the progress bar.
|
|
64
|
+
*/
|
|
65
|
+
label: PropTypes.Validator<string>;
|
|
66
|
+
/**
|
|
67
|
+
* The maximum value.
|
|
68
|
+
*/
|
|
69
|
+
max: PropTypes.Requireable<number>;
|
|
70
|
+
/**
|
|
71
|
+
* Specify the size of the ProgressBar.
|
|
72
|
+
*/
|
|
73
|
+
size: PropTypes.Requireable<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Specify the status.
|
|
76
|
+
*/
|
|
77
|
+
status: PropTypes.Requireable<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Defines the alignment variant of the progress bar.
|
|
80
|
+
*/
|
|
81
|
+
type: PropTypes.Requireable<string>;
|
|
82
|
+
/**
|
|
83
|
+
* The current value.
|
|
84
|
+
*/
|
|
85
|
+
value: PropTypes.Requireable<number>;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export default ProgressBar;
|
|
@@ -34,10 +34,10 @@ function ProgressBar(_ref) {
|
|
|
34
34
|
const isError = status === 'error';
|
|
35
35
|
const indeterminate = !isFinished && !isError && (value === null || value === undefined);
|
|
36
36
|
let cappedValue = value;
|
|
37
|
-
if (cappedValue > max) {
|
|
37
|
+
if (cappedValue && cappedValue > max) {
|
|
38
38
|
cappedValue = max;
|
|
39
39
|
}
|
|
40
|
-
if (cappedValue < 0) {
|
|
40
|
+
if (cappedValue && cappedValue < 0) {
|
|
41
41
|
cappedValue = 0;
|
|
42
42
|
}
|
|
43
43
|
if (isError) {
|
|
@@ -45,7 +45,7 @@ function ProgressBar(_ref) {
|
|
|
45
45
|
} else if (isFinished) {
|
|
46
46
|
cappedValue = max;
|
|
47
47
|
}
|
|
48
|
-
const percentage = cappedValue / max;
|
|
48
|
+
const percentage = (cappedValue ?? NaN) / max;
|
|
49
49
|
const wrapperClasses = cx(`${prefix}--progress-bar`, `${prefix}--progress-bar--${size}`, `${prefix}--progress-bar--${type}`, {
|
|
50
50
|
[`${prefix}--progress-bar--indeterminate`]: indeterminate,
|
|
51
51
|
[`${prefix}--progress-bar--finished`]: isFinished,
|
|
@@ -70,12 +70,14 @@ function ProgressBar(_ref) {
|
|
|
70
70
|
}, props));
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
const ref = useRef();
|
|
73
|
+
const ref = useRef(null);
|
|
74
74
|
useIsomorphicEffect(() => {
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
if (ref.current) {
|
|
76
|
+
if (!isFinished && !isError) {
|
|
77
|
+
ref.current.style.transform = `scaleX(${percentage})`;
|
|
78
|
+
} else {
|
|
79
|
+
ref.current.style.transform = '';
|
|
80
|
+
}
|
|
79
81
|
}
|
|
80
82
|
}, [percentage, isFinished, isError]);
|
|
81
83
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -94,9 +96,9 @@ function ProgressBar(_ref) {
|
|
|
94
96
|
"aria-invalid": isError,
|
|
95
97
|
"aria-labelledby": labelId,
|
|
96
98
|
"aria-describedby": helperText ? helperTextId : undefined,
|
|
97
|
-
"aria-valuemin": !indeterminate ? 0 :
|
|
98
|
-
"aria-valuemax": !indeterminate ? max :
|
|
99
|
-
"aria-valuenow": !indeterminate ? cappedValue :
|
|
99
|
+
"aria-valuemin": !indeterminate ? 0 : undefined,
|
|
100
|
+
"aria-valuemax": !indeterminate ? max : undefined,
|
|
101
|
+
"aria-valuenow": !indeterminate ? cappedValue : undefined
|
|
100
102
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
101
103
|
className: `${prefix}--progress-bar__bar`,
|
|
102
104
|
ref: ref
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2021
|
|
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 ProgressBar from './ProgressBar';
|
|
8
|
+
export default ProgressBar;
|
|
9
|
+
export { ProgressBar };
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
interface ProgressIndicatorSkeletonProps {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to add.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Determines whether or not the ProgressIndicator should be rendered vertically.
|
|
16
|
+
*/
|
|
17
|
+
vertical?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare function ProgressIndicatorSkeleton({ className, vertical, ...rest }: ProgressIndicatorSkeletonProps): JSX.Element;
|
|
20
|
+
declare namespace ProgressIndicatorSkeleton {
|
|
21
|
+
var propTypes: {
|
|
22
|
+
/**
|
|
23
|
+
* Specify an optional className to add.
|
|
24
|
+
*/
|
|
25
|
+
className: PropTypes.Requireable<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Determines whether or not the ProgressIndicator should be rendered vertically.
|
|
28
|
+
*/
|
|
29
|
+
vertical: PropTypes.Requireable<boolean>;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export default ProgressIndicatorSkeleton;
|
|
33
|
+
export { ProgressIndicatorSkeleton };
|