Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Refactor popup logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Avijit Das committed May 17, 2024
1 parent 7bf9d3a commit 53e31d9
Show file tree
Hide file tree
Showing 44 changed files with 36 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ exports[`ApplicationNavigation correctly applies the theme context className 1`]
isArrowDisplayed={true}
isContentFocusDisabled={true}
isHeaderDisabled={true}
isMenu={false}
isOpen={false}
onRequestClose={[Function]}
popupContentRole="dialog"
Expand Down Expand Up @@ -314,7 +313,6 @@ exports[`ApplicationNavigation should render default element 1`] = `
isArrowDisplayed={true}
isContentFocusDisabled={true}
isHeaderDisabled={true}
isMenu={false}
isOpen={false}
onRequestClose={[Function]}
popupContentRole="dialog"
Expand Down Expand Up @@ -452,7 +450,6 @@ exports[`ApplicationNavigation should render with prop data at large breakpoint
isArrowDisplayed={true}
isContentFocusDisabled={true}
isHeaderDisabled={true}
isMenu={false}
isOpen={false}
onRequestClose={[Function]}
popupContentRole="dialog"
Expand Down Expand Up @@ -682,7 +679,6 @@ exports[`ApplicationNavigation should render with prop data at medium breakpoint
isArrowDisplayed={true}
isContentFocusDisabled={true}
isHeaderDisabled={true}
isMenu={false}
isOpen={false}
onRequestClose={[Function]}
popupContentRole="dialog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ exports[`Extensions should render default element 1`] = `
contentWidth="320"
isArrowDisplayed={true}
isContentFocusDisabled={true}
isHeaderDisabled={true}
isMenu={false}
isHeaderDisabled={false}
isOpen={false}
onRequestClose={[Function]}
popupContentRole="dialog"
Expand Down Expand Up @@ -63,8 +62,7 @@ exports[`Extensions should render prop data 1`] = `
contentWidth="320"
isArrowDisplayed={true}
isContentFocusDisabled={true}
isHeaderDisabled={true}
isMenu={false}
isHeaderDisabled={false}
isOpen={false}
onRequestClose={[Function]}
popupContentRole="dialog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,7 @@ exports[`CompactHeader should render with function callbacks 1`] = `
contentWidth="320"
isArrowDisplayed={true}
isContentFocusDisabled={true}
isHeaderDisabled={true}
isMenu={false}
isHeaderDisabled={false}
isOpen={false}
onRequestClose={[Function]}
popupContentRole="dialog"
Expand Down Expand Up @@ -1031,8 +1030,7 @@ exports[`CompactHeader should render with ids for navigation and extension items
contentWidth="320"
isArrowDisplayed={true}
isContentFocusDisabled={true}
isHeaderDisabled={true}
isMenu={false}
isHeaderDisabled={false}
isOpen={false}
onRequestClose={[Function]}
popupContentRole="dialog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,7 @@ exports[`Header should render with function callbacks 1`] = `
contentWidth="320"
isArrowDisplayed={true}
isContentFocusDisabled={true}
isHeaderDisabled={true}
isMenu={false}
isHeaderDisabled={false}
isOpen={false}
onRequestClose={[Function]}
popupContentRole="dialog"
Expand Down Expand Up @@ -1731,8 +1730,7 @@ exports[`Header should render with navigation and extension item ids 1`] = `
contentWidth="320"
isArrowDisplayed={true}
isContentFocusDisabled={true}
isHeaderDisabled={true}
isMenu={false}
isHeaderDisabled={false}
isOpen={false}
onRequestClose={[Function]}
popupContentRole="dialog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports[`correctly applies the theme context className 1`] = `
exports[`renders DateTimePicker with correct ARIA attributes 1`] = `
<DateTimePicker
ariaLabel="Enter Date/Time"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -65,6 +66,7 @@ exports[`renders DateTimePicker with correct ARIA attributes 1`] = `

exports[`should render a date time picker with a default date and time 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -110,6 +112,7 @@ exports[`should render a date time picker with a default date and time 1`] = `

exports[`should render a date time picker with disabled dates 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
excludeDates={
Expand Down Expand Up @@ -159,6 +162,7 @@ exports[`should render a date time picker with disabled dates 1`] = `

exports[`should render a date time picker with filtered dates 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
filterDate={[Function]}
Expand Down Expand Up @@ -204,6 +208,7 @@ exports[`should render a date time picker with filtered dates 1`] = `

exports[`should render a date time picker with included dates 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
includeDates={
Expand Down Expand Up @@ -253,6 +258,7 @@ exports[`should render a date time picker with included dates 1`] = `

exports[`should render a date time picker with min and max dates 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -297,6 +303,7 @@ exports[`should render a date time picker with min and max dates 1`] = `

exports[`should render a date time picker with onBlur 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -342,6 +349,7 @@ exports[`should render a date time picker with onBlur 1`] = `

exports[`should render a date time picker with onChange 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -387,6 +395,7 @@ exports[`should render a date time picker with onChange 1`] = `

exports[`should render a date time picker with onChangeRaw 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -432,6 +441,7 @@ exports[`should render a date time picker with onChangeRaw 1`] = `

exports[`should render a date time picker with the seconds field enabled 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -476,6 +486,7 @@ exports[`should render a date time picker with the seconds field enabled 1`] = `

exports[`should render a default date time picker 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -521,6 +532,7 @@ exports[`should render a default date time picker 1`] = `
exports[`should render a default date time picker with ariaLabel 1`] = `
<DateTimePicker
ariaLabel="Select date and time"
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -570,6 +582,7 @@ exports[`should render a default date time picker with custom date input attribu
"id": "terra-date-input",
}
}
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -614,6 +627,7 @@ exports[`should render a default date time picker with custom date input attribu

exports[`should render a default date time picker with custom time input attributes 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -663,6 +677,7 @@ exports[`should render a default date time picker with custom time input attribu

exports[`should render a disabled date time picker 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={true}
errorId=""
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -707,6 +722,7 @@ exports[`should render a disabled date time picker 1`] = `

exports[`should render a error message 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId="default-invalid-error"
initialTimeZone="America/Chicago"
Expand Down Expand Up @@ -751,6 +767,7 @@ exports[`should render a error message 1`] = `

exports[`should render with a default timeVariant if variant is not specified 1`] = `
<DateTimePicker
disableButtonFocusOnClose={false}
disabled={false}
errorId=""
initialTimeZone="America/Chicago"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ function PopupAttachmentBehavior() {
isOpen={open}
targetRef={getButtonNode}
onRequestClose={handleRequestClose}
isHeaderDisabled={false}
>
<Placeholder title="Popup Content" />
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ function PopupAttachment() {
isOpen={open}
targetRef={getButtonNode}
onRequestClose={handleRequestClose}
isHeaderDisabled={false}
>
<Placeholder title="Popup Content" />
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function PopupBounded() {
isOpen={open}
onRequestClose={handleRequestClose}
targetRef={getButtonNode}
isHeaderDisabled={false}
isContentFocusDisabled
>
<Placeholder title="Popup Content" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function PopupDimensions() {
<div>
<Popup
{...contentDimensions}
isHeaderDisabled={false}
classNameContent="test-content"
isOpen={open}
onRequestClose={handleRequestClose}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function ModalContainer(props) {
<React.Fragment>
<div className={cx('content-container')}>
<Popup
isHeaderDisabled={false}
isArrowDisplayed
isOpen={open}
onRequestClose={handlePopupRequestClose}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ function PopupStandard() {
isOpen={open}
targetRef={getButtonNode}
onRequestClose={handleRequestClose}
isHeaderDisabled={false}
isContentFocusDisabled
>
<label htmlFor="html">Medications for patient John Doe</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ function PopupArrow() {
<Button text="Medication Links" onClick={handleButtonClick} refCallback={setButtonNode} />
<Popup
isOpen={open}
isHeaderDisabled={false}
onRequestClose={handleRequestClose}
targetRef={getButtonNode}
isArrowDisplayed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const PopupWithInteractiveContent = () => {
targetRef={getButtonNode}
onRequestClose={handleRequestClose}
contentHeight="auto"
isHeaderDisabled={false}
>
{/* eslint-disable-next-line react/forbid-dom-props */}
<div style={{ padding: '1em' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const PillTemplate = ({
id={pill.id}
key={pill.id}
metaData={{ index }}
isPopupHeaderDisabled={false}
showPopupHeader
/>
))}
</FilterPills>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class AlignmentPopup extends React.Component {
isOpen={this.state.open}
onRequestClose={this.handleRequestClose}
targetRef={this.getButtonNode}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This popup arrow was horizontally attached.</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class ArrowPopup extends React.Component {
isOpen={this.state.open}
onRequestClose={this.handleRequestClose}
targetRef={this.getButtonNode}
isHeaderDisabled={false}
>
<p>this is popup content</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class OffsetPopup extends React.Component {
isOpen={this.state.open}
onRequestClose={this.handleRequestClose}
targetRef={this.getButtonNode}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This popup was adjusted because the target was smaller than the arrow position allowed.</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class OffsetPopup extends React.Component {
isOpen={this.state.open}
onRequestClose={this.handleRequestClose}
targetRef={this.getButtonNode}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This popup was adjusted because the target was smaller than the arrow position allowed.</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class AlignmentPopup extends React.Component {
isOpen={this.state.open}
onRequestClose={this.handleRequestClose}
targetRef={this.getButtonNode}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This popup arrow has vertical attachment.</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class AlignmentPopup extends React.Component {
isOpen={this.state.open}
onRequestClose={this.handleRequestClose}
targetRef={this.getButtonNode}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This popup arrow has verital-left attachment, but was adjusted to be on the screen.</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class AlignmentPopup extends React.Component {
isOpen={this.state.open}
onRequestClose={this.handleRequestClose}
targetRef={this.getButtonNode}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This popup arrow has vertical-right attachment, but was adjusted to be on the screen.</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class PopupExample extends React.Component {
isOpen={this.state.open}
targetRef={this.getButtonNode}
onRequestClose={this.handleRequestClose}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This is popup content with a automatic height of 400px.</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class PopupExample extends React.Component {
isOpen={this.state.open}
targetRef={this.getButtonNode}
onRequestClose={this.handleRequestClose}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This is popup content with a automatic height of 400px.</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class PopupExample extends React.Component {
isOpen={this.state.open}
targetRef={this.getButtonNode}
onRequestClose={this.handleRequestClose}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This is popup content with a automatic width of 400px, but is bounded by the parent width of 200px.</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class PopupExample extends React.Component {
isOpen={this.state.open}
targetRef={this.getButtonNode}
onRequestClose={this.handleRequestClose}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This is popup content with a automatic width of 400px.</p>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class BoundedPopup extends React.Component {
isOpen={this.state.open}
onRequestClose={this.handleRequestClose}
targetRef={this.getButtonNode}
isHeaderDisabled={false}
>
<p className={cx('popup-text')}>This popup is bounded by height.</p>
</Popup>
Expand Down
Loading

0 comments on commit 53e31d9

Please sign in to comment.