@grafana/ui
Version:
Grafana Components Library
1 lines • 1.86 kB
Source Map (JSON)
{"version":3,"file":"SecretInput.mjs","sources":["../../../../src/components/SecretInput/SecretInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button } from '../Button/Button';\nimport { Input } from '../Input/Input';\nimport { Stack } from '../Layout/Stack/Stack';\n\nexport type Props = React.ComponentProps<typeof Input> & {\n /** TRUE if the secret was already configured. (It is needed as often the backend doesn't send back the actual secret, only the information that it was configured) */\n isConfigured: boolean;\n /** Called when the user clicks on the \"Reset\" button in order to clear the secret */\n onReset: () => void;\n};\n\nexport const CONFIGURED_TEXT = 'configured';\nexport const RESET_BUTTON_TEXT = 'Reset';\n\n/**\n * Used for secret/password input.\n *\n * https://developers.grafana.com/ui/latest/index.html?path=/docs/inputs-secretinput--docs\n */\nexport const SecretInput = ({ isConfigured, onReset, ...props }: Props) => (\n <Stack>\n {!isConfigured && <Input {...props} type=\"password\" />}\n {isConfigured && (\n <>\n <Input {...props} type=\"text\" disabled={true} value={CONFIGURED_TEXT} />\n <Button onClick={onReset} variant=\"secondary\">\n {RESET_BUTTON_TEXT}\n </Button>\n </>\n )}\n </Stack>\n);\n"],"names":[],"mappings":";;;;;;AAaO,MAAM,eAAA,GAAkB;AACxB,MAAM,iBAAA,GAAoB;AAO1B,MAAM,WAAA,GAAc,CAAC,EAAE,YAAA,EAAc,SAAS,GAAG,KAAA,EAAM,qBAC5D,IAAA,CAAC,KAAA,EAAA,EACE,QAAA,EAAA;AAAA,EAAA,CAAC,gCAAgB,GAAA,CAAC,KAAA,EAAA,EAAO,GAAG,KAAA,EAAO,MAAK,UAAA,EAAW,CAAA;AAAA,EACnD,gCACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,KAAA,EAAA,EAAO,GAAG,KAAA,EAAO,IAAA,EAAK,QAAO,QAAA,EAAU,IAAA,EAAM,OAAO,eAAA,EAAiB,CAAA;AAAA,wBACrE,MAAA,EAAA,EAAO,OAAA,EAAS,OAAA,EAAS,OAAA,EAAQ,aAC/B,QAAA,EAAA,iBAAA,EACH;AAAA,GAAA,EACF;AAAA,CAAA,EAEJ;;;;"}