carbon-react 117.6.1 → 117.7.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/link/link.component.js +7 -1
- package/esm/components/modal/__internal__/modal-manager.d.ts +1 -7
- package/esm/components/pager/__internal__/pager-navigation-link.component.js +2 -2
- package/esm/global.d.ts +19 -3
- package/esm/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +0 -11
- package/esm/style/utils/filter-out-styled-system-spacing-props.d.ts +2 -1
- package/esm/style/utils/filter-out-styled-system-spacing-props.js +3 -2
- package/esm/style/utils/filter-styled-system-padding-props.d.ts +1 -1
- package/esm/style/utils/filter-styled-system-padding-props.js +1 -3
- package/esm/style/utils/visually-hidden.js +1 -0
- package/lib/components/link/link.component.js +7 -1
- package/lib/components/modal/__internal__/modal-manager.d.ts +1 -7
- package/lib/components/pager/__internal__/pager-navigation-link.component.js +2 -2
- package/lib/global.d.ts +19 -3
- package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +0 -11
- package/lib/style/utils/filter-out-styled-system-spacing-props.d.ts +2 -1
- package/lib/style/utils/filter-out-styled-system-spacing-props.js +3 -3
- package/lib/style/utils/filter-styled-system-padding-props.d.ts +1 -1
- package/lib/style/utils/filter-styled-system-padding-props.js +1 -3
- package/lib/style/utils/visually-hidden.js +1 -0
- package/package.json +7 -5
|
@@ -81,6 +81,9 @@ const Link = /*#__PURE__*/React.forwardRef(({
|
|
|
81
81
|
"aria-label": ariaLabel,
|
|
82
82
|
...ariaProps
|
|
83
83
|
};
|
|
84
|
+
const buttonProps = {
|
|
85
|
+
type: "button"
|
|
86
|
+
};
|
|
84
87
|
|
|
85
88
|
const createLinkBasedOnType = () => {
|
|
86
89
|
let type = "a";
|
|
@@ -89,7 +92,10 @@ const Link = /*#__PURE__*/React.forwardRef(({
|
|
|
89
92
|
type = "button";
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
return /*#__PURE__*/React.createElement(type, { ...componentProps,
|
|
95
|
+
return /*#__PURE__*/React.createElement(type, type === "button" ? { ...componentProps,
|
|
96
|
+
...buttonProps,
|
|
97
|
+
placeholderTabIndex
|
|
98
|
+
} : { ...componentProps,
|
|
93
99
|
...(placeholderTabIndex && href === undefined && !onClick && {
|
|
94
100
|
tabIndex: -1
|
|
95
101
|
})
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
declare type SetTriggerRefocusFlag = (boolean: boolean) => void;
|
|
2
|
-
declare type ModalList = {
|
|
2
|
+
export declare type ModalList = {
|
|
3
3
|
modal: HTMLElement;
|
|
4
4
|
setTriggerRefocusFlag?: SetTriggerRefocusFlag;
|
|
5
5
|
}[];
|
|
6
|
-
declare global {
|
|
7
|
-
interface Window {
|
|
8
|
-
__CARBON_INTERNALS_MODAL_LIST?: ModalList;
|
|
9
|
-
__CARBON_INTERNALS_MODAL_SETTER_LIST?: ((topModal: HTMLElement | null) => void)[];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
6
|
declare class ModalManagerInstance {
|
|
13
7
|
private modalList;
|
|
14
8
|
constructor();
|
|
@@ -49,7 +49,7 @@ const PagerNavigationLink = ({
|
|
|
49
49
|
}
|
|
50
50
|
}, [disabled]);
|
|
51
51
|
|
|
52
|
-
const
|
|
52
|
+
const handleOnClick = ev => {
|
|
53
53
|
onClick === null || onClick === void 0 ? void 0 : onClick(ev);
|
|
54
54
|
onPagination === null || onPagination === void 0 ? void 0 : onPagination(navLinkConfig[type].destination, pageSize, type);
|
|
55
55
|
};
|
|
@@ -64,7 +64,7 @@ const PagerNavigationLink = ({
|
|
|
64
64
|
disabled: disabled(),
|
|
65
65
|
onClick: // Type assertion due to the fact that StyledPagerLink
|
|
66
66
|
// will always return a button element
|
|
67
|
-
|
|
67
|
+
handleOnClick,
|
|
68
68
|
ref: linkRef
|
|
69
69
|
}, text);
|
|
70
70
|
};
|
package/esm/global.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare
|
|
1
|
+
import { ModalList } from "components/modal/__internal__/modal-manager";
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
module "*.png";
|
|
5
|
+
module "*.svg";
|
|
6
|
+
interface Window {
|
|
7
|
+
__CARBON_INTERNALS_MODAL_LIST?: ModalList;
|
|
8
|
+
__CARBON_INTERNALS_MODAL_SETTER_LIST?: ((
|
|
9
|
+
topModal: HTMLElement | null
|
|
10
|
+
) => void)[];
|
|
11
|
+
__CARBON_INTERNALS_SCROLL_BLOCKERS?: {
|
|
12
|
+
components: {
|
|
13
|
+
[key: string]: boolean;
|
|
14
|
+
};
|
|
15
|
+
originalValues: string[];
|
|
16
|
+
restoreValues?: (() => void) | null;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
interface Window {
|
|
3
|
-
__CARBON_INTERNALS_SCROLL_BLOCKERS?: {
|
|
4
|
-
components: {
|
|
5
|
-
[key: string]: boolean;
|
|
6
|
-
};
|
|
7
|
-
originalValues: string[];
|
|
8
|
-
restoreValues?: (() => void) | null;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
1
|
declare class ScrollBlockManager {
|
|
13
2
|
components: {
|
|
14
3
|
[key: string]: boolean;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { SpaceProps } from "styled-system";
|
|
2
|
+
declare const filterOutStyledSystemSpacingProps: (props: Record<string, unknown> | SpaceProps) => Record<string, unknown>;
|
|
2
3
|
export default filterOutStyledSystemSpacingProps;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { marginPropertyNames } from "./filter-styled-system-margin-props";
|
|
2
|
+
import { paddingPropertyNames } from "./filter-styled-system-padding-props";
|
|
2
3
|
|
|
3
|
-
const filterOutStyledSystemSpacingProps = props => Object.fromEntries(Object.entries(props).filter(([key]) => !
|
|
4
|
+
const filterOutStyledSystemSpacingProps = props => Object.fromEntries(Object.entries(props).filter(([key]) => ![...marginPropertyNames, ...paddingPropertyNames].includes(key)));
|
|
4
5
|
|
|
5
6
|
export default filterOutStyledSystemSpacingProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PaddingProps } from "styled-system";
|
|
2
2
|
export declare const paddingPropertyNames: string[];
|
|
3
|
-
export default function filterStyledSystemPaddingProps(props: Record<string,
|
|
3
|
+
export default function filterStyledSystemPaddingProps(props: Record<string, unknown> | PaddingProps): PaddingProps;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import filterObjectProperties from "../../__internal__/filter-object-properties";
|
|
2
2
|
export const paddingPropertyNames = ["padding", "p", "paddingLeft", "pl", "paddingRight", "pr", "paddingTop", "pt", "paddingBottom", "pb", "paddingX", "px", "paddingY", "py"];
|
|
3
|
-
export default function filterStyledSystemPaddingProps(
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
-
props) {
|
|
3
|
+
export default function filterStyledSystemPaddingProps(props) {
|
|
6
4
|
return filterObjectProperties(props, paddingPropertyNames);
|
|
7
5
|
}
|
|
@@ -102,6 +102,9 @@ const Link = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
102
102
|
"aria-label": ariaLabel,
|
|
103
103
|
...ariaProps
|
|
104
104
|
};
|
|
105
|
+
const buttonProps = {
|
|
106
|
+
type: "button"
|
|
107
|
+
};
|
|
105
108
|
|
|
106
109
|
const createLinkBasedOnType = () => {
|
|
107
110
|
let type = "a";
|
|
@@ -110,7 +113,10 @@ const Link = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
110
113
|
type = "button";
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
return /*#__PURE__*/_react.default.createElement(type, { ...componentProps,
|
|
116
|
+
return /*#__PURE__*/_react.default.createElement(type, type === "button" ? { ...componentProps,
|
|
117
|
+
...buttonProps,
|
|
118
|
+
placeholderTabIndex
|
|
119
|
+
} : { ...componentProps,
|
|
114
120
|
...(placeholderTabIndex && href === undefined && !onClick && {
|
|
115
121
|
tabIndex: -1
|
|
116
122
|
})
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
declare type SetTriggerRefocusFlag = (boolean: boolean) => void;
|
|
2
|
-
declare type ModalList = {
|
|
2
|
+
export declare type ModalList = {
|
|
3
3
|
modal: HTMLElement;
|
|
4
4
|
setTriggerRefocusFlag?: SetTriggerRefocusFlag;
|
|
5
5
|
}[];
|
|
6
|
-
declare global {
|
|
7
|
-
interface Window {
|
|
8
|
-
__CARBON_INTERNALS_MODAL_LIST?: ModalList;
|
|
9
|
-
__CARBON_INTERNALS_MODAL_SETTER_LIST?: ((topModal: HTMLElement | null) => void)[];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
6
|
declare class ModalManagerInstance {
|
|
13
7
|
private modalList;
|
|
14
8
|
constructor();
|
|
@@ -65,7 +65,7 @@ const PagerNavigationLink = ({
|
|
|
65
65
|
}
|
|
66
66
|
}, [disabled]);
|
|
67
67
|
|
|
68
|
-
const
|
|
68
|
+
const handleOnClick = ev => {
|
|
69
69
|
onClick === null || onClick === void 0 ? void 0 : onClick(ev);
|
|
70
70
|
onPagination === null || onPagination === void 0 ? void 0 : onPagination(navLinkConfig[type].destination, pageSize, type);
|
|
71
71
|
};
|
|
@@ -80,7 +80,7 @@ const PagerNavigationLink = ({
|
|
|
80
80
|
disabled: disabled(),
|
|
81
81
|
onClick: // Type assertion due to the fact that StyledPagerLink
|
|
82
82
|
// will always return a button element
|
|
83
|
-
|
|
83
|
+
handleOnClick,
|
|
84
84
|
ref: linkRef
|
|
85
85
|
}, text);
|
|
86
86
|
};
|
package/lib/global.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare
|
|
1
|
+
import { ModalList } from "components/modal/__internal__/modal-manager";
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
module "*.png";
|
|
5
|
+
module "*.svg";
|
|
6
|
+
interface Window {
|
|
7
|
+
__CARBON_INTERNALS_MODAL_LIST?: ModalList;
|
|
8
|
+
__CARBON_INTERNALS_MODAL_SETTER_LIST?: ((
|
|
9
|
+
topModal: HTMLElement | null
|
|
10
|
+
) => void)[];
|
|
11
|
+
__CARBON_INTERNALS_SCROLL_BLOCKERS?: {
|
|
12
|
+
components: {
|
|
13
|
+
[key: string]: boolean;
|
|
14
|
+
};
|
|
15
|
+
originalValues: string[];
|
|
16
|
+
restoreValues?: (() => void) | null;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
interface Window {
|
|
3
|
-
__CARBON_INTERNALS_SCROLL_BLOCKERS?: {
|
|
4
|
-
components: {
|
|
5
|
-
[key: string]: boolean;
|
|
6
|
-
};
|
|
7
|
-
originalValues: string[];
|
|
8
|
-
restoreValues?: (() => void) | null;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
1
|
declare class ScrollBlockManager {
|
|
13
2
|
components: {
|
|
14
3
|
[key: string]: boolean;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { SpaceProps } from "styled-system";
|
|
2
|
+
declare const filterOutStyledSystemSpacingProps: (props: Record<string, unknown> | SpaceProps) => Record<string, unknown>;
|
|
2
3
|
export default filterOutStyledSystemSpacingProps;
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _filterStyledSystemMarginProps = require("./filter-styled-system-margin-props");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var _filterStyledSystemPaddingProps = require("./filter-styled-system-padding-props");
|
|
11
11
|
|
|
12
|
-
const filterOutStyledSystemSpacingProps = props => Object.fromEntries(Object.entries(props).filter(([key]) => !
|
|
12
|
+
const filterOutStyledSystemSpacingProps = props => Object.fromEntries(Object.entries(props).filter(([key]) => ![..._filterStyledSystemMarginProps.marginPropertyNames, ..._filterStyledSystemPaddingProps.paddingPropertyNames].includes(key)));
|
|
13
13
|
|
|
14
14
|
var _default = filterOutStyledSystemSpacingProps;
|
|
15
15
|
exports.default = _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PaddingProps } from "styled-system";
|
|
2
2
|
export declare const paddingPropertyNames: string[];
|
|
3
|
-
export default function filterStyledSystemPaddingProps(props: Record<string,
|
|
3
|
+
export default function filterStyledSystemPaddingProps(props: Record<string, unknown> | PaddingProps): PaddingProps;
|
|
@@ -13,8 +13,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
13
|
const paddingPropertyNames = ["padding", "p", "paddingLeft", "pl", "paddingRight", "pr", "paddingTop", "pt", "paddingBottom", "pb", "paddingX", "px", "paddingY", "py"];
|
|
14
14
|
exports.paddingPropertyNames = paddingPropertyNames;
|
|
15
15
|
|
|
16
|
-
function filterStyledSystemPaddingProps(
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
props) {
|
|
16
|
+
function filterStyledSystemPaddingProps(props) {
|
|
19
17
|
return (0, _filterObjectProperties.default)(props, paddingPropertyNames);
|
|
20
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "117.
|
|
3
|
+
"version": "117.7.1",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts/check_rfcs/index.js"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"start": "node ./scripts/check_node_version.js && NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 9001 -c .storybook",
|
|
12
|
+
"start": "node ./scripts/check_node_version.js && cross-env NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 9001 -c .storybook",
|
|
13
13
|
"start:debug-theme": "cross-env STORYBOOK_DEBUG_THEME=true npm run start",
|
|
14
14
|
"test": "jest --config=./jest.config.json",
|
|
15
15
|
"test-update": "jest --config=./jest.config.json --updateSnapshot",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"clean-lib": "rimraf ./lib && rimraf ./esm",
|
|
31
31
|
"commit": "git-cz",
|
|
32
32
|
"generate-metadata": "node ./scripts/generate_metadata/index.mjs",
|
|
33
|
-
"type-check": "tsc --noEmit",
|
|
34
|
-
"type-check:watch": "
|
|
33
|
+
"type-check": "tsc --noEmit && tsc -p ./cypress/tsconfig.json",
|
|
34
|
+
"type-check:watch": "concurrently --names 'src,cypress' -c 'cyan,yellow' 'tsc --noEmit --watch' 'tsc -p ./cypress/tsconfig.json --watch'",
|
|
35
35
|
"build:types": "tsc -p tsconfig-build.json --emitDeclarationOnly --outDir ./lib && tsc -p tsconfig-build.json --emitDeclarationOnly --outDir ./esm"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"@testing-library/react-hooks": "^8.0.1",
|
|
85
85
|
"@testing-library/user-event": "^14.4.3",
|
|
86
86
|
"@types/crypto-js": "^4.1.1",
|
|
87
|
+
"@types/cypress": "^1.1.3",
|
|
87
88
|
"@types/draft-js": "^0.11.7",
|
|
88
89
|
"@types/enzyme": "^3.10.3",
|
|
89
90
|
"@types/invariant": "^2.2.35",
|
|
@@ -108,6 +109,7 @@
|
|
|
108
109
|
"browserslist": "^4.21.5",
|
|
109
110
|
"chromatic": "^6.0.5",
|
|
110
111
|
"commitizen": "^4.2.5",
|
|
112
|
+
"concurrently": "^8.0.1",
|
|
111
113
|
"conventional-changelog-conventionalcommits": "^4.5.0",
|
|
112
114
|
"core-js": "^3.20.3",
|
|
113
115
|
"cross-env": "^5.2.0",
|
|
@@ -140,7 +142,7 @@
|
|
|
140
142
|
"fs-extra": "^10.0.0",
|
|
141
143
|
"husky": "^4.3.6",
|
|
142
144
|
"jest": "^27.5.1",
|
|
143
|
-
"jest-canvas-mock": "^2.
|
|
145
|
+
"jest-canvas-mock": "^2.5.0",
|
|
144
146
|
"jest-environment-jsdom": "^27.5.1",
|
|
145
147
|
"jest-fetch-mock": "^3.0.3",
|
|
146
148
|
"jest-styled-components": "^6.3.1",
|