Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

support forwardref as linkComponent #907

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
4,108 changes: 3,155 additions & 953 deletions package-lock.json

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions packages/animate/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/breadcrumbs/src/js/react.js
Expand Up @@ -50,7 +50,7 @@ AUbreadcrumbs.propTypes = {
text: PropTypes.string.isRequired,
})
).isRequired,
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ])
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.elementType ])
};

AUbreadcrumbs.defaultProps = {
Expand Down
1 change: 1 addition & 0 deletions packages/buttons/package.json
Expand Up @@ -74,6 +74,7 @@
"onchange": "^5.2.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-is": "^16.13.1",
"react-router-dom": "^4.3.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
Expand Down
5 changes: 3 additions & 2 deletions packages/buttons/src/js/react.js
Expand Up @@ -9,6 +9,7 @@

import React from 'react';
import PropTypes from 'prop-types';
import { isValidElementType } from "react-is";


// The following line will be replaced automatically with generic imports for the ES5 pipeline.
Expand Down Expand Up @@ -52,7 +53,7 @@ const AUbutton = ({ linkComponent, link, children, as, dark, type, block, classN
attributeOptions.href = link;
}
// If we are using a link component
else if( typeof LinkComponent === 'function' ) {
else if( isValidElementType(LinkComponent) ) {
attributeOptions.to = link;
}

Expand Down Expand Up @@ -86,7 +87,7 @@ AUbutton.propTypes = {
type: PropTypes.string,
block: PropTypes.bool,
className: PropTypes.string,
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]),
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.elementType ]),
};

AUbutton.defaultProps = {
Expand Down
1 change: 1 addition & 0 deletions packages/cta-link/package.json
Expand Up @@ -76,6 +76,7 @@
"onchange": "^5.2.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-is": "^16.13.1",
"react-router-dom": "^4.3.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
Expand Down
5 changes: 3 additions & 2 deletions packages/cta-link/src/js/react.js
Expand Up @@ -9,6 +9,7 @@

import React from 'react';
import PropTypes from 'prop-types';
import { isValidElementType } from "react-is";


// The following line will be replaced automatically with generic imports for the ES5 pipeline.
Expand Down Expand Up @@ -37,7 +38,7 @@ const AUctaLink = ({ linkComponent, dark, link, text, className = '', ...attribu
attributeOptions.href = link;
}
// If we are using a link component
else if( typeof LinkComponent === 'function' ) {
else if( isValidElementType(LinkComponent) ) {
attributeOptions.to = link;
}

Expand All @@ -57,7 +58,7 @@ AUctaLink.propTypes = {
link: PropTypes.string,
text: PropTypes.string.isRequired,
className: PropTypes.string,
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ])
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.elementType ])
};

AUctaLink.defaultProps = {
Expand Down
1 change: 1 addition & 0 deletions packages/direction-links/package.json
Expand Up @@ -79,6 +79,7 @@
"onchange": "^5.2.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-is": "^16.13.1",
"react-router-dom": "^4.3.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
Expand Down
5 changes: 3 additions & 2 deletions packages/direction-links/src/js/react.js
Expand Up @@ -9,6 +9,7 @@

import React from 'react';
import PropTypes from 'prop-types';
import { isValidElementType } from "react-is";


// The following line will be replaced automatically with generic imports for the ES5 pipeline.
Expand Down Expand Up @@ -51,7 +52,7 @@ const AUdirectionLink = ({ linkComponent, dark, link, text, direction, className
attributeOptions.href = link;
}
// If we are using a link component
else if( typeof LinkComponent === 'function' ) {
else if( isValidElementType(LinkComponent) ) {
attributeOptions.to = link;
}
return (
Expand Down Expand Up @@ -80,7 +81,7 @@ AUdirectionLink.propTypes = {
text: PropTypes.string.isRequired,
direction: PropTypes.oneOf([ 'up', 'right', 'down', 'left' ]).isRequired,
className: PropTypes.string,
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ])
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.elementType ])
};

AUdirectionLink.defaultProps = {
Expand Down
1 change: 1 addition & 0 deletions packages/header/package.json
Expand Up @@ -76,6 +76,7 @@
"onchange": "^5.2.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-is": "^16.13.1",
"react-router-dom": "^4.3.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
Expand Down
5 changes: 3 additions & 2 deletions packages/header/src/js/react.js
Expand Up @@ -9,6 +9,7 @@

import React from 'react';
import PropTypes from 'prop-types';
import { isValidElementType } from "react-is";


// The following line will be replaced automatically with generic imports for the ES5 pipeline.
Expand Down Expand Up @@ -53,7 +54,7 @@ export const AUheaderBrand = ({
attributeOptions.href = link;
}
// If we are using a link component
else if( typeof LinkComponent === 'function' ) {
else if( isValidElementType(LinkComponent) ) {
attributeOptions.to = link;
}
}
Expand Down Expand Up @@ -97,7 +98,7 @@ AUheaderBrand.propTypes = {
brandImageAlt: PropTypes.string,
children: PropTypes.node,
className: PropTypes.string,
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]),
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.elementType ]),
}

AUheaderBrand.defaultProps = {
Expand Down
1 change: 1 addition & 0 deletions packages/keyword-list/package.json
Expand Up @@ -80,6 +80,7 @@
"onchange": "^5.2.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-is": "^16.13.1",
"react-router-dom": "^4.3.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
Expand Down
7 changes: 4 additions & 3 deletions packages/keyword-list/src/js/react.js
Expand Up @@ -9,6 +9,7 @@

import React from 'react';
import PropTypes from 'prop-types';
import { isValidElementType } from "react-is";


// The following line will be replaced automatically with generic imports for the ES5 pipeline.
Expand Down Expand Up @@ -44,7 +45,7 @@ export const AUkeywordListItem = ({ linkComponent, repeatedName, link, name, li
attributeOptions.href = link;
}
// If we are using a link component
else if( typeof LinkComponent === 'function' ) {
else if( isValidElementType(LinkComponent) ) {
attributeOptions.to = link;
}
}
Expand All @@ -65,7 +66,7 @@ AUkeywordListItem.propTypes = {
link: PropTypes.string,
name: PropTypes.string.isRequired,
li: PropTypes.object,
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]),
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.elementType ]),
};


Expand Down Expand Up @@ -106,7 +107,7 @@ AUkeywordList.propTypes = {
})
).isRequired,
className: PropTypes.string,
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]),
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.elementType ]),
};


Expand Down
1 change: 1 addition & 0 deletions packages/link-list/package.json
Expand Up @@ -79,6 +79,7 @@
"onchange": "^5.2.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-is": "^16.13.1",
"react-router-dom": "^4.3.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
Expand Down
7 changes: 4 additions & 3 deletions packages/link-list/src/js/react.js
Expand Up @@ -9,6 +9,7 @@

import React from 'react';
import PropTypes from 'prop-types';
import { isValidElementType } from "react-is";


// The following line will be replaced automatically with generic imports for the ES5 pipeline.
Expand Down Expand Up @@ -44,7 +45,7 @@ export const AUlinkListItem = ({ text, link, linkComponent, li = {}, children, o
attributeOptions.href = link;
}
// If we are using a link component
else if( typeof LinkComponent === 'function' ) {
else if( isValidElementType(LinkComponent) ) {
attributeOptions.to = link;
}

Expand All @@ -65,7 +66,7 @@ AUlinkListItem.propTypes = {
link: PropTypes.string,
li: PropTypes.object,
onClick: PropTypes.func,
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ])
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.elementType ])
};

AUlinkListItem.defaultProps = {
Expand Down Expand Up @@ -101,7 +102,7 @@ AUlinkList.propTypes = {
li: PropTypes.object,
})
).isRequired,
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ])
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.elementType ])
};

AUlinkList.defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion packages/main-nav/src/js/react.js
Expand Up @@ -68,7 +68,7 @@ AUmainNavMenu.propTypes = {
children: PropTypes.array,
})
).isRequired,
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]),
linkComponent: PropTypes.oneOfType([ PropTypes.string, PropTypes.elementType ]),
};

AUmainNavMenu.defaultProps = {
Expand Down
1 change: 1 addition & 0 deletions packages/progress-indicator/package.json
Expand Up @@ -74,6 +74,7 @@
"onchange": "^5.2.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-is": "^16.13.1",
"react-router-dom": "^4.3.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
Expand Down