Skip to content

Commit

Permalink
Add support for data-transaction-name attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamindehli committed Dec 4, 2023
1 parent 2d64dc7 commit da19003
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/stories/Accordion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Accordion = (props) => {

const renderPanel = () => {
return (
<button className={style.panel} onClick={handleToggleExpand} aria-expanded={expanded ? "true" : "false"}>
<button {...props.buttonProps} className={style.panel} onClick={handleToggleExpand} aria-expanded={expanded ? "true" : "false"}>
<span className={style.panelText}>{props.title}</span>
<span className={`${style.panelChevron} ${expanded ? style.expanded : ""}`}></span>
</button>
Expand Down Expand Up @@ -62,7 +62,8 @@ Accordion.propTypes = {
"lightLime"
]),
expanded: PropTypes.bool,
onToggleExpand: PropTypes.func
onToggleExpand: PropTypes.func,
buttonProps: PropTypes.object
};

Accordion.defaultProps = {
Expand Down
6 changes: 4 additions & 2 deletions src/stories/CheckBoxInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const CheckBoxInput = (props) => {
tabIndex: props.tabIndex || null,
"aria-controls": props["aria-controls"],
"aria-invalid": props.hasErrors ? "true" : null,
"aria-describedby": props["aria-describedby"]
"aria-describedby": props["aria-describedby"],
"data-transaction-name": props["data-transaction-name"]
};

return (
Expand Down Expand Up @@ -73,7 +74,8 @@ CheckBoxInput.propTypes = {
theme: PropTypes.object,
checkmarkCharacter: PropTypes.string,
"aria-controls": PropTypes.string,
"aria-describedby": PropTypes.string
"aria-describedby": PropTypes.string,
"data-transaction-name": PropTypes.string
};
CheckBoxInput.defaultProps = {
checked: false,
Expand Down
4 changes: 3 additions & 1 deletion src/stories/CheckBoxListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const CheckBoxListItem = (props) => {
hasErrors: props.hasErrors,
"aria-controls": props["aria-controls"],
"aria-describedby": props["aria-describedby"],
"data-transaction-name": props["data-transaction-name"],
id: props.id,
theme: props.theme,
checkmarkCharacter: props.checkmarkCharacter
Expand All @@ -56,7 +57,8 @@ CheckBoxListItem.propTypes = {
hasErrors: PropTypes.bool,
checkmarkCharacter: PropTypes.string,
"aria-controls": PropTypes.string,
"aria-describedby": PropTypes.string
"aria-describedby": PropTypes.string,
"data-transaction-name": PropTypes.string
};
CheckBoxListItem.defaultProps = {
checked: false,
Expand Down
4 changes: 4 additions & 0 deletions src/stories/DragAndDropFileInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const DragAndDropFileInput = (props) => {
? props["aria-describedby"]
: null,
"aria-invalid": props.hasErrors ? "true" : null,
"data-transaction-name": props["data-transaction-name-for-input"],
required: props.required
};

Expand Down Expand Up @@ -147,6 +148,7 @@ const DragAndDropFileInput = (props) => {
onClick={() => handleAddButtonOnClick()}
content={buttonContent}
hasErrors={props.hasErrors}
data-transaction-name={props["data-transaction-name-for-button"]}
/>
</React.Fragment>
) : null}
Expand Down Expand Up @@ -180,6 +182,8 @@ DragAndDropFileInput.propTypes = {
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object]))
]),
required: PropTypes.bool,
"data-transaction-name-for-button": PropTypes.string,
"data-transaction-name-for-input": PropTypes.string,
theme: PropTypes.object
};

Expand Down
4 changes: 3 additions & 1 deletion src/stories/InputField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const InputField = (props) => {
: null,
"aria-invalid": props.hasErrors ? "true" : null,
"aria-autocomplete": props["aria-autocomplete"] || null,
"data-transaction-name": props["data-transaction-name"] || null,
style: styleRules
};
};
Expand Down Expand Up @@ -140,7 +141,8 @@ InputField.propTypes = {
PropTypes.string,
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object]))
]),
theme: PropTypes.object
theme: PropTypes.object,
"data-transaction-name": PropTypes.string
};

InputField.defaultProps = {
Expand Down
6 changes: 4 additions & 2 deletions src/stories/RadioButtonInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ const RadioButtonInput = (props) => {
tabIndex: props.tabIndex || null,
"aria-controls": props["aria-controls"],
"aria-invalid": props.hasErrors ? "true" : null,
"aria-describedby": props["aria-describedby"]
"aria-describedby": props["aria-describedby"],
"data-transaction-name": props["data-transaction-name"]
};

return (
Expand Down Expand Up @@ -70,7 +71,8 @@ RadioButtonInput.propTypes = {
theme: PropTypes.object,
inputValue: PropTypes.string.isRequired,
"aria-controls": PropTypes.string,
"aria-describedby": PropTypes.string
"aria-describedby": PropTypes.string,
"data-transaction-name": PropTypes.string
};

RadioButtonInput.defaultProps = {
Expand Down
4 changes: 3 additions & 1 deletion src/stories/RadioButtonListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const RadioButtonListItem = (props) => {
hasErrors: props.hasErrors,
"aria-controls": props["aria-controls"],
"aria-describedby": props["aria-describedby"],
"data-transaction-name": props["data-transaction-name"],
id: props.id,
name: props.name,
theme: props.theme
Expand All @@ -56,7 +57,8 @@ RadioButtonListItem.propTypes = {
theme: PropTypes.object,
hasErrors: PropTypes.bool,
"aria-controls": PropTypes.string,
"aria-describedby": PropTypes.string
"aria-describedby": PropTypes.string,
"data-transaction-name": PropTypes.string
};

RadioButtonListItem.defaultProps = {
Expand Down
2 changes: 2 additions & 0 deletions src/stories/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ const Select = (props) => {
? props["aria-describedby"]
: null,
"aria-invalid": props.hasErrors ? "true" : null,
"data-transaction-name": props["data-transaction-name"],
style: styleRules
};
return (
Expand Down Expand Up @@ -273,6 +274,7 @@ Select.propTypes = {
PropTypes.string,
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object]))
]),
"data-transaction-name": PropTypes.string,
theme: PropTypes.object
};
Select.defaultProps = {
Expand Down

0 comments on commit da19003

Please sign in to comment.