slice-machine-ui 2.19.2-alpha.jp-figma-to-slice-2.1 → 2.19.2-alpha.jp-figma-to-slice-2.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/Wmps-QiwWdxiaXbaHHRvL/_buildManifest.js +1 -0
- package/out/_next/static/chunks/{489-b4b2ce029ea444c1.js → 489-32281540712d98bb.js} +1 -1
- package/out/_next/static/chunks/{593-97393b59cba3d429.js → 593-7ffd1197c3405ef8.js} +1 -1
- package/out/_next/static/chunks/633-275b9968b5aaa920.js +1 -0
- package/out/_next/static/chunks/882-48d61b2fabee28d8.js +1 -0
- package/out/_next/static/chunks/pages/{_app-1d7a014f4b9c9714.js → _app-ea98f69a500733ed.js} +1 -1
- package/out/_next/static/chunks/pages/{changes-b3f45dfeb5dc08f0.js → changes-e66094f57453cf9c.js} +1 -1
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-02278526092bcf5c.js → [customTypeId]-6d613b67e6967ae5.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-4d99de1b52de7c9b.js → [pageTypeId]-40207b66190e3fcd.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-330e5d545d9f6269.js → [variation]-22ffa2561ac66557.js} +1 -1
- package/out/_next/static/chunks/pages/{slices-de5f8cf4719e88c4.js → slices-a9b4d6d022cfcd88.js} +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/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/customTypesBuilder/CreateSliceFromImageModal/CreateSliceFromImageModal.tsx +2 -4
- package/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/SliceCard.tsx +2 -2
- package/src/icons/FigmaIcon.tsx +6 -61
- package/src/icons/FigmaIconSquare.tsx +45 -0
- package/src/legacy/components/ScreenshotChangesModal/index.tsx +2 -2
- package/out/_next/static/chunks/20-169231cb23a752ff.js +0 -1
- package/out/_next/static/chunks/907-ed8b6f8bf21b1e5d.js +0 -1
- package/out/_next/static/fXaiB7Mqn_2CEdnnVaEyz/_buildManifest.js +0 -1
- /package/out/_next/static/{fXaiB7Mqn_2CEdnnVaEyz → Wmps-QiwWdxiaXbaHHRvL}/_ssgManifest.js +0 -0
|
@@ -3,7 +3,7 @@ import { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
|
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
import { Card, CardFooter, CardMedia } from "@/components/Card";
|
|
6
|
-
import {
|
|
6
|
+
import { FigmaIconSquare } from "@/icons/FigmaIconSquare";
|
|
7
7
|
|
|
8
8
|
interface SliceCardProps {
|
|
9
9
|
slice: Slice;
|
|
@@ -33,7 +33,7 @@ export function SliceCard(props: SliceCardProps) {
|
|
|
33
33
|
} else if (slice.source === "figma") {
|
|
34
34
|
action = (
|
|
35
35
|
<Tooltip content="Pasted from Figma">
|
|
36
|
-
<
|
|
36
|
+
<FigmaIconSquare />
|
|
37
37
|
</Tooltip>
|
|
38
38
|
);
|
|
39
39
|
}
|
package/src/icons/FigmaIcon.tsx
CHANGED
|
@@ -1,64 +1,10 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, forwardRef } from "react";
|
|
1
|
+
import { ComponentPropsWithoutRef, ElementRef, forwardRef } from "react";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const FigmaIcon = forwardRef<SVGSVGElement, Props>((props, ref) => {
|
|
10
|
-
const { variant } = props;
|
|
11
|
-
if (variant === "square") {
|
|
12
|
-
const { size = 24, ...rest } = props;
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<svg
|
|
16
|
-
ref={ref}
|
|
17
|
-
viewBox="0 0 24 24"
|
|
18
|
-
fill="none"
|
|
19
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
-
width={size}
|
|
21
|
-
height={size}
|
|
22
|
-
{...rest}
|
|
23
|
-
>
|
|
24
|
-
<g clipPath="url(#clip0_5065_192538)">
|
|
25
|
-
<path
|
|
26
|
-
d="M9.66862 19.9993C11.1406 19.9993 12.3353 18.8047 12.3353 17.3327V14.666H9.66862C8.19662 14.666 7.00195 15.8607 7.00195 17.3327C7.00195 18.8047 8.19662 19.9993 9.66862 19.9993Z"
|
|
27
|
-
fill="#0ACF83"
|
|
28
|
-
/>
|
|
29
|
-
<path
|
|
30
|
-
d="M7.00195 12.0007C7.00195 10.5287 8.19662 9.33398 9.66862 9.33398H12.3353V14.6673H9.66862C8.19662 14.6673 7.00195 13.4727 7.00195 12.0007Z"
|
|
31
|
-
fill="#A259FF"
|
|
32
|
-
/>
|
|
33
|
-
<path
|
|
34
|
-
d="M7.00195 6.66667C7.00195 5.19467 8.19662 4 9.66862 4H12.3353V9.33333H9.66862C8.19662 9.33333 7.00195 8.13867 7.00195 6.66667Z"
|
|
35
|
-
fill="#F24E1E"
|
|
36
|
-
/>
|
|
37
|
-
<path
|
|
38
|
-
d="M12.334 4H15.0007C16.4727 4 17.6673 5.19467 17.6673 6.66667C17.6673 8.13867 16.4727 9.33333 15.0007 9.33333H12.334V4Z"
|
|
39
|
-
fill="#FF7262"
|
|
40
|
-
/>
|
|
41
|
-
<path
|
|
42
|
-
d="M17.6673 12.0007C17.6673 13.4727 16.4727 14.6673 15.0007 14.6673C13.5287 14.6673 12.334 13.4727 12.334 12.0007C12.334 10.5287 13.5287 9.33398 15.0007 9.33398C16.4727 9.33398 17.6673 10.5287 17.6673 12.0007Z"
|
|
43
|
-
fill="#1ABCFE"
|
|
44
|
-
/>
|
|
45
|
-
</g>
|
|
46
|
-
<defs>
|
|
47
|
-
<clipPath id="clip0_5065_192538">
|
|
48
|
-
<rect
|
|
49
|
-
width="10.6688"
|
|
50
|
-
height="16"
|
|
51
|
-
fill="white"
|
|
52
|
-
transform="translate(7 4)"
|
|
53
|
-
/>
|
|
54
|
-
</clipPath>
|
|
55
|
-
</defs>
|
|
56
|
-
</svg>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// eslint-disable-next-line prefer-const
|
|
61
|
-
let { width, height, ...rest } = props;
|
|
3
|
+
export const FigmaIcon = forwardRef<
|
|
4
|
+
ElementRef<"svg">,
|
|
5
|
+
ComponentPropsWithoutRef<"svg">
|
|
6
|
+
>((props, ref) => {
|
|
7
|
+
let { width, height } = props;
|
|
62
8
|
if (width === undefined && height === undefined) {
|
|
63
9
|
width = 10;
|
|
64
10
|
height = 16;
|
|
@@ -72,7 +18,6 @@ export const FigmaIcon = forwardRef<SVGSVGElement, Props>((props, ref) => {
|
|
|
72
18
|
xmlns="http://www.w3.org/2000/svg"
|
|
73
19
|
height={height}
|
|
74
20
|
width={width}
|
|
75
|
-
{...rest}
|
|
76
21
|
>
|
|
77
22
|
<path
|
|
78
23
|
d="M5 7.83323C5 6.45253 6.11928 5.33325 7.49997 5.33325C8.8807 5.33325 10 6.45255 10 7.83328V8.16656C10 9.54728 8.8807 10.6666 7.49997 10.6666C6.11928 10.6666 5 9.54731 5 8.16661V7.83323Z"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { FC, SVGProps } from "react";
|
|
2
|
+
|
|
3
|
+
export const FigmaIconSquare: FC<SVGProps<SVGSVGElement>> = (props) => (
|
|
4
|
+
<svg
|
|
5
|
+
width="24"
|
|
6
|
+
height="24"
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
fill="none"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<g clipPath="url(#clip0_5065_192538)">
|
|
13
|
+
<path
|
|
14
|
+
d="M9.66862 19.9993C11.1406 19.9993 12.3353 18.8047 12.3353 17.3327V14.666H9.66862C8.19662 14.666 7.00195 15.8607 7.00195 17.3327C7.00195 18.8047 8.19662 19.9993 9.66862 19.9993Z"
|
|
15
|
+
fill="#0ACF83"
|
|
16
|
+
/>
|
|
17
|
+
<path
|
|
18
|
+
d="M7.00195 12.0007C7.00195 10.5287 8.19662 9.33398 9.66862 9.33398H12.3353V14.6673H9.66862C8.19662 14.6673 7.00195 13.4727 7.00195 12.0007Z"
|
|
19
|
+
fill="#A259FF"
|
|
20
|
+
/>
|
|
21
|
+
<path
|
|
22
|
+
d="M7.00195 6.66667C7.00195 5.19467 8.19662 4 9.66862 4H12.3353V9.33333H9.66862C8.19662 9.33333 7.00195 8.13867 7.00195 6.66667Z"
|
|
23
|
+
fill="#F24E1E"
|
|
24
|
+
/>
|
|
25
|
+
<path
|
|
26
|
+
d="M12.334 4H15.0007C16.4727 4 17.6673 5.19467 17.6673 6.66667C17.6673 8.13867 16.4727 9.33333 15.0007 9.33333H12.334V4Z"
|
|
27
|
+
fill="#FF7262"
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
d="M17.6673 12.0007C17.6673 13.4727 16.4727 14.6673 15.0007 14.6673C13.5287 14.6673 12.334 13.4727 12.334 12.0007C12.334 10.5287 13.5287 9.33398 15.0007 9.33398C16.4727 9.33398 17.6673 10.5287 17.6673 12.0007Z"
|
|
31
|
+
fill="#1ABCFE"
|
|
32
|
+
/>
|
|
33
|
+
</g>
|
|
34
|
+
<defs>
|
|
35
|
+
<clipPath id="clip0_5065_192538">
|
|
36
|
+
<rect
|
|
37
|
+
width="10.6688"
|
|
38
|
+
height="16"
|
|
39
|
+
fill="white"
|
|
40
|
+
transform="translate(7 4)"
|
|
41
|
+
/>
|
|
42
|
+
</clipPath>
|
|
43
|
+
</defs>
|
|
44
|
+
</svg>
|
|
45
|
+
);
|
|
@@ -5,7 +5,7 @@ import { useSelector } from "react-redux";
|
|
|
5
5
|
import { Box, Close, Flex, Heading, Text } from "theme-ui";
|
|
6
6
|
|
|
7
7
|
import { Kbd } from "@/components/Kbd";
|
|
8
|
-
import {
|
|
8
|
+
import { FigmaIconSquare } from "@/icons/FigmaIconSquare";
|
|
9
9
|
import { Card, useCardRadius } from "@/legacy/components/Card";
|
|
10
10
|
import SliceMachineModal from "@/legacy/components/SliceMachineModal";
|
|
11
11
|
import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
|
|
@@ -52,7 +52,7 @@ const FigmaTip = () => {
|
|
|
52
52
|
minHeight: "40px",
|
|
53
53
|
}}
|
|
54
54
|
>
|
|
55
|
-
<
|
|
55
|
+
<FigmaIconSquare />
|
|
56
56
|
<div>
|
|
57
57
|
Use {keys} to copy any frame as .png, then just paste it here
|
|
58
58
|
</div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[20],{62434:function(e,t,n){"use strict";n.d(t,{Zb:function(){return c},T$:function(){return C},eW:function(){return h},ZB:function(){return u},Lm:function(){return m}});var o=n(52322),r=n(50002),i=n(11699),a=n(6277),l=n(2784),d=n(67968),s=n.n(d);let c=e=>{let{checked:t=!1,size:n="medium",variant:i="solid",interactive:d,disabled:c,onClick:u,href:C,component:h="a",replace:m,..._}=e,x={..._,className:(0,a.W)(s().root,s()["size-".concat(n)],s()[i],{[s().interactive]:e.interactive}),"data-state":!0===t?"checked":void 0,"data-disabled":!0===e.disabled?"":void 0};return!0===e.interactive&&void 0===e.href?(0,o.jsx)("div",{...x,onClick:t=>{if(!0===e.disabled||void 0===e.onClick)return;let n=t.target;(0,r.JY)(n)===t.currentTarget&&e.onClick(t)},tabIndex:!0===e.disabled?void 0:0}):!0===e.interactive?(0,l.createElement)(h,{...x,href:e.href,onClick:e=>{let t=e.target;(0,r.JY)(t)!==e.currentTarget&&e.preventDefault()},..."a"===h?{}:{replace:e.replace}}):(0,o.jsx)("div",{...x})},u=e=>{let{className:t,component:n="img",overlay:r,...i}=e;return(0,o.jsxs)("div",{className:s().media,children:[(0,l.createElement)(n,{...i,className:(0,a.W)(s()["mediaComponent-".concat(n)],t)}),r?(0,o.jsx)("div",{className:s().mediaOverlay,children:r}):void 0]})},C=e=>(0,o.jsx)("div",{...e,className:s().actions}),h=e=>{let{action:t,loading:n=!1,startIcon:r,subtitle:a,title:l,error:d=!1,...c}=e,u=d?"tomato11":"grey11";return(0,o.jsxs)("div",{...c,className:s().footer,children:[(r||n)&&(0,o.jsxs)("div",{className:s().startIconBox,children:[n&&(0,o.jsx)(i.bg,{color:"grey11"}),!n&&r&&(0,o.jsx)(i.aX,{name:r,size:"small",color:u})]}),(0,o.jsxs)("div",{className:s().footerTexts,children:[(0,o.jsx)(i.bL,{component:"span",noWrap:!0,variant:"bold",children:l}),(0,o.jsx)(i.bL,{color:u,component:"span",noWrap:!0,variant:"small",children:a})]}),t]})},m=e=>{let{children:t,...n}=e;return(0,o.jsx)("div",{...n,className:s().status,children:(0,o.jsx)(i.bL,{align:"center",color:"inherit",component:"span",noWrap:!0,variant:"smallBold",children:t})})}},99195:function(e,t,n){"use strict";n.d(t,{O:function(){return l}});var o=n(52322),r=n(11699),i=n(56448),a=n(93671);let l=e=>{let{badgeColor:t,badgeTitle:n,tooltipContent:l}=function(e){let t=d[e.modelType];switch(e.modelStatus){case i.GJ.New:return{badgeColor:"green",badgeTitle:"New",tooltipContent:"This ".concat(t," exists only locally. Upon sync, it will be pushed to your remote repository.")};case i.GJ.Modified:return{badgeColor:"amber",badgeTitle:"Modified",tooltipContent:"This ".concat(t," has been modified locally. Upon sync, changes will be pushed to your remote repository.")};case i.GJ.Synced:return{badgeColor:"purple",badgeTitle:"Synced",tooltipContent:"This ".concat(t," is in sync with the remote repository.")};case i.GJ.Deleted:return{badgeColor:"tomato",badgeTitle:"Deleted",tooltipContent:"This ".concat(t," has been deleted locally.")};case i.GJ.Unknown:if(!e.isOnline)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (no internet connection)."};if(e.authStatus===a.t.UNAUTHENTICATED)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (not connected to Prismic)."};default:return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (unknown error)."}}}(e);return(0,o.jsx)(r.c3,{content:l,side:"bottom",children:(0,o.jsx)(r.m,{color:t,title:n})})},d={CustomType:"type",Slice:"slice"}},51507:function(e,t,n){"use strict";n.d(t,{b:function(){return _}});var o=n(52322),r=n(11699),i=n(39097),a=n.n(i),l=n(62434),d=n(63908),s=n(99195),c=n(27763);let u=e=>(0,o.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 5.5C4 4.67157 4.67157 4 5.5 4H18.5C19.3284 4 20 4.67157 20 5.5V12.4413C20 12.4512 19.9997 12.461 19.9991 12.4707C20.0072 12.6083 19.9586 12.7485 19.8536 12.8536C19.6583 13.0488 19.3417 13.0488 19.1464 12.8536L16.3536 10.0607C16.1583 9.8654 15.8417 9.8654 15.6464 10.0607L11.8536 13.8536C11.6583 14.0488 11.3417 14.0488 11.1464 13.8536L9.35355 12.0607C9.15829 11.8654 8.84171 11.8654 8.64645 12.0607L5 15.7071V18.5C5 18.7761 5.22386 19 5.5 19H12.5C12.7761 19 13 19.2239 13 19.5C13 19.7761 12.7761 20 12.5 20H5.5C4.67157 20 4 19.3284 4 18.5V15.5003V15.4997V5.5ZM11.5 12.7929L14.9393 9.35355C15.5251 8.76777 16.4749 8.76777 17.0607 9.35355L19 11.2929V5.5C19 5.22386 18.7761 5 18.5 5H5.5C5.22386 5 5 5.22386 5 5.5V14.2929L7.93934 11.3536C8.52513 10.7678 9.47487 10.7678 10.0607 11.3536L11.5 12.7929ZM16.5 13C16.7761 13 17 13.2239 17 13.5V16H19.5C19.7761 16 20 16.2239 20 16.5C20 16.7761 19.7761 17 19.5 17H17V19.5C17 19.7761 16.7761 20 16.5 20C16.2239 20 16 19.7761 16 19.5V17H13.5C13.2239 17 13 16.7761 13 16.5C13 16.2239 13.2239 16 13.5 16H16V13.5C16 13.2239 16.2239 13 16.5 13Z",fill:"currentColor"})}),C=e=>({hash:e.hash}),h=e=>e?Object.entries(e).reduce((e,t)=>{let[n,o]=t;return o.hash?{...e,[n]:{...o,...C(o)}}:e},{}):{},m={build:e=>({...e,screenshots:h(e.screenshots)}),variation(e,t){if(e.model.variations.length)return t?e.model.variations.find(e=>e.id===t):e.model.variations[0]}},_=e=>{let t;let{action:n,isDeleted:i=!1,onUpdateScreenshot:C,selected:h=!1,slice:_,variant:v,variationId:f}=e,b=m.variation(_,f);if(!b)return null;let g=(0,d.d7)(_,b),j=!i&&!!C,y="outlined"===v,w=void 0!==f;return t="selection"===e.mode?{disabled:i,interactive:!0,onClick:()=>{e.onSelectedChange(!h)}}:i?{interactive:!1}:{component:a(),href:c.Y.getBuilderPagePathname({libraryName:_.href,sliceName:_.model.name,variationId:b.id}),interactive:!0,replace:e.replace},(0,o.jsxs)(l.Zb,{"aria-label":"".concat(_.model.name," ").concat(b.name," slice card"),checked:h,"data-testid":"shared-slice-card",...t,..."outlined"===v?{size:"small",variant:"outlined"}:{},children:[void 0!==g?(0,o.jsx)(l.ZB,{alt:"Preview image",overlay:j&&!y?(0,o.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,o.jsx)(x,{onClick:C})}):void 0,src:g}):(0,o.jsx)(l.ZB,{component:"div",children:(0,o.jsxs)(r.D,{alignItems:"center",flexDirection:"column",gap:8,justifyContent:"center",children:[(0,o.jsx)(r.bL,{color:"grey11",component:"span",children:"No screenshot available"}),j&&!y?(0,o.jsx)(x,{onClick:C}):void 0]})}),(0,o.jsx)(l.eW,{action:"checkbox"===n.type&&"selection"===e.mode?(0,o.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,o.jsx)(r.U,{checked:h,disabled:i,onCheckedChange:e.onSelectedChange})}):"menu"===n.type?(0,o.jsxs)(r.ar,{modal:!0,children:[(0,o.jsx)(r.av,{disabled:i,children:(0,o.jsx)(r.aZ,{hiddenLabel:"Slice actions",icon:"moreVert"})}),(0,o.jsxs)(r.as,{align:"end","data-testid":"slice-action-icon-dropdown",children:[j&&y?(0,o.jsx)(r.at,{onSelect:C,startIcon:(0,o.jsx)(u,{}),children:"Update screenshot"}):void 0,(0,o.jsx)(r.at,{onSelect:n.onRename,startIcon:(0,o.jsx)(r.aX,{name:"edit"}),children:"Rename"}),!0===n.removeDisabled&&w?(0,o.jsx)(r.c3,{content:"The slice needs to have at least one variation.",side:"bottom",stableMount:!0,children:(0,o.jsx)(p,{disabled:!0,onSelect:n.onRemove})}):(0,o.jsx)(p,{disabled:!0===n.removeDisabled,onSelect:n.onRemove})]})]}):"remove"===n.type?(0,o.jsx)(r.aZ,{icon:"close",onClick:()=>!i&&n.onRemove(),hiddenLabel:"Remove slice"}):"status"===n.type?(0,o.jsx)(s.O,{authStatus:n.authStatus,isOnline:n.isOnline,modelStatus:n.modelStatus,modelType:"Slice"}):void 0,subtitle:(0,o.jsx)(o.Fragment,{children:w?b.id:"".concat(_.model.variations.length," variation").concat(_.model.variations.length>1?"s":"")}),title:w?b.name:_.model.name}),j&&!w&&(0,d.cx)(_)>0?(0,o.jsx)(l.Lm,{children:"Missing screenshot"}):void 0]})},x=e=>(0,o.jsx)(r.E,{onClick:e.onClick,renderStartIcon:()=>(0,o.jsx)(u,{color:r.t.color.grey11}),color:"grey",children:"Update screenshot"}),p=e=>(0,o.jsx)(r.at,{...e,color:"tomato",startIcon:(0,o.jsx)(r.aX,{name:"delete"}),children:"Delete"})},27763:function(e,t,n){"use strict";n.d(t,{Y:function(){return o}});let o={getBuilderPagePathname:e=>"/slices/".concat(e.libraryName.replaceAll("/","--"),"/").concat(e.sliceName,"/").concat(e.variationId)}},42828:function(e,t,n){"use strict";n.d(t,{Y:function(){return r}});var o=n(52322);let r=(0,n(2784).forwardRef)((e,t)=>{let{variant:n}=e;if("square"===n){let{size:n=24,...r}=e;return(0,o.jsxs)("svg",{ref:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:n,height:n,...r,children:[(0,o.jsxs)("g",{clipPath:"url(#clip0_5065_192538)",children:[(0,o.jsx)("path",{d:"M9.66862 19.9993C11.1406 19.9993 12.3353 18.8047 12.3353 17.3327V14.666H9.66862C8.19662 14.666 7.00195 15.8607 7.00195 17.3327C7.00195 18.8047 8.19662 19.9993 9.66862 19.9993Z",fill:"#0ACF83"}),(0,o.jsx)("path",{d:"M7.00195 12.0007C7.00195 10.5287 8.19662 9.33398 9.66862 9.33398H12.3353V14.6673H9.66862C8.19662 14.6673 7.00195 13.4727 7.00195 12.0007Z",fill:"#A259FF"}),(0,o.jsx)("path",{d:"M7.00195 6.66667C7.00195 5.19467 8.19662 4 9.66862 4H12.3353V9.33333H9.66862C8.19662 9.33333 7.00195 8.13867 7.00195 6.66667Z",fill:"#F24E1E"}),(0,o.jsx)("path",{d:"M12.334 4H15.0007C16.4727 4 17.6673 5.19467 17.6673 6.66667C17.6673 8.13867 16.4727 9.33333 15.0007 9.33333H12.334V4Z",fill:"#FF7262"}),(0,o.jsx)("path",{d:"M17.6673 12.0007C17.6673 13.4727 16.4727 14.6673 15.0007 14.6673C13.5287 14.6673 12.334 13.4727 12.334 12.0007C12.334 10.5287 13.5287 9.33398 15.0007 9.33398C16.4727 9.33398 17.6673 10.5287 17.6673 12.0007Z",fill:"#1ABCFE"})]}),(0,o.jsx)("defs",{children:(0,o.jsx)("clipPath",{id:"clip0_5065_192538",children:(0,o.jsx)("rect",{width:"10.6688",height:"16",fill:"white",transform:"translate(7 4)"})})})]})}let{width:r,height:i,...a}=e;return void 0===r&&void 0===i&&(r=10,i=16),(0,o.jsxs)("svg",{ref:t,viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",height:i,width:r,...a,children:[(0,o.jsx)("path",{d:"M5 7.83323C5 6.45253 6.11928 5.33325 7.49997 5.33325C8.8807 5.33325 10 6.45255 10 7.83328V8.16656C10 9.54728 8.8807 10.6666 7.49997 10.6666C6.11928 10.6666 5 9.54731 5 8.16661V7.83323Z",fill:"#1ABCFE"}),(0,o.jsx)("path",{d:"M0 13.3334C0 11.8607 1.19391 10.6667 2.66667 10.6667H5V13.5001C5 14.8808 3.88071 16.0001 2.5 16.0001C1.11929 16.0001 0 14.8808 0 13.5001L0 13.3334Z",fill:"#0ACF83"}),(0,o.jsx)("path",{d:"M5 0V5.33333H7.33333C8.80609 5.33333 10 4.13943 10 2.66667C10 1.19391 8.80609 0 7.33333 0L5 0Z",fill:"#FF7262"}),(0,o.jsx)("path",{d:"M0 2.66659C0 4.13934 1.19391 5.33325 2.66667 5.33325L5 5.33325L5 -8.15392e-05L2.66667 -8.15392e-05C1.19391 -8.15392e-05 0 1.19383 0 2.66659Z",fill:"#F24E1E"}),(0,o.jsx)("path",{d:"M0 8.00008C0 9.47284 1.19391 10.6667 2.66667 10.6667H5L5 5.33341L2.66667 5.33341C1.19391 5.33341 0 6.52732 0 8.00008Z",fill:"#A259FF"})]})})},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},W:function(){return d}});var o=n(52322),r=n(2784),i=n(75289);let a=e=>{let{bg:t,background:n,sx:r,withRadius:a,radius:l,children:d}=e;return(0,o.jsx)(i.xu,{sx:{p:4,bg:t||n,...a?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,...r},children:d})},l=(0,r.createContext)("6px"),d=()=>(0,r.useContext)(l),s=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:d=null,borderFooter:s=!1,radius:c="6px",bodySx:u={},footerSx:C={},sx:h=null,bg:m,background:_,children:x,...p}=e;return(0,o.jsx)(l.Provider,{value:c,children:(0,o.jsxs)(i.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:c,...h},...p,children:[t||null,n||null,(0,o.jsxs)(a,{bg:m,background:_,sx:u,withRadius:!d,children:[r?(0,o.jsx)(r,{}):null,x||null]}),d?(0,o.jsx)(a,{bg:m,background:_,sx:{...s?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...C},radius:c,withRadius:!0,children:"object"==typeof d?d:(0,o.jsx)(d,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return l},lS:function(){return o},nG:function(){return r},pq:function(){return d},rd:function(){return a},xo:function(){return i}});let o=["components","update","insert"],r=["png","jpg","jpeg"],i=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,a="placeholders/What_are_Slices_mrvome",l="SM_HELP_VIDEOS/mock_data",d="slice-machine-simulator"},67968:function(e){e.exports={flex:"Card_flex__opby1",grid:"Card_grid__VAvIS",column:"Card_column__W4ACG Card_flex__opby1",root:"Card_root__YVuvU Card_column__W4ACG Card_flex__opby1","size-small":"Card_size-small__aIlxd","size-medium":"Card_size-medium__xegz0",solid:"Card_solid__GNGar",outlined:"Card_outlined__W_dxI",interactive:"Card_interactive__rXw5L",media:"Card_media__l0kHL Card_column__W4ACG Card_flex__opby1","mediaComponent-div":"Card_mediaComponent-div__Y2_PZ Card_grid__VAvIS","mediaComponent-img":"Card_mediaComponent-img__ezOTu",mediaOverlay:"Card_mediaOverlay__Aa__Q Card_grid__VAvIS",nonMedia:"Card_nonMedia__Fv3Mz Card_flex__opby1",actions:"Card_actions__XdhOt Card_nonMedia__Fv3Mz Card_flex__opby1",footer:"Card_footer__U0HS1 Card_nonMedia__Fv3Mz Card_flex__opby1",footerTexts:"Card_footerTexts__rTXup Card_column__W4ACG Card_flex__opby1",status:"Card_status__PNN2a Card_column__W4ACG Card_flex__opby1",startIconBox:"Card_startIconBox__1_L4u"}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[907],{91589:function(e,a,t){t.d(a,{S:function(){return j}});var r=t(52322),i=t(11699),n=t(2784),l=t(76473),s=t(88932),o=t(30195),c=t(94160),d=t(34166),u=t(98250),m=t(68968),g=t(96317),p=t(42828),h=t(80148),f=t(54597),x=t(62434);function y(e){let a;let{slice:t}=e,n="uploading"===t.status||"generating"===t.status,l="uploadError"===t.status||"generateError"===t.status,s="pending"===t.status||"generateError"===t.status||"generating"===t.status||"success"===t.status;return l?a=(0,r.jsx)(i.E,{startIcon:"refresh",color:"grey",onClick:t.onRetry,children:"Retry"}):"figma"===t.source&&(a=(0,r.jsx)(i.c3,{content:"Pasted from Figma",children:(0,r.jsx)(p.Y,{variant:"square"})})),(0,r.jsxs)(x.Zb,{disabled:n,children:[s?(0,r.jsx)(x.ZB,{src:t.thumbnailUrl}):(0,r.jsx)(x.ZB,{component:"div"}),(0,r.jsx)(x.eW,{loading:n,startIcon:function(e){switch(e){case"uploadError":case"generateError":return"close";case"pending":return"image";case"success":return"check";default:return}}(t.status),title:"success"===t.status?t.model.name:"figma"===t.source?t.image.name.split(".")[0]:t.image.name,subtitle:function(e){switch(e.status){case"uploading":return"Uploading...";case"pending":var a;return(a=e.image.size)<1024?"".concat(a," B"):a<1048576?"".concat((a/1024).toFixed(1)," kB"):"".concat((a/1048576).toFixed(1)," MB");case"uploadError":return"Unable to upload image";case"generating":return"Generating...";case"generateError":return"Something went wrong";case"success":return"Generated"}}(t),error:l,action:a})]})}let b=o.z.object({__type:o.z.literal("figma-to-prismic/clipboard-data"),name:o.z.string(),image:o.z.string().startsWith("data:image/")});function j(e){let{open:a,location:t,onSuccess:o,onClose:g}=e,[x,j]=(0,n.useState)([]),[I,F]=(0,n.useState)(!1),{syncChanges:k}=(0,m.g)(),{createSliceSuccess:A}=(0,f.Z)(),{completeStep:D}=(0,u.k)(),L=function(e){let{open:a}=e,t=(0,n.useRef)([]);return(0,n.useEffect)(()=>{a&&(t.current=[],h.managerClient.slices.readAllSlices().then(e=>{t.current=e.models.map(e=>{let{model:a}=e;return a})}).catch(()=>null))},[a]),t}({open:a}),U=C(),{libraryID:E,isLoading:N}=function(){let[e,a]=(0,n.useState)();return(0,n.useEffect)(()=>{h.managerClient.project.getSliceMachineConfig().then(e=>{var t;let r=null==e?void 0:null===(t=e.libraries)||void 0===t?void 0:t[0];if(void 0===r)throw Error("No library found in the config.");a(r)}).catch(()=>{throw Error("Could not get library ID from the config.")})},[]),{libraryID:e,isLoading:void 0===e}}(),z=(0,n.useRef)(crypto.randomUUID());(0,l.y1)(["meta+v","ctrl+v"],e=>{e.preventDefault(),H()},{enabled:a&&U});let P=e=>{let{index:a,slice:t}=e;j(e=>e.map((e,r)=>r===a?t(e):e))},B=e=>{if(O)return;if(e.length>10){s.Am.error("You can only upload ".concat(10," images at a time."));return}let a=x.length;j(a=>[...a,...e.map(e=>({source:"upload",status:"uploading",image:e}))]),e.forEach((e,t)=>{R({index:a+t,image:e,source:"upload"})})},R=async e=>{let{index:a,image:t,source:r}=e,i=z.current;P({index:a,slice:e=>({...e,status:"uploading",image:t,source:r})});try{let e=await v({image:t});if(i!==z.current)return;P({index:a,slice:a=>({...a,status:"pending",thumbnailUrl:e})})}catch(e){if(i!==z.current)return;P({index:a,slice:e=>({...e,status:"uploadError",onRetry:()=>void R({index:a,image:t,source:r})})})}},G=async e=>{if(void 0===E)return;let{index:a,imageUrl:r,source:i}=e,n=z.current;P({index:a,slice:e=>({...e,status:"generating",thumbnailUrl:r})});try{let e=await h.managerClient.customTypes.inferSlice({source:i,libraryID:E,imageUrl:r});if(n!==z.current)return;let l=function(e){let{existingSlices:a,newSlices:t,slice:r}=e,i=new Set,n=new Set;for(let{id:e,name:t}of a)i.add(e),n.add(t.toLowerCase());for(let e of t)"success"===e.status&&(i.add(e.model.id),n.add(e.model.name.toLowerCase()));let l=r.id,s=2;for(;i.has(l);)l="".concat(r.id,"_").concat(s),s++;let o=r.name;for(s=2;n.has(o.toLowerCase());)o="".concat(r.name).concat(s),s++;return{...r,id:l,name:o}}({existingSlices:L.current,newSlices:x,slice:e.slice});if(j(t=>t.map((t,i)=>i!==a?t:{...t,status:"success",thumbnailUrl:r,model:l,langSmithUrl:e.langSmithUrl})),"upload"===i){n=z.current;let e=x[a],{errors:t}=await h.managerClient.slices.createSlice({libraryID:E,model:l});if(t.length)throw Error("Failed to create slice ".concat(l.id,"."));if(await h.managerClient.slices.updateSliceScreenshot({libraryID:E,sliceID:l.id,variationID:l.variations[0].id,data:e.image}),n!==z.current)return}D("createSlice"),c.Xe.track({event:"slice:created",id:l.id,name:l.name,library:E,location:t,mode:"ai",langSmithUrl:e.langSmithUrl}),(0,d.nZ)({type:"model",library:E,sliceId:l.id,variationId:l.variations[0].id,langSmithUrl:e.langSmithUrl})}catch(e){if(n!==z.current)return;P({index:a,slice:e=>({...e,status:"generateError",thumbnailUrl:r,onRetry:()=>{G({index:a,imageUrl:r,source:i})}})})}},T=()=>{void 0!==E&&x.forEach((e,a)=>{"pending"===e.status&&G({index:a,imageUrl:e.thumbnailUrl,source:e.source})})},_=x.filter(e=>"generating"===e.status).length+x.filter(e=>"uploading"===e.status).length,Z=x.filter(e=>"pending"===e.status).length,M=x.filter(e=>"success"===e.status).length,O=x.some(e=>"generating"===e.status||"success"===e.status),W=_+Z,Y=()=>{_>0||(g(),z.current=crypto.randomUUID(),setTimeout(()=>j([]),250))},V=async()=>{if(void 0!==E)try{F(!0);let e=await (0,c.y0)();A(e.libraries),k(),o({slices:x.flatMap(e=>"success"===e.status?e.model:[]),library:E}),Y()}finally{F(!1)}},H=async()=>{var e;if(!(!a||!U||x.some(e=>"figma"===e.source)||x.some(e=>"uploading"===e.status||"generating"===e.status))){if("function"!=typeof(null===(e=navigator.clipboard)||void 0===e?void 0:e.read)){s.Am.error("Clipboard paste is not supported in this browser.");return}try{let e=await navigator.clipboard.read();if(0===e.length){s.Am.error("No data found in clipboard.");return}let a="pasted-image.png",t=null,r=!1;for(let a of e){let e=a.types.find(e=>e.startsWith("image/"));if(void 0!==e){t=await a.getType(e);break}}for(let i of e)if(i.types.includes("text/plain"))try{let e=await i.getType("text/plain"),n=await e.text(),l=b.safeParse(JSON.parse(n));if(l.success){r=!0;let e=l.data;if(a="".concat(e.name,".png"),!t){let a=await fetch(e.image);t=await a.blob()}}else console.warn("Clipboard data validation failed:",l.error)}catch(e){console.warn("Failed to parse JSON from clipboard:",e)}if(!t){r?s.Am.error("Could not extract Figma data from clipboard. Please try copying again using the Prismic Figma plugin."):s.Am.error("No Figma data found in clipboard. Make sure you've copied a design using the Prismic Figma plugin.");return}let i=x.length;if(i>=10){s.Am.error("You can only upload ".concat(10," images at a time."));return}let n=new File([t],a,{type:t.type});j(e=>[...e,{source:"figma",status:"uploading",image:n}]),R({index:i,image:n,source:"figma"}),s.Am.success("Pasted ".concat(a).concat(r?" from Figma":""))}catch(e){console.error("Failed to paste from clipboard:",e),s.Am.error("Failed to paste from clipboard. Please check browser permissions and try again.")}}};return(0,r.jsxs)(i.ae,{open:a,onOpenChange:e=>!e&&Y(),children:[(0,r.jsx)(i.al,{title:"Generate with AI"}),(0,r.jsxs)(i.aj,{gap:0,children:[(0,r.jsx)(i.ak,{hidden:!0,children:"Upload images to generate slices with AI"}),N?(0,r.jsx)(i.D,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",children:(0,r.jsx)(i.bg,{color:"purple9"})}):(0,r.jsxs)(r.Fragment,{children:[0===x.length?(0,r.jsxs)(i.D,{padding:16,height:"100%",gap:16,display:"flex",flexDirection:"column",children:[U&&(0,r.jsxs)(i.D,{display:"flex",gap:16,alignItems:"center",backgroundColor:"grey2",padding:16,borderRadius:12,children:[(0,r.jsxs)(i.D,{display:"flex",gap:8,alignItems:"center",flexGrow:1,children:[(0,r.jsx)(i.D,{width:48,height:48,backgroundColor:"grey12",borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",children:(0,r.jsx)(p.Y,{variant:"original",height:25})}),(0,r.jsxs)(i.D,{display:"flex",flexDirection:"column",flexGrow:1,children:[(0,r.jsx)(i.bL,{variant:"bold",children:"Want to work faster?"}),(0,r.jsx)(i.bL,{variant:"small",color:"grey11",children:"Copy frames from Figma with the Slice Machine plugin and paste them here."})]})]}),(0,r.jsx)(i.E,{endIcon:"arrowForward",color:"indigo",onClick:()=>window.open("https://www.figma.com/community/plugin/TODO","_blank"),sx:{marginRight:8},invisible:!0,children:"Install plugin"})]}),(0,r.jsx)(i.aF,{onFilesSelected:B,assetType:"image",maxFiles:10,overlay:(0,r.jsx)(w,{onFilesSelected:B,onPaste:()=>void H(),droppingFiles:!0}),children:(0,r.jsx)(w,{onFilesSelected:B,onPaste:()=>void H()})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.D,{display:"flex",alignItems:"center",justifyContent:"space-between",padding:16,children:[(0,r.jsx)(i.bL,{variant:"h3",children:"Design"}),(0,r.jsx)(i.aG,{size:"medium",color:"grey",onFilesSelected:B,startIcon:"attachFile",disabled:O,children:"Add images"})]}),(0,r.jsx)(i.bn,{stableScrollbar:!1,children:(0,r.jsx)(i.D,{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:16,children:x.map((e,a)=>(0,r.jsx)(y,{slice:e},"slice-".concat(a)))})})]}),(0,r.jsxs)(i.ah,{children:[(0,r.jsx)(i.ai,{onClick:()=>Y(),size:"medium",disabled:_>0,sx:{marginRight:8},invisible:!0,children:"Close"}),0===M||_>0?(0,r.jsxs)(i.af,{color:"purple",startIcon:"autoFixHigh",onClick:()=>void T(),disabled:O||_>0||0===Z,loading:_>0,size:"medium",children:["Generate"," ",W>0?"(".concat(W,") "):"",1===W?"Slice":"Slices"]}):(0,r.jsx)(i.af,{color:"purple",onClick:()=>void V(),loading:I,size:"medium",children:S(t,M)})]})]})]})]})}function w(e){let{droppingFiles:a=!1,onFilesSelected:t,onPaste:n}=e,l=C();return(0,r.jsx)(i.D,{justifyContent:"center",flexDirection:"column",height:"100%",backgroundColor:a?"purple2":"grey2",border:!0,borderStyle:"dashed",borderColor:a?"purple9":"grey6",borderRadius:12,flexGrow:1,children:(0,r.jsx)(i.s,{children:(0,r.jsxs)(i.D,{display:"flex",flexDirection:"column",gap:16,alignItems:"center",children:[(0,r.jsx)(i.x,{lineColor:"purple11",backgroundColor:"purple5",name:"cloudUpload",size:"large"}),(0,r.jsx)(i.D,{display:"flex",flexDirection:"column",gap:4,alignItems:"center",children:l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.bL,{children:"Generate slices from your designs"}),(0,r.jsx)(i.bL,{variant:"small",color:"grey11",children:"Upload your design images or paste them directly from Figma."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.bL,{children:"Upload your design images."}),(0,r.jsx)(i.bL,{variant:"small",color:"grey11",children:"Once uploaded, you can generate slices automatically using AI."})]})}),(0,r.jsx)(i.D,{display:"flex",alignItems:"center",gap:16,children:l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.E,{size:"small",renderStartIcon:()=>(0,r.jsx)(p.Y,{variant:"original",height:16}),color:"grey",onClick:n,children:"Paste from Figma"}),(0,r.jsx)(i.aG,{size:"small",onFilesSelected:t,color:"purple",invisible:!0,children:"Add images"})]}):(0,r.jsx)(i.aG,{startIcon:"attachFile",onFilesSelected:t,color:"grey",children:"Add images"})})]})})})}async function v(e){let{image:a}=e,t=[await h.managerClient.project.getResolvedRepositoryName(),"shared-slices","prismic-inferred-slices",crypto.randomUUID()].join("/");await h.managerClient.screenshots.initS3ACL();let{url:r}=await h.managerClient.screenshots.uploadScreenshot({keyPrefix:t,data:a});return r}let S=(e,a)=>{switch(e){case"custom_type":return"Add to type (".concat(a,")");case"page_type":return"Add to page (".concat(a,")");case"slices":return"Done"}};function C(){let e=(0,g.L)("llm-proxy-access");return(null==e?void 0:e.value)==="on"}},27213:function(e,a,t){t.d(a,{F:function(){return n}});var r=t(52322),i=t(11699);let n=e=>{let{menuType:a}=e;return{fromImage:{BackgroundIcon:(0,r.jsx)(i.B,{name:"autoFixHigh",size:"ActionList"===a?"small":"extraSmall",iconSize:"ActionList"===a?"medium":"small",color:"purple",variant:"solid",radius:6}),title:"Generate from image",description:"Build a slice based on your design image."},fromScratch:{BackgroundIcon:(0,r.jsx)(i.B,{name:"add",size:"ActionList"===a?"small":"extraSmall",iconSize:"ActionList"===a?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Start from scratch",description:"Build a custom slice your way."},fromTemplate:{BackgroundIcon:(0,r.jsx)(i.B,{name:"contentCopy",size:"ActionList"===a?"small":"extraSmall",iconSize:"ActionList"===a?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Use a template",description:"Choose from ready-made examples."},fromExisting:{BackgroundIcon:(0,r.jsx)(i.B,{name:"folder",size:"ActionList"===a?"small":"extraSmall",iconSize:"ActionList"===a?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Reuse an existing slice",description:"Select from your created slices."}}}},6256:function(e,a,t){t.d(a,{c:function(){return b}});var r=t(52322),i=t(2784),n=t(36131),l=t(75289),s=t(94160),o=t(98250),c=t(88932),d=t(63908),u=t(358),m=t(80148);async function g(e){let{sliceName:a,libraryName:t,location:r,onSuccess:i}=e;try{let e=(0,d.fo)(a),{errors:n}=await m.managerClient.slices.createSlice({libraryID:t,model:e});if(n.length>0)throw n;s.Xe.track({event:"slice:created",id:(0,u.MP)(a),name:a,library:t,location:r,mode:"manual"}),await i(e)}catch(t){let e="An unexpected error happened while creating slice ".concat(a,".");console.error(e,t),c.Am.error(e)}}var p=t(68968),h=t(59532),f=t(54597),x=t(46999),y=t(63019);let b=e=>{let{onClose:a,onSuccess:t,localLibraries:c,location:d,remoteSlices:u}=e,{createSliceSuccess:m}=(0,f.Z)(),[b,j]=(0,i.useState)(!1),{syncChanges:w}=(0,p.g)(),{completeStep:v}=(0,o.k)(),S=async e=>{let a=e.sliceName,r=e.from;j(!0),await g({sliceName:a,libraryName:r,location:d,onSuccess:async e=>{m((await (0,s.y0)()).libraries),t(e,r),w(),v("createSlice")}})};return(0,r.jsx)(h.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:b,formId:"create-new-slice",close:a,buttonLabel:"Create",onSubmit:e=>{S(e)},initialValues:{sliceName:"",from:c[0].name},validate:e=>(0,y.h)(e,c,u),content:{title:"Create a new slice"},children:e=>{let{touched:a,values:t,setFieldValue:i,errors:s}=e;return(0,r.jsxs)(l.xu,{children:[(0,r.jsx)(x.W,{name:"sliceName",label:"Slice name",placeholder:"Pascalised slice API ID (e.g. TextBlock)",error:a.sliceName?s.sliceName:void 0,testId:"slice-name-input"}),(0,r.jsx)(l.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,r.jsx)(n.ZP,{name:"from",options:c.map(e=>({value:e.name,label:e.name})),onChange:e=>e?void i("from",e.value):null,defaultValue:{value:t.from,label:t.from},styles:{option:e=>({...e,color:"#161618"})},theme:e=>({...e,colors:{...e.colors,primary:"#E9E8EA"}}),menuPortalTarget:document.body})]})}})}},63019:function(e,a,t){t.d(a,{h:function(){return o}});var r=t(96009),i=t.n(r),n=t(74600),l=t.n(n),s=t(7974);function o(e,a,t){let{sliceName:r}=e;return r?s.lS.includes(r.toLowerCase())?{sliceName:'Name "'.concat(r,'" is reserved for Slice Machine use.')}:s.xo.exec(r)?l()(i()(r)).replace(/\s/gm,"")!==r.trim()?{sliceName:"Value has to be PascalCased."}:r.match(/^\d/)?{sliceName:"Value cannot start with a number."}:[...a.flatMap(e=>e.components.map(e=>e.model.name)),...t.map(e=>e.name)].includes(r)?{sliceName:"Slice name is already taken."}:void 0:{sliceName:"No special characters allowed."}:{sliceName:"Cannot be empty"}}},21151:function(e,a,t){var r=t(52322),i=t(75289);a.Z=function(e){let{elems:a,renderElem:t,defineElementKey:n,gridTemplateMinPx:l="320px",gridGap:s="16px",sx:o}=e;return(0,r.jsx)(i.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(l,", 1fr))"),gridGap:s,pt:2,...o},children:a.map((e,a)=>e?(0,r.jsx)("span",{children:t(e,a)},"".concat(n(e),"-").concat(a+1)):null)})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,d,n,u,f,h,k,j,l,p,g,o,r,m,_,y,I){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,t,g,o,"static/chunks/pages/index-0d8cb369de720a35.js"],"/_error":["static/chunks/pages/_error-fedd2c6ebd3d27b9.js"],"/changelog":[c,i,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-8514e0696e90a1b2.js"],"/changes":[c,b,"static/chunks/8eec4907-b712959d9f984b68.js",a,"static/chunks/125-00b909bdbab2ca15.js",e,n,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-b3f45dfeb5dc08f0.js"],"/custom-types":[s,t,g,o,"static/chunks/pages/custom-types-5acd56959b60346f.js"],"/custom-types/[customTypeId]":[c,u,f,h,k,s,a,i,d,j,r,e,t,l,p,m,_,"static/chunks/pages/custom-types/[customTypeId]-02278526092bcf5c.js"],"/labs":["static/chunks/pages/labs-56fd818a63553497.js"],"/page-types/[pageTypeId]":[c,u,f,h,k,s,a,i,d,j,r,e,t,l,p,m,_,"static/chunks/pages/page-types/[pageTypeId]-4d99de1b52de7c9b.js"],"/slices":[c,b,y,s,a,d,I,e,p,n,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-de5f8cf4719e88c4.js"],"/slices/[lib]/[sliceName]/[variation]":[c,b,u,f,h,k,y,s,a,i,d,j,I,"static/chunks/484-3e011e79c41f0342.js",e,l,n,"static/css/e8e03c0d4003d1eb.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-330e5d545d9f6269.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[b,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/429-aab52070cad2884b.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-faeb6d2f77d97096.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/397-e6c340070a3bcb41.js","static/chunks/59b4e022-ef680789f7cc9b11.js","static/chunks/66-d9d3bcb5d041cb6d.js","static/chunks/20-169231cb23a752ff.js","static/chunks/647-aa094286bc248d52.js","static/chunks/183-4ea255b867ff171b.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/344-b64f09e670634ed1.js","static/chunks/593-97393b59cba3d429.js","static/chunks/f36c6662-1f3a854183168b10.js","static/chunks/4c744e84-480e426e4b1cfef3.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-09fb3b997ad1eb70.js","static/chunks/256-07f768a2b19b0a0e.js","static/chunks/630-2bf927bca082a191.js","static/chunks/907-ed8b6f8bf21b1e5d.js","static/chunks/248-84a5987f0499b074.js","static/css/4e475d945cf8a890.css","static/chunks/422-c9192a1dbdd2ae0e.js","static/chunks/489-b4b2ce029ea444c1.js","static/css/56f2a6684a524374.css","static/chunks/52d4c156-89c6ec6efca0a0bb.js","static/chunks/444-d39213143f782fec.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
File without changes
|