Skip to content

Commit

Permalink
expose close on select date props to use outside carbon iot
Browse files Browse the repository at this point in the history
  • Loading branch information
anishkumar-bhut committed Feb 6, 2025
1 parent f778f01 commit fc656b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const DateTimePicker = ({
renderInPortal,
useAutoPositioning,
style,
closeOnSelect,
...others
}) => {
return useNewTimeSpinner ? (
Expand Down Expand Up @@ -64,6 +65,7 @@ const DateTimePicker = ({
renderInPortal={renderInPortal}
useAutoPositioning={useAutoPositioning}
style={style}
closeOnSelect={closeOnSelect}
others={others}
/>
) : (
Expand Down Expand Up @@ -93,6 +95,7 @@ const DateTimePicker = ({
renderInPortal={renderInPortal}
useAutoPositioning={useAutoPositioning}
style={style}
closeOnSelect={closeOnSelect}
others={others}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export const SingleSelect = () => {
style={{ zIndex: number('zIndex', 0) }}
renderInPortal={boolean('renderInPortal', true)}
locale={text('locale', 'en')}
closeOnSelect={boolean('Close On Select', true)}
/>
<div style={{ height: '10rem' }} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ export const propTypes = {
/** Auto reposition if flyout menu offscreen */
useAutoPositioning: PropTypes.bool,
style: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
/** If is set to true Datepicker will close after date select */
closeOnSelect: PropTypes.bool,
};

export const defaultProps = {
Expand Down Expand Up @@ -298,6 +300,7 @@ export const defaultProps = {
renderInPortal: true,
useAutoPositioning: false,
style: {},
closeOnSelect: true,
};

const DateTimePicker = ({
Expand Down Expand Up @@ -327,6 +330,7 @@ const DateTimePicker = ({
renderInPortal,
useAutoPositioning,
style,
closeOnSelect,
...others
}) => {
const id = useRef(others.id || uuidv4()).current;
Expand Down Expand Up @@ -1220,7 +1224,7 @@ const DateTimePicker = ({
: null
}
locale={locale?.split('-')[0]}
closeOnSelect={false}
closeOnSelect={closeOnSelect}
>
<DatePickerInput
labelText={mergedI18n.startDateLabel}
Expand Down

0 comments on commit fc656b7

Please sign in to comment.