Skip to content

Commit

Permalink
feat(maskedInput): eagerly append separators
Browse files Browse the repository at this point in the history
Co-authored-by: Joschka de Cuveland <joschka.decuveland@digitalservice.bund.de>
Co-authored-by: Pram Gurusinga <pratama.gurusinga@digitalservice.bund.de>
Co-authored-by: Rafael Falk <rafael.falk@digitalservice.bund.de>
Co-authored-by: Sanny Nguyen Hung <sanny.nguyen@digitalservice.bund.de>
  • Loading branch information
5 people committed Jan 22, 2024
1 parent a3f196d commit 57c2423
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/components/inputs/DateInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const DateInput = (props: InputProps) => {
type="number"
placeholder="TT.MM.JJJJ"
width="10"
eager={"append"}
{...props}
/>
);
Expand Down
1 change: 1 addition & 0 deletions app/components/inputs/MaskedInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IMaskMixin } from "react-imask";

type MaskedInputProps = InputProps & {
readonly mask: string | RegExp;
readonly eager?: boolean | ("remove" | "append");
};

const MaskedStyledInput = IMaskMixin<HTMLInputElement, InputProps>(
Expand Down
10 changes: 9 additions & 1 deletion app/components/inputs/TimeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@ import { type InputProps } from "./Input";
import MaskedInput from "./MaskedInput";

const TimeInput = (props: InputProps) => {
return <MaskedInput mask={"`0`0:`0`0"} type="number" width="10" {...props} />;
return (
<MaskedInput
mask={"`0`0:`0`0"}
type="number"
width="10"
eager={"append"}
{...props}
/>
);
};

export default TimeInput;

0 comments on commit 57c2423

Please sign in to comment.