UNPKG

@keycloakify/keycloak-admin-ui

Version:
17 lines 1.19 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { useTranslation } from "react-i18next"; import { FormGroup } from "@patternfly/react-core"; import { HelpItem } from "../../ui-shared"; import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput"; import { convertToName } from "../../components/dynamic/DynamicComponents"; function convertDefaultValue(formValue) { return formValue && Array.isArray(formValue) ? formValue : [formValue]; } export const MultiValuedStringComponent = ({ name, label, defaultValue, helpText, stringify, required, isDisabled = false, }) => { const { t } = useTranslation(); const fieldName = convertToName(name); return (_jsx(FormGroup, { label: t(label), labelIcon: _jsx(HelpItem, { helpText: t(helpText), fieldLabelId: `${label}` }), fieldId: name, isRequired: required, children: _jsx(MultiLineInput, { "aria-label": t(label), name: fieldName, isDisabled: isDisabled, defaultValue: convertDefaultValue(defaultValue), addButtonLabel: t("addMultivaluedLabel", { fieldLabel: t(label).toLowerCase(), }), stringify: stringify }) })); }; //# sourceMappingURL=MultivaluedStringComponent.js.map