carbon-react 116.1.3 → 116.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components/accordion/accordion.component.d.ts +1 -1
- package/esm/components/accordion/accordion.component.js +2 -2
- package/esm/components/accordion/accordion.style.d.ts +1 -1
- package/esm/components/accordion/accordion.style.js +1 -1
- package/esm/components/action-popover/action-popover.component.js +5 -1
- package/esm/components/modal/__internal__/modal-manager.d.ts +1 -1
- package/esm/components/modal/__internal__/modal-manager.js +2 -2
- package/esm/components/modal/modal.component.js +6 -1
- package/esm/components/progress-tracker/index.d.ts +2 -1
- package/esm/components/progress-tracker/progress-tracker.component.d.ts +46 -0
- package/esm/components/progress-tracker/progress-tracker.component.js +175 -59
- package/esm/components/progress-tracker/progress-tracker.style.d.ts +8 -0
- package/esm/components/progress-tracker/progress-tracker.style.js +47 -60
- package/esm/components/select/select-list/select-list.component.js +6 -1
- package/esm/components/toast/toast.component.js +5 -1
- package/esm/hooks/__internal__/useMenuKeyboardNavigation/useMenuKeyboardNavigation.js +5 -1
- package/esm/hooks/__internal__/useModalManager/useModalManager.d.ts +8 -1
- package/esm/hooks/__internal__/useModalManager/useModalManager.js +9 -3
- package/lib/components/accordion/accordion.component.d.ts +1 -1
- package/lib/components/accordion/accordion.component.js +2 -2
- package/lib/components/accordion/accordion.style.d.ts +1 -1
- package/lib/components/accordion/accordion.style.js +1 -1
- package/lib/components/action-popover/action-popover.component.js +5 -1
- package/lib/components/modal/__internal__/modal-manager.d.ts +1 -1
- package/lib/components/modal/__internal__/modal-manager.js +2 -2
- package/lib/components/modal/modal.component.js +6 -1
- package/lib/components/progress-tracker/index.d.ts +2 -1
- package/lib/components/progress-tracker/progress-tracker.component.d.ts +46 -0
- package/lib/components/progress-tracker/progress-tracker.component.js +175 -62
- package/lib/components/progress-tracker/progress-tracker.style.d.ts +8 -0
- package/lib/components/progress-tracker/progress-tracker.style.js +46 -62
- package/lib/components/select/select-list/select-list.component.js +6 -1
- package/lib/components/toast/toast.component.js +5 -1
- package/lib/hooks/__internal__/useMenuKeyboardNavigation/useMenuKeyboardNavigation.js +5 -1
- package/lib/hooks/__internal__/useModalManager/useModalManager.d.ts +8 -1
- package/lib/hooks/__internal__/useModalManager/useModalManager.js +9 -3
- package/package.json +2 -2
- package/scripts/check_rfcs/check_rfcs.js +27 -12
- package/esm/components/progress-tracker/progress-tracker.d.ts +0 -40
- package/lib/components/progress-tracker/progress-tracker.d.ts +0 -40
|
@@ -67,7 +67,11 @@ const Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
67
67
|
onDismiss(ev);
|
|
68
68
|
}
|
|
69
69
|
}, [onDismiss]);
|
|
70
|
-
(0, _useModalManager.default)(
|
|
70
|
+
(0, _useModalManager.default)({
|
|
71
|
+
open,
|
|
72
|
+
closeModal: dismissToast,
|
|
73
|
+
modalRef: refToPass
|
|
74
|
+
});
|
|
71
75
|
(0, _react.useEffect)(() => {
|
|
72
76
|
/* istanbul ignore next */
|
|
73
77
|
if (timer.current) clearTimeout(timer.current);
|
|
@@ -31,7 +31,11 @@ var _default = (mainControlRef, childrenRefs, hide, isOpen) => {
|
|
|
31
31
|
}, [refocusMainControl]); // useModalmanager is used here to handle the escape key
|
|
32
32
|
// and to ensure that closing the menu does not close the modal
|
|
33
33
|
|
|
34
|
-
(0, _useModalManager.default)(
|
|
34
|
+
(0, _useModalManager.default)({
|
|
35
|
+
open: isOpen,
|
|
36
|
+
closeModal: handleEscapeKey,
|
|
37
|
+
modalRef: mainControlRef
|
|
38
|
+
});
|
|
35
39
|
const handleKeyDown = (0, _react.useCallback)(ev => {
|
|
36
40
|
if (!(_events.default.isEnterKey(ev) || _events.default.isSpaceKey(ev))) {
|
|
37
41
|
ev.preventDefault();
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
declare
|
|
2
|
+
declare type UseModalManagerArgs = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
closeModal: (e: KeyboardEvent) => void;
|
|
5
|
+
modalRef: React.RefObject<HTMLElement>;
|
|
6
|
+
setTriggerRefocusFlag?: (flag: boolean) => void;
|
|
7
|
+
triggerRefocusOnClose?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const useModalManager: ({ open, closeModal, modalRef, setTriggerRefocusFlag, triggerRefocusOnClose, }: UseModalManagerArgs) => void;
|
|
3
10
|
export default useModalManager;
|
|
@@ -11,7 +11,13 @@ var _modalManager = _interopRequireDefault(require("../../../components/modal/__
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
const useModalManager = (
|
|
14
|
+
const useModalManager = ({
|
|
15
|
+
open,
|
|
16
|
+
closeModal,
|
|
17
|
+
modalRef,
|
|
18
|
+
setTriggerRefocusFlag,
|
|
19
|
+
triggerRefocusOnClose = true
|
|
20
|
+
}) => {
|
|
15
21
|
const listenerAdded = (0, _react.useRef)(false);
|
|
16
22
|
const modalRegistered = (0, _react.useRef)(false);
|
|
17
23
|
const handleClose = (0, _react.useCallback)(ev => {
|
|
@@ -56,11 +62,11 @@ const useModalManager = (open, closeModal, modalRef, setTriggerRefocusFlag) => {
|
|
|
56
62
|
}, [setTriggerRefocusFlag]);
|
|
57
63
|
const unregisterModal = (0, _react.useCallback)(ref => {
|
|
58
64
|
if (modalRegistered.current) {
|
|
59
|
-
_modalManager.default.removeModal(ref);
|
|
65
|
+
_modalManager.default.removeModal(ref, triggerRefocusOnClose);
|
|
60
66
|
|
|
61
67
|
modalRegistered.current = false;
|
|
62
68
|
}
|
|
63
|
-
}, []);
|
|
69
|
+
}, [triggerRefocusOnClose]);
|
|
64
70
|
(0, _react.useEffect)(() => {
|
|
65
71
|
const ref = modalRef.current;
|
|
66
72
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "116.1
|
|
3
|
+
"version": "116.2.1",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"copy-files": "node ./scripts/copy-files.js",
|
|
21
21
|
"precompile": "npm run type-check && npm run clean-lib && npm run build && npm run build:types && npm run copy-files",
|
|
22
22
|
"prepublishOnly": "npm run precompile",
|
|
23
|
-
"postinstall": "node ./scripts/check_rfcs/
|
|
23
|
+
"postinstall": "node ./scripts/check_rfcs/index.js",
|
|
24
24
|
"watch": "npm run clean-lib && npm run copy-files -- --watch & npm run babel -- --watch",
|
|
25
25
|
"build-storybook": "cross-env STORYBOOK_BUILD=true NODE_OPTIONS=--openssl-legacy-provider build-storybook -c .storybook",
|
|
26
26
|
"start-storybook": "cross-env STORYBOOK_BUILD=true NODE_OPTIONS=--openssl-legacy-provider start-storybook -c .storybook",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
2
|
const { Octokit } = require("@octokit/rest");
|
|
4
3
|
const dotenv = require("dotenv");
|
|
5
4
|
const chalk = require("chalk");
|
|
@@ -32,26 +31,42 @@ const getOpenRfcs = async () => {
|
|
|
32
31
|
});
|
|
33
32
|
};
|
|
34
33
|
|
|
35
|
-
const
|
|
34
|
+
const getTitle = (rfc) => rfc.title.split(": ")[1];
|
|
36
35
|
|
|
37
36
|
const checkRfcs = async () => {
|
|
38
37
|
if (ci.isCI && process.env.NODE_ENV !== "test") {
|
|
39
38
|
return;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
try {
|
|
42
|
+
const openRfcs = await getOpenRfcs();
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
console.log("\ncarbon-react currently has open RFCs:");
|
|
44
|
+
if (!openRfcs.length) return;
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
const header = chalk.bold.inverse.white(
|
|
47
|
+
" ".repeat(20),
|
|
48
|
+
"Open RFCs for carbon-react",
|
|
49
|
+
" ".repeat(20)
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const rfcText = openRfcs
|
|
53
|
+
.map((item) => {
|
|
54
|
+
const title = getTitle(item);
|
|
55
|
+
return `- ${chalk.bold(title)}: ${chalk.cyan.italic(item.html_url)}`;
|
|
56
|
+
})
|
|
57
|
+
.join("\n\n");
|
|
58
|
+
|
|
59
|
+
console.log(`${header}\n\n${rfcText}\n`);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
const rfcLink =
|
|
62
|
+
"https://github.com/Sage/carbon/pulls?q=is%3Aopen+is%3Apr+label%3ARFC";
|
|
63
|
+
const message = `Failed to retrieve open RFCs for carbon-react. Go to ${chalk.cyan.italic(
|
|
64
|
+
rfcLink
|
|
65
|
+
)} to view current RFCs.`;
|
|
66
|
+
console.log(
|
|
67
|
+
`${chalk.yellow.inverse(" WARN ")}\n${chalk.yellow(message)}\n`
|
|
68
|
+
);
|
|
52
69
|
}
|
|
53
70
|
};
|
|
54
71
|
|
|
55
|
-
checkRfcs();
|
|
56
|
-
|
|
57
72
|
module.exports = checkRfcs;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { MarginProps } from "styled-system";
|
|
2
|
-
|
|
3
|
-
export interface ProgressTrackerProps extends MarginProps {
|
|
4
|
-
/** Specifies an aria-label to the component */
|
|
5
|
-
"aria-label"?: string;
|
|
6
|
-
/** Specifies the aria-describedby for the component */
|
|
7
|
-
"aria-describedby"?: string;
|
|
8
|
-
/** The value of progress to be read out to the user. */
|
|
9
|
-
"aria-valuenow"?: number;
|
|
10
|
-
/** The minimum value of the progress tracker */
|
|
11
|
-
"aria-valuemin"?: number;
|
|
12
|
-
/** The maximum value of the progress tracker */
|
|
13
|
-
"aria-valueMax"?: number;
|
|
14
|
-
/** Prop to define the human readable text alternative of aria-valuenow
|
|
15
|
-
* if aria-valuenow is not a number */
|
|
16
|
-
"aria-valuetext"?: string;
|
|
17
|
-
/** Size of the progressBar. */
|
|
18
|
-
size?: "small" | "medium" | "large";
|
|
19
|
-
/** Length of the progress bar, any valid css string. */
|
|
20
|
-
length?: string;
|
|
21
|
-
/** Current progress (percentage). */
|
|
22
|
-
progress?: number;
|
|
23
|
-
/** Flag to control whether the default value labels (as percentages) should be rendered. */
|
|
24
|
-
showDefaultLabels?: boolean;
|
|
25
|
-
/** Value to display as current progress. */
|
|
26
|
-
currentProgressLabel?: string;
|
|
27
|
-
/** Value to display as the maximum progress limit. */
|
|
28
|
-
maxProgressLabel?: string;
|
|
29
|
-
/**
|
|
30
|
-
* The position the value label are rendered in.
|
|
31
|
-
* Top/bottom apply to horizontal and left/right to vertical orientation.
|
|
32
|
-
*/
|
|
33
|
-
labelsPosition?: "top" | "bottom";
|
|
34
|
-
/** Value of the preposition defined between Value1 and Value2 on the label. */
|
|
35
|
-
customValuePreposition?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
declare function ProgressTracker(props: ProgressTrackerProps): JSX.Element;
|
|
39
|
-
|
|
40
|
-
export default ProgressTracker;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { MarginProps } from "styled-system";
|
|
2
|
-
|
|
3
|
-
export interface ProgressTrackerProps extends MarginProps {
|
|
4
|
-
/** Specifies an aria-label to the component */
|
|
5
|
-
"aria-label"?: string;
|
|
6
|
-
/** Specifies the aria-describedby for the component */
|
|
7
|
-
"aria-describedby"?: string;
|
|
8
|
-
/** The value of progress to be read out to the user. */
|
|
9
|
-
"aria-valuenow"?: number;
|
|
10
|
-
/** The minimum value of the progress tracker */
|
|
11
|
-
"aria-valuemin"?: number;
|
|
12
|
-
/** The maximum value of the progress tracker */
|
|
13
|
-
"aria-valueMax"?: number;
|
|
14
|
-
/** Prop to define the human readable text alternative of aria-valuenow
|
|
15
|
-
* if aria-valuenow is not a number */
|
|
16
|
-
"aria-valuetext"?: string;
|
|
17
|
-
/** Size of the progressBar. */
|
|
18
|
-
size?: "small" | "medium" | "large";
|
|
19
|
-
/** Length of the progress bar, any valid css string. */
|
|
20
|
-
length?: string;
|
|
21
|
-
/** Current progress (percentage). */
|
|
22
|
-
progress?: number;
|
|
23
|
-
/** Flag to control whether the default value labels (as percentages) should be rendered. */
|
|
24
|
-
showDefaultLabels?: boolean;
|
|
25
|
-
/** Value to display as current progress. */
|
|
26
|
-
currentProgressLabel?: string;
|
|
27
|
-
/** Value to display as the maximum progress limit. */
|
|
28
|
-
maxProgressLabel?: string;
|
|
29
|
-
/**
|
|
30
|
-
* The position the value label are rendered in.
|
|
31
|
-
* Top/bottom apply to horizontal and left/right to vertical orientation.
|
|
32
|
-
*/
|
|
33
|
-
labelsPosition?: "top" | "bottom";
|
|
34
|
-
/** Value of the preposition defined between Value1 and Value2 on the label. */
|
|
35
|
-
customValuePreposition?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
declare function ProgressTracker(props: ProgressTrackerProps): JSX.Element;
|
|
39
|
-
|
|
40
|
-
export default ProgressTracker;
|