UNPKG

@grafana/ui

Version:
57 lines (52 loc) 1.58 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var jsxRuntime = require('react/jsx-runtime'); var i18n = require('@grafana/i18n'); var Button = require('../Button/Button.cjs'); var FormField = require('../FormField/FormField.cjs'); "use strict"; const SecretFormField = ({ label = "Password", labelWidth, inputWidth = 12, onReset, isConfigured, tooltip, placeholder = "Password", interactive, ...inputProps }) => { return /* @__PURE__ */ jsxRuntime.jsx( FormField.FormField, { label, tooltip, interactive, labelWidth, inputEl: isConfigured ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [ /* @__PURE__ */ jsxRuntime.jsx( "input", { type: "text", className: `gf-form-input width-${inputWidth}`, disabled: true, ...inputProps, value: "configured" } ), /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { onClick: onReset, variant: "secondary", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(i18n.Trans, { i18nKey: "grafana-ui.secret-form-field.reset", children: "Reset" }) }) ] }) : /* @__PURE__ */ jsxRuntime.jsx( "input", { type: "password", className: `gf-form-input width-${inputWidth}`, placeholder, ...inputProps } ) } ); }; SecretFormField.displayName = "SecretFormField"; exports.SecretFormField = SecretFormField; //# sourceMappingURL=SecretFormField.cjs.map