Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v10.3.3 #1918

Merged
merged 2 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change history for stripes-components

## [10.3.3](https://github.com/folio-org/stripes-components/tree/v10.3.3) (2022-12-04)
[Full Changelog](https://github.com/folio-org/stripes-components/compare/v10.3.1...v10.3.2)

* After click submit button disable the confirmation button in Confirmation modal component. Refs STCOM-1058.

## [10.3.2](https://github.com/folio-org/stripes-components/tree/v10.3.2) (2022-11-23)
[Full Changelog](https://github.com/folio-org/stripes-components/compare/v10.3.0...v10.3.1)

Expand Down
4 changes: 4 additions & 0 deletions lib/ConfirmationModal/ConfirmationModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const propTypes = {
confirmLabel: PropTypes.node,
heading: PropTypes.node.isRequired,
id: PropTypes.string,
isConfirmButtonDisabled: PropTypes.bool,
message: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
Expand All @@ -34,6 +35,7 @@ const defaultProps = {
bodyTag: 'p',
buttonStyle: 'primary',
cancelButtonStyle: 'default',
isConfirmButtonDisabled: false,
};

const ConfirmationModal = (props) => {
Expand All @@ -46,6 +48,7 @@ const ConfirmationModal = (props) => {
bodyTag: Element,
onCancel,
ariaLabel, // deprecated
isConfirmButtonDisabled,
} = props;

const footer = (
Expand All @@ -56,6 +59,7 @@ const ConfirmationModal = (props) => {
id={`clickable-${testId}-confirm`}
onClick={props.onConfirm}
ref={footerPrimary}
disabled={isConfirmButtonDisabled}
>
{confirmLabel}
</Button>
Expand Down
1 change: 1 addition & 0 deletions lib/ConfirmationModal/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ confirmLabel | string | String to render on the Submit action. | "Submit" |
onConfirm | func | Callback fired when the Submit button is clicked | | &#10004;
onCancel | func | Callback fired when the Cancel button is clicked | | &#10004;
bodyTag | string | String to set the HTML tag used to wrap the modal message | "p" |
isConfirmButtonDisabled | bool | Boolean reflecting confirm button's enabled/disabled status | false |
22 changes: 22 additions & 0 deletions lib/ConfirmationModal/tests/ConfirmationModal-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const html = Bigtest.HTML;
const ConfirmButton = Button.extend('confirm button')
.filters({
focused: el => document.activeElement === el,
disabled: el => el.disabled,
});

describe('ConfirmationModal', () => {
Expand Down Expand Up @@ -49,6 +50,27 @@ describe('ConfirmationModal', () => {

it('focus is on the primary button', () => ConfirmButton(confirmLabel).is({ focused: true }));

describe('when confirm button is disabled', () => {
beforeEach(async () => {
await mountWithContext(
<ConfirmationModal
open
id="confirmation-modal-test"
heading={heading}
message={message}
bodyTag="div"
isConfirmButtonDisabled
onConfirm={() => { confirmed = true; }}
onCancel={() => { cancelled = true; }}
cancelLabel={cancelLabel}
confirmLabel={confirmLabel}
/>
);
});

it('The confirm button should have disabled attribute', () => ConfirmButton(confirmLabel).has({ disabled: true }));
});

describe('When clicking the confirm button', () => {
beforeEach(async () => {
await confirmationModal.confirm();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/stripes-components",
"version": "10.3.2",
"version": "10.3.3",
"description": "Component library for building Stripes applications.",
"license": "Apache-2.0",
"repository": "folio-org/stripes-components",
Expand Down