slice-machine-ui 2.0.1-alpha.bmo-dt-2018-convert-list-to-css-modules.2 → 2.0.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/_next/static/{XrGEsJHL6nJ3tjyPDQTOd → X7RwXU9287GEnS_otxfnK}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/339-4822969b973d80f9.js +1 -0
- package/out/_next/static/chunks/pages/{_app-acae58c2ecec62da.js → _app-7ba0e41a9a238e84.js} +4 -4
- package/out/_next/static/chunks/pages/custom-types-19c4fe4abeca8a48.js +1 -0
- package/out/_next/static/chunks/pages/index-41fcbf4361de7317.js +1 -0
- package/out/_next/static/css/{22f264c93bd9d85f.css → 609c46c5c573c3ed.css} +1 -1
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/settings.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -3
- package/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +87 -51
- package/src/icons/ReusableIcon.tsx +8 -16
- package/src/icons/SingleIcon.tsx +20 -0
- package/test/__setup__.ts +7 -1
- package/out/_next/static/chunks/91-67c244a4a034c8de.js +0 -1
- package/out/_next/static/chunks/pages/custom-types-900b40b54b74e6d6.js +0 -1
- package/out/_next/static/chunks/pages/index-ccd2975faba412f6.js +0 -1
- package/src/components/Table/Table.css.ts +0 -93
- package/src/components/Table/Table.stories.tsx +0 -98
- package/src/components/Table/Table.test.tsx +0 -87
- package/src/components/Table/Table.tsx +0 -81
- package/src/components/Table/index.ts +0 -1
- package/src/features/customTypes/__tests__/CustomTypesTablePage.test.tsx +0 -350
- package/src/icons/UniqueIcon.tsx +0 -23
- /package/out/_next/static/{XrGEsJHL6nJ3tjyPDQTOd → X7RwXU9287GEnS_otxfnK}/_ssgManifest.js +0 -0
package/out/404.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/037ba37d121d4afe.css" as="style"/><link rel="stylesheet" href="/_next/static/css/037ba37d121d4afe.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/037ba37d121d4afe.css" as="style"/><link rel="stylesheet" href="/_next/static/css/037ba37d121d4afe.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-7ba0e41a9a238e84.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/X7RwXU9287GEnS_otxfnK/_buildManifest.js" defer=""></script><script src="/_next/static/X7RwXU9287GEnS_otxfnK/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"X7RwXU9287GEnS_otxfnK","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,n,
|
|
1
|
+
self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,n,u,d,f,h,l,k,j,p,g,o,r){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[a,j,p,"static/chunks/pages/index-41fcbf4361de7317.js"],"/_error":["static/chunks/pages/_error-69b4f498bafdd188.js"],"/changelog":[s,e,"static/chunks/870-0c7a8a9622de78b7.js","static/chunks/pages/changelog-3f04a3d8747ae383.js"],"/changes":[s,t,"static/chunks/8eec4907-b712959d9f984b68.js",i,"static/chunks/918-5bb55fb464e34768.js",c,n,"static/css/6279e95f6aff22d5.css","static/chunks/pages/changes-ec62e7eb50d6f2be.js"],"/custom-types":[a,j,p,"static/chunks/pages/custom-types-19c4fe4abeca8a48.js"],"/custom-types/[customTypeId]":[s,u,d,f,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/custom-types/[customTypeId]-982ecf1d799b6bcf.js"],"/labs":["static/chunks/pages/labs-830dde0b85d6dd01.js"],"/page-types/[pageTypeId]":[s,u,d,f,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/page-types/[pageTypeId]-886fc28240831dae.js"],"/settings":["static/css/ca32882a5d2d8d88.css","static/chunks/pages/settings-f61144a9387fd6f1.js"],"/slices":[s,t,b,c,n,"static/css/f01f60095c76c7fb.css","static/chunks/pages/slices-d65be4ca817a766d.js"],"/slices/[lib]/[sliceName]/[variation]":[s,t,u,d,f,h,e,b,i,l,c,k,n,"static/css/8d1871dce67a3b49.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-b26298f5ac9df335.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[t,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/18539003-32a73014bab3a789.js","static/chunks/756-b11a3060cdc2f2d3.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-9bdb355306fca592.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/settings","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/59b4e022-7a3b5554b806349f.js","static/chunks/614-5130fbdbcfab2d35.js","static/chunks/569-2ae3e9666f3bf991.js","static/chunks/183-6ad1d7303abecd2b.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/543-f8766685f7f451e2.js","static/chunks/50-cfc2514205b86001.js","static/chunks/90-2d4bdae13d031364.js","static/chunks/f36c6662-03bb5e9d9aa0b0aa.js","static/chunks/4c744e84-e3161d754618373f.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-2c5b6c0367fcde86.js","static/chunks/696-b992b9e1ce75777e.js","static/chunks/661-aa0b760bb52a7edf.js","static/chunks/339-4822969b973d80f9.js","static/css/609c46c5c573c3ed.css","static/chunks/210-aee6116139329803.js","static/chunks/188-9180e5802623e311.js","static/css/a6b6600e19e1c0c1.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[339],{23691:function(e,n,r){r.d(n,{F:function(){return L}});var t=r(52322),a=r(22715),l=r(97729),s=r.n(l),i=r(2784),c=r(41730),o=r(8564),u=r(78656),d=r(38562),h=r(24448),x=r(5632),p=r(82032),f=r(62230),m=r(85244),j=function(e){return(0,t.jsxs)("svg",(0,m.Z)((0,f.Z)({viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,t.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf"}),(0,t.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc"}),(0,t.jsx)("path",{d:"m10.0912 8c-2.8118 0-5.0912 2.2794-5.0912 5.0912s2.2794 5.0912 5.0912 5.0912c1.8851 0 3.5303-1.0247 4.4098-2.5452.1553-.2684.2868-.5523.3916-.8489.092-.2604-.0444-.5461-.3048-.6381-.2603-.092-.546.0445-.638.3048-.0841.238-.1897.4659-.3144.6815-.7081 1.2241-2.0305 2.0459-3.5442 2.0459-2.2595 0-4.0912-1.8317-4.0912-4.0912s1.8317-4.0912 4.0912-4.0912c1.3566 0 2.5595.66 3.3043 1.6782h-1.7739c-.2761 0-.5.2239-.5.5 0 .2762.2239.5.5.5h2.6782c.2762 0 .5-.2238.5-.5v-2.6782c0-.2761-.2238-.5-.5-.5-.2761 0-.5.2239-.5.5v1.1032c-.9281-.9865-2.2462-1.6032-3.7086-1.6032z",fill:"#fff"})]}))},g=function(e){return(0,t.jsxs)("svg",(0,m.Z)((0,f.Z)({viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,t.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf",fillRule:"nonzero"}),(0,t.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc",fillRule:"nonzero"}),(0,t.jsx)("path",{d:"m8.0869 10.6818.5758-2.3031c.0556-.2226.2556-.3787.485-.3787.3253 0 .564.3057.4851.6213l-.5151 2.0605h2.6055l.5758-2.3031c.0557-.2226.2557-.3787.4851-.3787.3253 0 .564.3057.4851.6213l-.5152 2.0605h2.246c.2761 0 .5.2239.5.5 0 .2762-.2239.5-.5.5h-2.496l-.6591 2.6364h2.1551c.2761 0 .5.2238.5.5 0 .2761-.2239.5-.5.5h-2.4051l-.5757 2.3031c-.0557.2226-.2557.3787-.4851.3787-.3253 0-.564-.3057-.4851-.6213l.5152-2.0605h-2.6056l-.5758 2.3031c-.0556.2226-.2556.3787-.4851.3787-.3253 0-.5639-.3057-.485-.6213l.5151-2.0605h-1.9278c-.2761 0-.5-.2239-.5-.5 0-.2762.2239-.5.5-.5h2.1778l.6591-2.6364h-1.8369c-.2761 0-.5-.2238-.5-.5 0-.2761.2239-.5.5-.5zm2.7273 3.6364.659-2.6364h-2.6055l-.6591 2.6364z",fill:"#fff"})]}))},v=r(67445),b=r(54845),y=r(22710),C=r(99267),S=r(18566),w=r(56580),k=r(15354),Z=r(52312),T=r(81038),I=r(28849);function _(e){return R.apply(this,arguments)}function R(){return(R=(0,y.Z)(function(e){var n,r,t;return(0,C.__generator)(this,function(a){switch(a.label){case 0:return[4,T.j.customTypes.readAllCustomTypes({format:e})];case 1:if(r=(n=a.sent()).errors,t=n.models,r.length>0)throw r;return[2,t.map(function(e){return e.model})]}})})).apply(this,arguments)}var z=function(e){var n,r,l,s,c,o,d=e.format,h=e.isCreatingCustomType,f=e.openCreateCustomTypeModal,m=(0,x.useRouter)(),y=(r=(0,i.useCallback)(function(e){return(0,S.VA)(_,[d],e)},[d]),{customTypes:(0,S.QT)(_,[d]),updateCustomTypes:r}),C=y.customTypes,T=y.updateCustomTypes,R=C.sort(function(e,n){return e.id.localeCompare(n.id)}),z=v.cd[d],L=u.$[d];return(o=(0,w.v9)(function(e){return{storeCustomTypes:(0,I.Ch)(e).filter(Z.TG)}}).storeCustomTypes,(0,i.useEffect)(function(){var e=o.filter(function(e){return e.local.format===d});(e.length!==C.length||e.some(function(e){var n=C.find(function(n){return n.id===e.local.id});return!n||JSON.stringify(k.Dc.fromSM(e.local))!==JSON.stringify(n)}))&&T(e.map(function(e){var n=e.local;return k.Dc.fromSM(n)}))},[d,T,C,o]),0===R.length)?(0,t.jsxs)(p.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:a.TV.size[72]},children:[(0,t.jsx)(p.u2,{children:(0,t.jsx)(a.Ee,{src:z.blankSlateImage,sizing:"cover"})}),(0,t.jsxs)(p.T9,{children:[(0,t.jsx)(p._T,{children:L.name({start:!0,plural:!0})}),(0,t.jsx)(p.nf,{children:L.blankSlateDescription}),(0,t.jsx)(p.Qj,{children:(0,t.jsx)(a.zx,{onClick:f,loading:h,children:"Create"})})]})]}):(0,t.jsx)("div",{children:(0,t.jsxs)(a.iA,{columnLayout:"28px 1fr 1fr 1fr 42px",children:[(0,t.jsx)(a.ss,{children:(0,t.jsxs)(a.SC,{children:[(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.I5,{name:"notes",size:"medium"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",variant:"small",children:"Label"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",variant:"small",children:"API ID"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",variant:"small",children:"Limit"})}),(0,t.jsx)(a.pj,{})]})}),(0,t.jsx)(a.RM,{children:R.map(function(e){var n=e.repeatable,r=e.label,l=e.id;return(0,t.jsxs)(a.SC,{onClick:function(){m.push(v.cd[d].getBuilderPagePathname(l))},children:[(0,t.jsx)(a.pj,{children:n?(0,t.jsx)(j,{width:a.rS.space[20]}):(0,t.jsx)(g,{width:a.rS.space[20]})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{variant:"bold",noWrap:!0,children:r})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",noWrap:!0,children:l})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",noWrap:!0,children:n?"Reusable":"Single"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(b._,{isChangesLocal:!1,format:d,customType:e})})]},l)})})]})})},L=function(e){var n=e.format,r=u.$[n],l=(0,i.useState)(!1),x=l[0],p=l[1],f=(0,i.useState)(!1),m=f[0],j=f[1];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s(),{children:(0,t.jsxs)("title",{children:[r.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,t.jsx)(o.S,{renderError:function(){return(0,t.jsx)(d.LN,{children:(0,t.jsx)(d.RN,{children:(0,t.jsx)(a.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(a.Iq,{title:"Request failed",description:"An error occurred while fetching your ".concat(r.name({start:!1,plural:!0}),".")})})})})},children:(0,t.jsx)(i.Suspense,{fallback:(0,t.jsxs)(d.LN,{children:[(0,t.jsxs)(d.wd,{children:[(0,t.jsx)(d.Cx,{children:(0,t.jsx)(c.g,{children:r.name({start:!0,plural:!0})})}),(0,t.jsx)(d.K2,{children:(0,t.jsx)(a.zx,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,t.jsx)(d.RN,{children:(0,t.jsx)(a._3,{})})]}),children:(0,t.jsxs)(d.LN,{children:[(0,t.jsxs)(d.wd,{children:[(0,t.jsx)(d.Cx,{children:(0,t.jsx)(c.g,{children:r.name({start:!0,plural:!0})})}),(0,t.jsx)(d.K2,{children:(0,t.jsx)(a.zx,{"data-testid":"create-ct",loading:x,onClick:function(){j(!0)},startIcon:"add",children:"Create"})})]}),(0,t.jsx)(d.RN,{children:(0,t.jsxs)(a.xu,{flexDirection:"column",children:[(0,t.jsx)(z,{format:n,isCreatingCustomType:x,openCreateCustomTypeModal:function(){j(!0)}}),(0,t.jsx)(h.M,{format:n,isCreating:x,isOpen:m,onCreateChange:p,onOpenChange:j})]})})]})})})]})}},98898:function(e,n,r){r.d(n,{Z:function(){return o}});var t=r(62230),a=r(85244),l=r(98240),s=r(52322);r(2784);var i=r(75289),c=function(e){var n=e.bg,r=e.background,a=e.sx,l=e.withRadius,c=e.radius,o=e.children;return(0,s.jsx)(i.xu,{sx:(0,t.Z)({p:4,bg:n||r},l?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,a),children:o})},o=function(e){var n=e.Header,r=void 0===n?null:n,o=e.SubHeader,u=void 0===o?null:o,d=e.Body,h=void 0===d?null:d,x=e.Footer,p=void 0===x?null:x,f=e.borderFooter,m=e.radius,j=void 0===m?"6px":m,g=e.bodySx,v=e.footerSx,b=e.sx,y=e.bg,C=e.background,S=e.children,w=(0,l.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,s.jsxs)(i.Zb,(0,a.Z)((0,t.Z)({sx:(0,t.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:j},void 0===b?null:b)},w),{children:[r?(0,s.jsx)(r,{radius:j}):null,u?(0,s.jsx)(u,{radius:j}):null,(0,s.jsxs)(c,{bg:y,background:C,sx:void 0===g?{}:g,withRadius:!p,children:[h?(0,s.jsx)(h,{}):null,S||null]}),p?(0,s.jsx)(c,{bg:y,background:C,sx:(0,t.Z)({},void 0!==f&&f?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===v?{}:v),radius:j,withRadius:!0,children:"object"==typeof p?p:(0,s.jsx)(p,{})}):null]}))}},24448:function(e,n,r){r.d(n,{M:function(){return z}});var t=r(22710),a=r(62230),l=r(85244),s=r(99267),i=r(52322),c=r(5632),o=r(2784),u=r(56580),d=r(75289),h=r(91061),x=r(88932),p=r(82770),f=r(6777),m=r(78656);function j(){return(j=(0,t.Z)(function(e){var n,r,t,a,l,i,c,o,u,d;return(0,s.__generator)(this,function(s){switch(s.label){case 0:n=e.id,r=e.label,t=e.repeatable,a=e.format,l=e.onSuccess,i=m.$[a],c=(0,h.Ue)({id:n,label:r,repeatable:t,format:a}),s.label=1;case 1:return s.trys.push([1,4,,5]),[4,(0,p.KA)(c)];case 2:if((o=s.sent().errors).length>0)throw o;return p.Xe.track({event:"custom-type:created",id:c.id,name:r,format:a,type:t?"repeatable":"single",origin:"table"}),[4,l(c)];case 3:return s.sent(),x.Am.success((0,f.GX)({message:"".concat(i.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(c.id,"/index.json")})),[3,5];case 4:return u=s.sent(),d="Internal Error: ".concat(i.name({start:!0,plural:!1})," not saved"),console.error(d,u),x.Am.error(d),[3,5];case 5:return[2]}})})).apply(this,arguments)}var g=r(67445),v=r(50950),b=r(6134),y=r(63094),C=r(17384),S=r(28849),w=r(90374),k=r(36960),Z=r(17064),T=r(63397),I=r(98240),_=function(e){var n=e.selected,r=(0,I.Z)(e,["selected"]);return(0,i.jsx)(d.kC,(0,a.Z)({sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:n?function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}:"none","&:hover":{boxShadow:function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}}}},r))},R=function(e){var n=e.format,r=(0,Z.Z)((0,T.U$)("repeatable"),3),t=r[0],a=r[2],l=m.$[n];return(0,i.jsxs)(d.xu,{mb:2,children:[(0,i.jsxs)(_,{selected:t.value,onClick:function(){return a.setValue(!0)},children:[(0,i.jsx)(d.Y8,{checked:t.value,onChange:function(){},"data-testid":"repeatable-type-radio-btn"}),(0,i.jsxs)(d.xu,{sx:{marginLeft:2},children:["Reusable type",(0,i.jsx)(d.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:l.hintRepeatable})]})]}),(0,i.jsxs)(_,{selected:!t.value,onClick:function(){return a.setValue(!1)},children:[(0,i.jsx)(d.Y8,{checked:!t.value,onChange:function(){},"data-testid":"single-type-radio-btn"}),(0,i.jsxs)(d.xu,{sx:{marginLeft:2},children:["Single type",(0,i.jsx)(d.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:l.hintSingle})]})]})]})},z=function(e){var n,r=e.format,x=e.isCreating,p=e.isOpen,f=e.origin,Z=void 0===f?"table":f,T=e.onCreateChange,I=e.onOpenChange,_=(0,w.Z)().createCustomTypeSuccess,z=(0,u.v9)(function(e){return{customTypeIds:(0,S.W6)(e),customTypeLabels:(0,S.YS)(e)}}),L=z.customTypeIds,N=z.customTypeLabels,A=m.$[r],D=(0,o.useState)(!0),M=D[0],O=D[1],P=(0,v.g)().syncChanges,V=(0,c.useRouter)(),B=(n=(0,t.Z)(function(e){var n,a,l;return(0,s.__generator)(this,function(i){switch(i.label){case 0:var c;return n=e.id,a=e.label,l=e.repeatable,T(!0),[4,function(e){return j.apply(this,arguments)}({format:r,id:n,label:a,origin:Z,repeatable:l,onSuccess:(c=(0,t.Z)(function(e){var r,t;return(0,s.__generator)(this,function(a){switch(a.label){case 0:return _(e),r=(0,h.y6)(e),t=g.cd[r],O(!0),[4,V.push({pathname:t.getBuilderPagePathname(n),query:"page"===e.format?{newPageType:!0}:void 0})];case 1:return a.sent(),P(),[2]}})}),function(e){return c.apply(this,arguments)})})];case 1:return i.sent(),T(!1),I(!1),[2]}})}),function(e){return n.apply(this,arguments)}),E=function(e,n,r){r(M?(0,l.Z)((0,a.Z)({},n),{label:e.target.value,id:(0,C.lV)(e.target.value)}):(0,l.Z)((0,a.Z)({},n),{label:e.target.value}))},$=function(e,n){n("id",e.target.value),O(!1)};return(0,i.jsx)(b.Z,{testId:"create-ct-modal",isOpen:p,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:function(){I(!1),O(!0)},onSubmit:function(e){B(e)},isLoading:x,initialValues:{repeatable:!0,id:"",label:""},validate:function(e){var n=e.id,r=e.label,t={};return r&&r.length||(t.label="Cannot be empty."),!t.label&&N.includes(r)&&(t.label="".concat(A.name({start:!0,plural:!1})," name is already taken.")),n&&n.length||(t.id="ID cannot be empty."),t.id||!n||y.xo.exec(n)||(t.id="Invalid id: No special characters allowed."),!t.id&&n&&L.map(function(e){return e.toLowerCase()}).includes(n)&&(t.id='ID "'.concat(n,'" exists already.')),Object.keys(t).length>0?t:void 0},content:{title:"Create a new ".concat(A.name({start:!1,plural:!1}))},children:function(e){var n=e.errors,t=e.setValues,a=e.setFieldValue,l=e.values,s=e.touched;return(0,i.jsxs)(d.xu,{children:[(0,i.jsx)(R,{format:r}),(0,i.jsx)(k.W,{name:"label",label:"".concat(A.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(A.name({start:!1,plural:!1})),error:s.label?n.label:void 0,onChange:function(e){return E(e,l,t)}}),(0,i.jsx)(k.W,{name:"id",testId:"ct-id-input",label:"".concat(A.name({start:!0,plural:!1})," ID"),placeholder:A.inputPlaceholder,error:s.id?n.id:void 0,onChange:function(e){return $(e,a)}})]})}})}},63094:function(e,n,r){r.d(n,{Sn:function(){return i},lS:function(){return t},nG:function(){return a},pq:function(){return c},rd:function(){return s},xo:function(){return l}});var t=["components"],a=["png","jpg","jpeg"],l=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,s="placeholders/What_are_Slices_mrvome",i="SM_HELP_VIDEOS/mock_data",c="slice-machine-simulator"}}]);
|