{ "version": 3, "sources": ["../../javascript/components/AssetsContext.ts", "../../javascript/utilities/railsAssetPath.ts", "../../javascript/components/ActionButton.tsx"], "sourcesContent": ["import React from \"react\"\n\ntype Assets = { [key: string]: string }\n\nconst AssetsContext = React.createContext({})\n\nexport { Assets, AssetsContext as default }\n", "const railsAssetPath = async (assetPath: string) => {\n return fetch(`/api/quilt/assets?paths=${assetPath}`, {})\n .then((response) => response.json())\n .then((json) => {\n if (json.error) {\n throw json.error\n }\n return json\n })\n}\n\n// This method gets all assets that are defined in the 'assets' param.\n// Return object is of form { assetKey: \"fingerprinted/path/to/asset\" }\nconst getAssetPaths = async (assets: { [key: string]: string }) => {\n let assetPaths: { [key: string]: string } = {}\n\n const joinedAssets = Object.values(assets).join(\",\")\n\n await railsAssetPath(joinedAssets).then((response) => {\n Object.entries(assets).forEach((asset) => {\n const assetKey = asset[0]\n const assetPath = asset[1]\n\n assetPaths[assetKey] = response[assetPath]\n })\n })\n return assetPaths\n}\n\nexport default getAssetPaths\n", "import React from \"react\"\n\ninterface ActionButtonProps {\n additionalClassNames?: string[]\n disabled?: boolean\n hoverable?: boolean\n fullWidth?: boolean\n alternativeColour?: boolean\n darkGoldColour?: boolean\n alternativeHover?: boolean\n onClick?: () => void\n text: string\n type?: \"submit\" | \"reset\" | \"button\" | undefined\n name?: string\n}\n\nconst ActionButton: React.FC = ({\n additionalClassNames = [],\n alternativeColour = false,\n alternativeHover = false,\n darkGoldColour = false,\n disabled = false,\n fullWidth = false,\n hoverable = false,\n name,\n onClick,\n text,\n type = \"button\"\n}) => {\n const getClasses = () => {\n let classes = [\"action-button\"]\n\n if (disabled) {\n classes.push(\"action-button__disabled\")\n }\n if (hoverable) {\n classes.push(\"action-button--hoverable\")\n }\n if (fullWidth) {\n classes.push(\"action-button--full-width\")\n }\n if (alternativeColour) {\n classes.push(\"action-button--almost-white\")\n }\n if (darkGoldColour) {\n classes.push(\"action-button--dark-gold\")\n }\n if (alternativeHover) {\n classes.push(\"action-button--light-blue-hover\")\n }\n\n if (additionalClassNames.length > 0) {\n return classes.concat(additionalClassNames).join(\" \")\n } else {\n return classes.join(\" \")\n }\n }\n\n return (\n \n {text}\n \n )\n}\n\nexport default ActionButton\n"], "mappings": "yHAAA,IAAAA,EAAkB,SAIZC,EAAgB,EAAAC,QAAM,cAAsB,CAAC,CAAC,ECJpD,IAAMC,EAAwBC,GAAsBC,EAAA,wBAClD,OAAO,MAAM,2BAA2BD,IAAa,CAAC,CAAC,EACpD,KAAME,GAAaA,EAAS,KAAK,CAAC,EAClC,KAAMC,GAAS,CACd,GAAIA,EAAK,MACP,MAAMA,EAAK,MAEb,OAAOA,CACT,CAAC,CACL,GAIMC,EAAuBC,GAAsCJ,EAAA,wBACjE,IAAIK,EAAwC,CAAC,EAEvCC,EAAe,OAAO,OAAOF,CAAM,EAAE,KAAK,GAAG,EAEnD,aAAMN,EAAeQ,CAAY,EAAE,KAAML,GAAa,CACpD,OAAO,QAAQG,CAAM,EAAE,QAASG,GAAU,CACxC,IAAMC,EAAWD,EAAM,GACjBR,EAAYQ,EAAM,GAExBF,EAAWG,GAAYP,EAASF,EAClC,CAAC,CACH,CAAC,EACMM,CACT,GAEOI,EAAQN,EC7Bf,IAAAO,EAAkB,SAgBZC,EAA4C,CAAC,CACjD,qBAAAC,EAAuB,CAAC,EACxB,kBAAAC,EAAoB,GACpB,iBAAAC,EAAmB,GACnB,eAAAC,EAAiB,GACjB,SAAAC,EAAW,GACX,UAAAC,EAAY,GACZ,UAAAC,EAAY,GACZ,KAAAC,EACA,QAAAC,EACA,KAAAC,EACA,KAAAC,EAAO,QACT,IA+BI,EAAAC,QAAA,cAAC,UACC,KAAMD,EACN,WAhCe,IAAM,CACvB,IAAIE,EAAU,CAAC,eAAe,EAqB9B,OAnBIR,GACFQ,EAAQ,KAAK,yBAAyB,EAEpCN,GACFM,EAAQ,KAAK,0BAA0B,EAErCP,GACFO,EAAQ,KAAK,2BAA2B,EAEtCX,GACFW,EAAQ,KAAK,6BAA6B,EAExCT,GACFS,EAAQ,KAAK,0BAA0B,EAErCV,GACFU,EAAQ,KAAK,iCAAiC,EAG5CZ,EAAqB,OAAS,EACzBY,EAAQ,OAAOZ,CAAoB,EAAE,KAAK,GAAG,EAE7CY,EAAQ,KAAK,GAAG,CAE3B,GAK0B,EACtB,QAASJ,EACT,SAAUJ,EACV,KAAMG,GAELE,CACH,EAIGI,EAAQd", "names": ["import_react", "AssetsContext", "React", "railsAssetPath", "assetPath", "__async", "response", "json", "getAssetPaths", "assets", "assetPaths", "joinedAssets", "asset", "assetKey", "railsAssetPath_default", "import_react", "ActionButton", "additionalClassNames", "alternativeColour", "alternativeHover", "darkGoldColour", "disabled", "fullWidth", "hoverable", "name", "onClick", "text", "type", "React", "classes", "ActionButton_default"] }