Skip to content
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
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ module.exports = {
extends: ['react-app', 'prettier', 'plugin:prettier/recommended'],
rules: {
'@typescript-eslint/consistent-type-assertions': 0,
'react/button-has-type': [2, { submit: false, reset: false }],
},
};
8 changes: 2 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<!--
Make sure you've read the CONTRIBUTING.md file.
Fill out the information to help the review and merge of your pull request!
-->

**What kind of change does this PR introduce?**
<!-- You can also link to an open issue here -->

Expand All @@ -19,4 +14,5 @@ Fill out the information to help the review and merge of your pull request!
- [ ] Tests
- [ ] Ready to be merged <!-- In your opinion, is this ready to be merged as soon as it's reviewed? -->

<!-- Feel free to add additional comments -->
<!-- Make sure you've read the CONTRIBUTING.md file too -->
<!-- Feel free to add additional comments -->
2 changes: 1 addition & 1 deletion src/components/button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, ButtonProps } from 'semantic-ui-react';

const CustomButton = ({ icon, ...otherProps }: ButtonProps) => (
<Button basic compact icon={icon} {...otherProps} />
<Button basic compact icon={icon} type="button" {...otherProps} />
);

export default CustomButton;
8 changes: 6 additions & 2 deletions src/components/calendar/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const Calendar: React.FC<CalendarProps> = ({
icon="angle double left"
inverted={inverted}
title={previousYear}
type="button"
{...getBackProps({
calendars,
'aria-label': previousYear,
Expand All @@ -114,6 +115,7 @@ const Calendar: React.FC<CalendarProps> = ({
inverted={inverted}
style={{ marginRight: 0 }}
title={previousMonth}
type="button"
{...getBackProps({
calendars,
'aria-label': previousMonth,
Expand All @@ -135,6 +137,7 @@ const Calendar: React.FC<CalendarProps> = ({
icon="angle right"
inverted={inverted}
title={nextMonth}
type="button"
{...getForwardProps({
calendars,
'aria-label': nextMonth,
Expand All @@ -146,6 +149,7 @@ const Calendar: React.FC<CalendarProps> = ({
inverted={inverted}
style={{ marginRight: 0 }}
title={nextYear}
type="button"
{...getForwardProps({
calendars,
'aria-label': nextYear,
Expand Down Expand Up @@ -201,7 +205,7 @@ const Calendar: React.FC<CalendarProps> = ({
</div>
))}
</div>
{showToday && (
{showToday ? (
<TodayButton
inverted={inverted}
{...getToday(minDate, maxDate)}
Expand All @@ -212,7 +216,7 @@ const Calendar: React.FC<CalendarProps> = ({
>
{todayButton}
</TodayButton>
)}
) : null}
</Segment>
</Ref>
);
Expand Down
7 changes: 6 additions & 1 deletion src/components/cell/cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ const CalendarCell = ({
}

return (
<button className={className} disabled={!selectable} {...otherProps}>
<button
className={className}
disabled={!selectable}
type="button"
{...otherProps}
>
{children}
</button>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ type CustomIconProps = {
icon: SemanticDatepickerProps['icon'];
isClearIconVisible: boolean;
onClear: () => void;
onClick: () => void;
};

const CustomIcon = ({
clearIcon,
icon,
isClearIconVisible,
onClear,
onClick,
}: CustomIconProps) => {
if (isClearIconVisible && clearIcon && React.isValidElement(clearIcon)) {
return React.cloneElement<any>(clearIcon, {
Expand All @@ -37,6 +39,7 @@ const CustomIcon = ({
if (icon && React.isValidElement(icon)) {
return React.cloneElement<any>(icon, {
'data-testid': 'datepicker-icon',
onClick,
});
}

Expand Down
1 change: 1 addition & 0 deletions src/components/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const CustomInput = React.forwardRef<Input, InputProps>((props, ref) => {
icon={icon}
isClearIconVisible={isClearIconVisible}
onClear={onClear}
onClick={onFocus}
/>
}
input={inputData}
Expand Down
1 change: 1 addition & 0 deletions src/components/today-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const TodayButton: React.FC<TodayButtonProps> = ({
data-testid="datepicker-today-button"
fluid
style={style}
type="button"
{...otherProps}
>
{children}
Expand Down
12 changes: 10 additions & 2 deletions stories/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,16 @@ export const withCustomIcons = () => {
const clearIcon = select('Clear icon (with value)', iconMap, iconMap.close);
const useCustomIcon = boolean('Custom icon', false);
const useCustomClearIcon = boolean('Custom clear icon', false);
const CustomIcon = (props: any) => <button {...props}>Select</button>;
const CustomClearIcon = (props: any) => <button {...props}>Reset</button>;
const CustomIcon = (props: any) => (
<button type="button" {...props}>
Select
</button>
);
const CustomClearIcon = (props: any) => (
<button type="button" {...props}>
Reset
</button>
);
const x = useCustomIcon ? ((<CustomIcon />) as unknown) : icon;
const y = useCustomClearIcon ? ((<CustomClearIcon />) as unknown) : clearIcon;

Expand Down