New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@tds/community-modal

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tds/community-modal - npm Package Compare versions

Comparing version

to
1.2.0

import React from 'react'
import Heading from '@tds/core-heading'
import Box from '@tds/core-box'
import { mount } from 'enzyme'
import Button from '@tds/core-button'
import { mount, shallow } from 'enzyme'

@@ -75,2 +76,22 @@ import Modal from '../Modal'

it('should not show cta when confirmCTAText is empty', () => {
const doShallow = (props = {}) =>
shallow(
<Modal
isOpen={true}
heading="A heading"
bodyText="Text"
confirmCTAText=""
focusElementAfterClose={{}}
onConfirm={() => {}}
onClose={() => {}}
{...props}
/>
)
const modalWithNoCta = doShallow()
expect(modalWithNoCta.find(Button)).toHaveLength(0)
})
// Check if confirm and cancel buttons appear when using Dialogue Modal

@@ -77,0 +98,0 @@ // Check if confirm and close buttons appear when using Content Modal

@@ -6,2 +6,13 @@ # Change Log

# [1.2.0](https://github.com/telus/tds-community/compare/@tds/community-modal@1.1.1...@tds/community-modal@1.2.0) (2020-09-30)
### Features
* **community-modal:** make confirmCTAText and onConfirm props optional ([7b45040](https://github.com/telus/tds-community/commit/7b45040ece3d70e8fbeff55c3517e2a020a419ee))
## [1.1.1](https://github.com/telus/tds-community/compare/@tds/community-modal@1.1.0...@tds/community-modal@1.1.1) (2020-09-09)

@@ -8,0 +19,0 @@

@@ -286,3 +286,3 @@ 'use strict';

tabIndex: "-1"
}, modalHeading), description), React__default.createElement(PaddingOverride, null, React__default.createElement(Box, {
}, modalHeading), description), confirmCTAText && React__default.createElement(PaddingOverride, null, React__default.createElement(Box, {
vertical: 5

@@ -318,3 +318,3 @@ }, React__default.createElement(CTAWrapper, {

*/
confirmCTAText: PropTypes.string.isRequired,
confirmCTAText: PropTypes.string,

@@ -346,3 +346,3 @@ /**

*/
onConfirm: PropTypes.func.isRequired,
onConfirm: PropTypes.func,

@@ -361,5 +361,7 @@ /**

Modal.defaultProps = {
cancelCTAText: ''
confirmCTAText: '',
cancelCTAText: '',
onConfirm: null
};
exports.default = Modal;

@@ -278,3 +278,3 @@ import React, { useRef, useEffect } from 'react';

tabIndex: "-1"
}, modalHeading), description), React.createElement(PaddingOverride, null, React.createElement(Box, {
}, modalHeading), description), confirmCTAText && React.createElement(PaddingOverride, null, React.createElement(Box, {
vertical: 5

@@ -310,3 +310,3 @@ }, React.createElement(CTAWrapper, {

*/
confirmCTAText: PropTypes.string.isRequired,
confirmCTAText: PropTypes.string,

@@ -338,3 +338,3 @@ /**

*/
onConfirm: PropTypes.func.isRequired,
onConfirm: PropTypes.func,

@@ -353,5 +353,7 @@ /**

Modal.defaultProps = {
cancelCTAText: ''
confirmCTAText: '',
cancelCTAText: '',
onConfirm: null
};
export default Modal;

@@ -121,12 +121,14 @@ import React, { useRef, useEffect } from 'react'

</Box>
<PaddingOverride>
<Box vertical={5}>
<CTAWrapper cancelCTAExists={cancelCTAText}>
<Button onClick={onConfirm}>{confirmCTAText}</Button>
{cancelCTAText && (
<OutlineButton onClick={handleClose}>{cancelCTAText}</OutlineButton>
)}
</CTAWrapper>
</Box>
</PaddingOverride>
{confirmCTAText && (
<PaddingOverride>
<Box vertical={5}>
<CTAWrapper cancelCTAExists={cancelCTAText}>
<Button onClick={onConfirm}>{confirmCTAText}</Button>
{cancelCTAText && (
<OutlineButton onClick={handleClose}>{cancelCTAText}</OutlineButton>
)}
</CTAWrapper>
</Box>
</PaddingOverride>
)}
</Box>

@@ -159,3 +161,3 @@ </ModalWrapper>

*/
confirmCTAText: PropTypes.string.isRequired,
confirmCTAText: PropTypes.string,
/**

@@ -183,3 +185,3 @@ *

*/
onConfirm: PropTypes.func.isRequired,
onConfirm: PropTypes.func,
/**

@@ -197,5 +199,7 @@ *

Modal.defaultProps = {
confirmCTAText: '',
cancelCTAText: '',
onConfirm: null,
}
export default Modal
{
"name": "@tds/community-modal",
"version": "1.1.1",
"version": "1.2.0",
"description": "",

@@ -40,3 +40,3 @@ "main": "index.cjs.js",

},
"gitHead": "69b5d1eecdee90810b63ad236aee6fa76d0f7ecb"
"gitHead": "92e088962a9a2e638d75e83587625d20cf8e1333"
}