{"version":3,"file":"getPresetPartials.mjs","sources":[""],"sourcesContent":["import { Btn } from \"../../../components/btn\";\r\nimport { Locale } from \"../../../components/locale\";\r\nimport type { TGetCNFunction } from \"../../../utils/react/useCN\";\r\nimport type { IModal, TPresetData } from \"../config/types\";\r\n\r\n/**\r\n * Получает части внутреннего контента для готового пресета модального окна\r\n * @returns {TPresetData}\r\n */\r\nexport const getPresetPartials = (preset: IModal[\"preset\"], idModal: IModal[\"id\"], getCN: TGetCNFunction): TPresetData => {\r\n  switch (preset) {\r\n    case \"confirm\": {\r\n      const confirmHandlerCfg = { action: \"confirm\", id: idModal };\r\n      const cancelHandlerCfg = { action: \"cancel\", id: idModal };\r\n      return {\r\n        titleSlot: <Locale code={\"modals.confirmTitle\"} />,\r\n        contentSlot: null,\r\n        footerSlot: (\r\n          <ul className={getCN(\"list\")}>\r\n            <li key={0}>\r\n              <Btn extraAttrs={{ \"data-js-modal-handler\": JSON.stringify(confirmHandlerCfg) }}>\r\n                <span className={\"btn__label\"}>\r\n                  <Locale code={\"modals.confirmBtn\"} />\r\n                </span>\r\n              </Btn>\r\n            </li>\r\n            <li key={1}>\r\n              <Btn isLight={true} extraAttrs={{ \"data-js-modal-handler\": JSON.stringify(cancelHandlerCfg) }}>\r\n                <span className={\"btn__label\"}>\r\n                  <Locale code={\"modals.cancelBtn\"} />\r\n                </span>\r\n              </Btn>\r\n            </li>\r\n          </ul>\r\n        ),\r\n      };\r\n    }\r\n    case \"error\":\r\n      return {\r\n        titleSlot: <Locale code={\"modals.errorTitle\"} />,\r\n        contentSlot: <Locale code={\"modals.defaultError\"} />,\r\n        footerSlot: null,\r\n      };\r\n    case \"success\":\r\n      return {\r\n        titleSlot: <Locale code={\"modals.successTitle\"} />,\r\n        contentSlot: <Locale code={\"modals.defaultSuccess\"} />,\r\n        footerSlot: null,\r\n      };\r\n    default:\r\n      return {\r\n        titleSlot: null,\r\n        contentSlot: null,\r\n        footerSlot: null,\r\n      };\r\n  }\r\n};\r\n"],"names":["getPresetPartials","preset","idModal","getCN","confirmHandlerCfg","action","id","cancelHandlerCfg","titleSlot","_jsx","Locale","code","contentSlot","footerSlot","_jsxs","className","children","Btn","extraAttrs","JSON","stringify","isLight"],"mappings":";;;;GASO,MAAMA,kBAAoB,CAACC,OAA0BC,QAAuBC,SACjF,OAAQF,QACN,IAAK,UAAW,CACd,MAAMG,kBAAoB,CAAEC,OAAQ,UAAWC,GAAIJ,SACnD,MAAMK,iBAAmB,CAAEF,OAAQ,SAAUC,GAAIJ,SACjD,MAAO,CACLM,UAAWC,IAACC,OAAM,CAACC,KAAM,wBACzBC,YAAa,KACbC,WACEC,KAAA,KAAA,CAAIC,UAAWZ,MAAM,QAAQa,SAAA,CAC3BP,IAAA,KAAA,CAAAO,SACEP,IAACQ,IAAG,CAACC,WAAY,CAAE,wBAAyBC,KAAKC,UAAUhB,oBAAqBY,SAC9EP,IAAA,OAAA,CAAMM,UAAW,aAAaC,SAC5BP,IAACC,OAAM,CAACC,KAAM,2BAHX,GAOTF,IAAA,KAAA,CAAAO,SACEP,IAACQ,IAAG,CAACI,QAAS,KAAMH,WAAY,CAAE,wBAAyBC,KAAKC,UAAUb,mBAAoBS,SAC5FP,IAAA,OAAA,CAAMM,UAAW,aAAaC,SAC5BP,IAACC,OAAM,CAACC,KAAM,0BAHX,MAUjB,CACA,IAAK,QACH,MAAO,CACLH,UAAWC,IAACC,OAAM,CAACC,KAAM,sBACzBC,YAAaH,IAACC,OAAM,CAACC,KAAM,wBAC3BE,WAAY,MAEhB,IAAK,UACH,MAAO,CACLL,UAAWC,IAACC,OAAM,CAACC,KAAM,wBACzBC,YAAaH,IAACC,OAAM,CAACC,KAAM,0BAC3BE,WAAY,MAEhB,QACE,MAAO,CACLL,UAAW,KACXI,YAAa,KACbC,WAAY"}