theme.keycloak.v2.admin.resources.assets.ConfirmDialog-hx7XKLbN.js.map Maven / Gradle / Ivy
{"version":3,"file":"ConfirmDialog-hx7XKLbN.js","sources":["../../src/components/confirm-dialog/ConfirmDialog.tsx"],"sourcesContent":["import { ReactElement, ReactNode, useState } from \"react\";\nimport {\n Button,\n ButtonVariant,\n Modal,\n ModalVariant,\n} from \"@patternfly/react-core\";\nimport { useTranslation } from \"react-i18next\";\n\nexport const useConfirmDialog = (\n props: ConfirmDialogProps,\n): [() => void, () => ReactElement] => {\n const [show, setShow] = useState(false);\n\n function toggleDialog() {\n setShow((show) => !show);\n }\n\n const Dialog = () => (\n \n );\n return [toggleDialog, Dialog];\n};\n\nexport interface ConfirmDialogModalProps extends ConfirmDialogProps {\n open: boolean;\n toggleDialog: () => void;\n}\n\nexport type ConfirmDialogProps = {\n titleKey: string;\n messageKey?: string;\n noCancelButton?: boolean;\n confirmButtonDisabled?: boolean;\n cancelButtonLabel?: string;\n continueButtonLabel?: string;\n continueButtonVariant?: ButtonVariant;\n variant?: ModalVariant;\n onConfirm: () => void;\n onCancel?: () => void;\n children?: ReactNode;\n};\n\nexport const ConfirmDialogModal = ({\n titleKey,\n messageKey,\n noCancelButton,\n cancelButtonLabel,\n continueButtonLabel,\n continueButtonVariant,\n onConfirm,\n onCancel,\n children,\n open = true,\n variant = ModalVariant.small,\n toggleDialog,\n confirmButtonDisabled,\n}: ConfirmDialogModalProps) => {\n const { t } = useTranslation();\n return (\n {\n onConfirm();\n toggleDialog();\n }}\n >\n {t(continueButtonLabel || \"continue\")}\n ,\n !noCancelButton && (\n \n ),\n ]}\n >\n {!messageKey && children}\n {messageKey && t(messageKey)}\n \n );\n};\n"],"names":["useConfirmDialog","props","show","setShow","useState","toggleDialog","jsx","ConfirmDialogModal","titleKey","messageKey","noCancelButton","cancelButtonLabel","continueButtonLabel","continueButtonVariant","onConfirm","onCancel","children","open","variant","ModalVariant","confirmButtonDisabled","t","useTranslation","jsxs","Modal","Button","ButtonVariant"],"mappings":"sJASa,MAAAA,EACXC,GACqC,CACrC,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAS,EAAK,EAEtC,SAASC,GAAe,CACdF,EAACD,GAAS,CAACA,CAAI,CACzB,CAUO,MAAA,CAACG,EARO,IACbC,EAACC,EAAA,CAEE,GAAGN,EACJ,KAAMC,EACN,aAAAG,CAAA,EAHI,eAAA,CAMoB,CAC9B,EAqBaE,EAAqB,CAAC,CACjC,SAAAC,EACA,WAAAC,EACA,eAAAC,EACA,kBAAAC,EACA,oBAAAC,EACA,sBAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,KAAAC,EAAO,GACP,QAAAC,EAAUC,EAAa,MACvB,aAAAd,EACA,sBAAAe,CACF,IAA+B,CACvB,KAAA,CAAE,EAAAC,GAAMC,IAEZ,OAAAC,EAACC,EAAA,CACC,MAAOH,EAAEb,CAAQ,EACjB,OAAQS,EACR,QAASZ,EACT,QAAAa,EACA,QAAS,CACPZ,EAACmB,EAAA,CACC,GAAG,gBACH,cAAY,UAEZ,WAAYL,EACZ,QAASP,GAAyBa,EAAc,QAChD,QAAS,IAAM,CACHZ,IACGT,GACf,EAEC,SAAAgB,EAAET,GAAuB,UAAU,CAAA,EARhC,SASN,EACA,CAACF,GACCJ,EAACmB,EAAA,CACC,GAAG,eACH,cAAY,SAEZ,QAASC,EAAc,KACvB,QAAS,IAAM,CACTX,GAAmBA,IACVV,GACf,EAEC,SAAAgB,EAAEV,GAAqB,QAAQ,CAAA,EAP5B,QAQN,CAEJ,EAEC,SAAA,CAAA,CAACF,GAAcO,EACfP,GAAcY,EAAEZ,CAAU,CAAA,CAAA,CAAA,CAGjC"}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy