diff --git a/web/package.json b/web/package.json index 1f2b6e3..29bc599 100644 --- a/web/package.json +++ b/web/package.json @@ -28,6 +28,7 @@ "react-router-dom": "^6.3.0", "react-select": "^5.3.2", "react-table": "^7.8.0", + "react-textarea-autosize": "^8.3.4", "react-tooltip": "^5.5.2", "stacktracey": "^2.1.8", "vite-plugin-pwa": "^0.14.6", diff --git a/web/src/components/inputs/input.tsx b/web/src/components/inputs/input.tsx index bbdf4cd..8a14066 100644 --- a/web/src/components/inputs/input.tsx +++ b/web/src/components/inputs/input.tsx @@ -3,12 +3,14 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ +import { useEffect } from "react"; import { Field, FieldProps, useFormikContext } from "formik"; -import { classNames } from "@utils"; import { EyeIcon, EyeSlashIcon, CheckCircleIcon, XCircleIcon } from "@heroicons/react/24/solid"; +import TextareaAutosize from "react-textarea-autosize"; + import { useToggle } from "@hooks/hooks"; import { CustomTooltip } from "@components/tooltips/CustomTooltip"; -import { useEffect } from "react"; +import { classNames } from "@utils"; type COL_WIDTHS = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; @@ -234,6 +236,147 @@ export const RegexField = ({ ); }; +export const RegexTextAreaField = ({ + name, + defaultValue, + label, + placeholder, + columns, + autoComplete = "off", + useRegex, + hidden, + tooltip, + disabled +}: RegexFieldProps) => { + const validRegex = (pattern: string) => { + + // Check for unsupported lookahead and lookbehind assertions + if (/\(\?<=|\(\?/.test(pattern)) { + return false; + } + + // Check for unsupported recursive patterns + if (/\(\?(R|0)\)/.test(pattern)) { + return false; + } + + // Check for unsupported possessive quantifiers + if (/[*+?]{1}\+|\{[0-9]+,[0-9]*\}\+/.test(pattern)) { + return false; + } + + // Check for unsupported control verbs + if (/\\g { + let error = ""; + + if (!validRegex(val)) { + error = "Invalid regex"; + } + + return error; + }; + + const { validateForm } = useFormikContext(); + useEffect(() => { + if (useRegex) { + validateForm(); + } + }, [useRegex]); + + return ( +
* {meta.error}
+ )} +You can use basic filtering like wildcards *
or replace single characters with ?
You can use basic filtering like wildcards *
or replace single characters with ?
This field takes a range of years and/or comma separated single years.
https://autobrr.com/filters#tvmovies} />You can use basic filtering like wildcards *
or replace single characters with ?
You can use basic filtering like wildcards *
or replace single characters with ?
You can use basic filtering like wildcards *
or replace single characters with ?
You can use basic filtering like wildcards *
or replace single characters with ?
This field takes a range of years and/or comma separated single years.
https://autobrr.com/filters#music} /> @@ -567,8 +568,8 @@ export function Advanced({ values }: AdvancedProps) {This field has full regex support (Golang flavour).
https://autobrr.com/filters#advancedRemember to tick Use Regex below if using more than *
and ?
.
This field has full regex support (Golang flavour).
https://autobrr.com/filters#advancedRemember to tick Use Regex below if using more than *
and ?
.
This field has full regex support (Golang flavour).
https://autobrr.com/filters#advancedRemember to tick Use Regex below if using more than *
and ?
.
This field has full regex support (Golang flavour).
https://autobrr.com/filters#advancedRemember to tick Use Regex below if using more than *
and ?
.
Comma separated list of release groups to match.
https://autobrr.com/filters#advanced} /> -Comma separated list of release groups to ignore (takes priority over Match releases).
https://autobrr.com/filters#advanced} /> +Comma separated list of release groups to match.
https://autobrr.com/filters#advanced} /> +Comma separated list of release groups to ignore (takes priority over Match releases).
https://autobrr.com/filters#advanced} />Comma separated list of categories to match.
https://autobrr.com/filters/categories} /> -Comma separated list of categories to ignore (takes priority over Match releases).
https://autobrr.com/filters/categories} /> +Comma separated list of categories to match.
https://autobrr.com/filters/categories} /> +Comma separated list of categories to ignore (takes priority over Match releases).
https://autobrr.com/filters/categories} /> -Comma separated list of tags to match.
https://autobrr.com/filters#advanced} /> +Comma separated list of tags to match.
https://autobrr.com/filters#advanced} />Comma separated list of uploaders to match.
https://autobrr.com/filters#advanced} /> -Comma separated list of uploaders to ignore (takes priority over Match releases).
https://autobrr.com/filters#advanced} /> +Comma separated list of uploaders to match.
https://autobrr.com/filters#advanced} /> +Comma separated list of uploaders to ignore (takes priority over Match releases).
https://autobrr.com/filters#advanced} />