forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ProviderConfigProperty types for numeric values
Fixes keycloak#29511 Signed-off-by: Thomas Darimont <[email protected]>
- Loading branch information
1 parent
83bba0f
commit 368c1f5
Showing
6 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { useTranslation } from "react-i18next"; | ||
import { TextControl } from "@keycloak/keycloak-ui-shared"; | ||
|
||
import { convertToName } from "./DynamicComponents"; | ||
import { NumberComponentProps } from "./components"; | ||
|
||
export const IntComponent = ({ | ||
name, | ||
label, | ||
helpText, | ||
...props | ||
}: NumberComponentProps) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<TextControl | ||
name={convertToName(name!)} | ||
type="number" | ||
pattern="\d*" | ||
label={t(label!)} | ||
labelIcon={t(helpText!)} | ||
data-testid={name} | ||
{...props} | ||
/> | ||
); | ||
}; |
25 changes: 25 additions & 0 deletions
25
js/apps/admin-ui/src/components/dynamic/NumberComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useTranslation } from "react-i18next"; | ||
import { TextControl } from "@keycloak/keycloak-ui-shared"; | ||
|
||
import { convertToName } from "./DynamicComponents"; | ||
import { NumberComponentProps } from "./components"; | ||
|
||
export const NumberComponent = ({ | ||
name, | ||
label, | ||
helpText, | ||
...props | ||
}: NumberComponentProps) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<TextControl | ||
name={convertToName(name!)} | ||
type="number" | ||
label={t(label!)} | ||
labelIcon={t(helpText!)} | ||
data-testid={name} | ||
{...props} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters