slice-machine-ui 2.20.5-alpha.jp-import-slices-2.1 → 2.20.5-alpha.lg-import-slices.1
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/GzPwmcuyHg0TUP7cX7YSA/_buildManifest.js +1 -0
- package/out/_next/static/chunks/{248-2902bda47821f37b.js → 248-84a5987f0499b074.js} +1 -1
- package/out/_next/static/chunks/422-c7a16d95b75c9e1c.js +1 -0
- package/out/_next/static/chunks/489-c9535ef34da63d1a.js +1 -0
- package/out/_next/static/chunks/585-c89bb2471e85b9f8.js +1 -0
- package/out/_next/static/chunks/{630-4fe1e982234bd925.js → 630-2bf927bca082a191.js} +1 -1
- package/out/_next/static/chunks/{647-a29bee23cb9ac7a2.js → 647-aa094286bc248d52.js} +1 -1
- package/out/_next/static/chunks/{882-8ab59c0c72307c87.js → 882-48d61b2fabee28d8.js} +1 -1
- package/out/_next/static/chunks/954-bedaaabf664584a0.js +1 -0
- package/out/_next/static/chunks/a6495ab1.00190ac98e794d8f.js +28 -0
- package/out/_next/static/chunks/pages/{_app-a60aecdbaa4efedd.js → _app-0668d41463a0a907.js} +217 -217
- package/out/_next/static/chunks/pages/{changelog-bc83e25e8d316ca9.js → changelog-8514e0696e90a1b2.js} +1 -1
- package/out/_next/static/chunks/pages/{changes-6f371ebe52dbe76a.js → changes-e66094f57453cf9c.js} +1 -1
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-80defa14b6ea36f7.js → [customTypeId]-273e9a82c085b596.js} +1 -1
- package/out/_next/static/chunks/pages/{labs-16d118a80936d583.js → labs-56fd818a63553497.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-f4ff9ad74b44bf09.js → [pageTypeId]-3fa7667de1a790d9.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-873c0c89aaf50b3c.js → simulator-8c70298caf51bed0.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-0e9aa745ed9fe1ec.js → [variation]-22ffa2561ac66557.js} +1 -1
- package/out/_next/static/chunks/pages/slices-76679cf064761d2b.js +1 -0
- package/out/_next/static/chunks/{webpack-e986dd216b883a74.js → webpack-24ddb02bea621501.js} +1 -1
- package/out/_next/static/css/bc89f2cd4e4781f5.css +1 -0
- 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 +6 -6
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/ImportSlicesFromLibraryModal.tsx +285 -104
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/hooks/useImportSlicesFromGithub.ts +4 -7
- package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +18 -4
- package/src/features/customTypes/customTypesBuilder/shared/getSubmitButtonLabel.ts +5 -3
- package/src/features/customTypes/customTypesBuilder/sliceCreationOptions.tsx +14 -0
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +72 -0
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModalList.tsx +3 -1
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +79 -31
- package/src/pages/slices.tsx +30 -0
- package/out/_next/static/60BSwFmsh1-aNIyMe29hH/_buildManifest.js +0 -1
- package/out/_next/static/chunks/21-f3962d02eda0a46e.js +0 -1
- package/out/_next/static/chunks/633-2d20c3e815c79c7f.js +0 -1
- package/out/_next/static/chunks/660-a3ec593dcfbb44c9.js +0 -1
- package/out/_next/static/chunks/6611d287.1714222015f895ea.js +0 -28
- package/out/_next/static/chunks/pages/slices-93fc784c443a996c.js +0 -1
- package/out/_next/static/css/b30fbbc3ed00a725.css +0 -1
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/LibrarySlicesTab.tsx +0 -125
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/LocalSlicesTab.tsx +0 -67
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/ReuseExistingSlicesContext.tsx +0 -279
- /package/out/_next/static/{60BSwFmsh1-aNIyMe29hH → GzPwmcuyHg0TUP7cX7YSA}/_ssgManifest.js +0 -0
|
@@ -4,9 +4,11 @@ import { SharedSliceCard } from "@/features/slices/sliceCards/SharedSliceCard";
|
|
|
4
4
|
import Grid from "@/legacy/components/Grid";
|
|
5
5
|
import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
|
|
6
6
|
|
|
7
|
+
import { SliceZoneFormValues } from "./UpdateSliceZoneModal";
|
|
8
|
+
|
|
7
9
|
const UpdateSliceZoneModalList: React.FC<{
|
|
8
10
|
availableSlices: ReadonlyArray<ComponentUI>;
|
|
9
|
-
values:
|
|
11
|
+
values: SliceZoneFormValues;
|
|
10
12
|
}> = ({ availableSlices, values }) => (
|
|
11
13
|
<FieldArray
|
|
12
14
|
name="sliceKeys"
|
|
@@ -45,6 +45,7 @@ import type { SliceMachineStoreType } from "@/redux/type";
|
|
|
45
45
|
import { DeleteSliceZoneModal } from "./DeleteSliceZoneModal";
|
|
46
46
|
import { SlicesList } from "./List";
|
|
47
47
|
import { SlicesTemplatesModal } from "./SlicesTemplatesModal";
|
|
48
|
+
import UpdateSliceZoneModal from "./UpdateSliceZoneModal";
|
|
48
49
|
|
|
49
50
|
const mapAvailableAndSharedSlices = (
|
|
50
51
|
sliceZone: SlicesSM,
|
|
@@ -121,6 +122,10 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
121
122
|
const [isCreateSliceModalOpen, setIsCreateSliceModalOpen] = useState(false);
|
|
122
123
|
const [isCreateSliceFromImageModalOpen, setIsCreateSliceFromImageModalOpen] =
|
|
123
124
|
useState(false);
|
|
125
|
+
const [
|
|
126
|
+
isImportSlicesFromLibraryModalOpen,
|
|
127
|
+
setIsImportSlicesFromLibraryModalOpen,
|
|
128
|
+
] = useState(false);
|
|
124
129
|
const { remoteSlices, libraries } = useSelector(
|
|
125
130
|
(store: SliceMachineStoreType) => ({
|
|
126
131
|
remoteSlices: getRemoteSlices(store),
|
|
@@ -197,6 +202,10 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
197
202
|
});
|
|
198
203
|
};
|
|
199
204
|
|
|
205
|
+
const openImportSlicesFromLibraryModal = () => {
|
|
206
|
+
setIsImportSlicesFromLibraryModalOpen(true);
|
|
207
|
+
};
|
|
208
|
+
|
|
200
209
|
const closeUpdateSliceZoneModal = () => {
|
|
201
210
|
setIsUpdateSliceZoneModalOpen(false);
|
|
202
211
|
};
|
|
@@ -213,6 +222,10 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
213
222
|
setIsSlicesTemplatesModalOpen(false);
|
|
214
223
|
};
|
|
215
224
|
|
|
225
|
+
const closeImportSlicesFromLibraryModal = () => {
|
|
226
|
+
setIsImportSlicesFromLibraryModalOpen(false);
|
|
227
|
+
};
|
|
228
|
+
|
|
216
229
|
return (
|
|
217
230
|
<>
|
|
218
231
|
<ListHeader
|
|
@@ -261,14 +274,27 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
261
274
|
</DropdownMenuItem>
|
|
262
275
|
) : undefined}
|
|
263
276
|
|
|
277
|
+
{availableSlicesToAdd.length > 0 ? (
|
|
278
|
+
<DropdownMenuItem
|
|
279
|
+
onSelect={openUpdateSliceZoneModal}
|
|
280
|
+
renderStartIcon={() =>
|
|
281
|
+
sliceCreationOptions.fromExisting.BackgroundIcon
|
|
282
|
+
}
|
|
283
|
+
description={sliceCreationOptions.fromExisting.description}
|
|
284
|
+
>
|
|
285
|
+
{sliceCreationOptions.fromExisting.title}
|
|
286
|
+
</DropdownMenuItem>
|
|
287
|
+
) : undefined}
|
|
264
288
|
<DropdownMenuItem
|
|
265
|
-
onSelect={
|
|
289
|
+
onSelect={openImportSlicesFromLibraryModal}
|
|
266
290
|
renderStartIcon={() =>
|
|
267
|
-
sliceCreationOptions.
|
|
291
|
+
sliceCreationOptions.importFromExternal.BackgroundIcon
|
|
292
|
+
}
|
|
293
|
+
description={
|
|
294
|
+
sliceCreationOptions.importFromExternal.description
|
|
268
295
|
}
|
|
269
|
-
description={sliceCreationOptions.fromExisting.description}
|
|
270
296
|
>
|
|
271
|
-
{sliceCreationOptions.
|
|
297
|
+
{sliceCreationOptions.importFromExternal.title}
|
|
272
298
|
</DropdownMenuItem>
|
|
273
299
|
</DropdownMenuContent>
|
|
274
300
|
</DropdownMenu>
|
|
@@ -322,6 +348,9 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
322
348
|
openCreateSliceFromImageModal={() =>
|
|
323
349
|
void openCreateSliceFromImageModal()
|
|
324
350
|
}
|
|
351
|
+
openImportSlicesFromLibraryModal={() =>
|
|
352
|
+
void openImportSlicesFromLibraryModal()
|
|
353
|
+
}
|
|
325
354
|
openSlicesTemplatesModal={openSlicesTemplatesModal}
|
|
326
355
|
projectHasAvailableSlices={availableSlicesToAdd.length > 0}
|
|
327
356
|
isSlicesTemplatesSupported={availableSlicesTemplates.length > 0}
|
|
@@ -329,33 +358,28 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
329
358
|
</Box>
|
|
330
359
|
)
|
|
331
360
|
) : undefined}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
void completeStep("createSlice");
|
|
355
|
-
closeUpdateSliceZoneModal();
|
|
356
|
-
}}
|
|
357
|
-
onClose={closeUpdateSliceZoneModal}
|
|
358
|
-
/>
|
|
361
|
+
{isUpdateSliceZoneModalOpen && (
|
|
362
|
+
<UpdateSliceZoneModal
|
|
363
|
+
formId={`tab-slicezone-form-${tabId}`}
|
|
364
|
+
availableSlices={availableSlicesToAdd}
|
|
365
|
+
onSubmit={(slices: SharedSlice[]) => {
|
|
366
|
+
const newCustomType = addSlicesToSliceZone({
|
|
367
|
+
customType,
|
|
368
|
+
tabId,
|
|
369
|
+
slices,
|
|
370
|
+
});
|
|
371
|
+
setCustomType({
|
|
372
|
+
customType: CustomTypes.fromSM(newCustomType),
|
|
373
|
+
onSaveCallback: () => {
|
|
374
|
+
toast.success("Slice(s) added to slice zone");
|
|
375
|
+
},
|
|
376
|
+
});
|
|
377
|
+
void completeStep("createSlice");
|
|
378
|
+
closeUpdateSliceZoneModal();
|
|
379
|
+
}}
|
|
380
|
+
close={closeUpdateSliceZoneModal}
|
|
381
|
+
/>
|
|
382
|
+
)}
|
|
359
383
|
{isSlicesTemplatesModalOpen && (
|
|
360
384
|
<SlicesTemplatesModal
|
|
361
385
|
formId={`tab-slicezone-form-${tabId}`}
|
|
@@ -447,6 +471,30 @@ const SliceZone: React.FC<SliceZoneProps> = ({
|
|
|
447
471
|
}}
|
|
448
472
|
onClose={closeCreateSliceFromImageModal}
|
|
449
473
|
/>
|
|
474
|
+
<ImportSlicesFromLibraryModal
|
|
475
|
+
open={isImportSlicesFromLibraryModalOpen}
|
|
476
|
+
location={`${customType.format}_type`}
|
|
477
|
+
onSuccess={({ slices, library }) => {
|
|
478
|
+
const newCustomType = addSlicesToSliceZone({
|
|
479
|
+
customType,
|
|
480
|
+
tabId,
|
|
481
|
+
slices: slices.map((slice) => slice.model),
|
|
482
|
+
});
|
|
483
|
+
setCustomType({
|
|
484
|
+
customType: CustomTypes.fromSM(newCustomType),
|
|
485
|
+
onSaveCallback: () => {
|
|
486
|
+
toast.success(
|
|
487
|
+
<ToastMessageWithPath
|
|
488
|
+
message="Slice(s) added to slice zone and created at: "
|
|
489
|
+
path={library}
|
|
490
|
+
/>,
|
|
491
|
+
);
|
|
492
|
+
},
|
|
493
|
+
});
|
|
494
|
+
closeImportSlicesFromLibraryModal();
|
|
495
|
+
}}
|
|
496
|
+
onClose={closeImportSlicesFromLibraryModal}
|
|
497
|
+
/>
|
|
450
498
|
</>
|
|
451
499
|
);
|
|
452
500
|
};
|
package/src/pages/slices.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { BaseStyles, Flex, Link, Text } from "theme-ui";
|
|
|
15
15
|
|
|
16
16
|
import { BreadcrumbItem } from "@/components/Breadcrumb";
|
|
17
17
|
import { CreateSliceFromImageModal } from "@/features/customTypes/customTypesBuilder/CreateSliceFromImageModal";
|
|
18
|
+
import { ImportSlicesFromLibraryModal } from "@/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal";
|
|
18
19
|
import { getSliceCreationOptions } from "@/features/customTypes/customTypesBuilder/sliceCreationOptions";
|
|
19
20
|
import { SharedSliceCard } from "@/features/slices/sliceCards/SharedSliceCard";
|
|
20
21
|
import { SLICES_CONFIG } from "@/features/slices/slicesConfig";
|
|
@@ -64,6 +65,10 @@ const SlicesIndex: React.FunctionComponent = () => {
|
|
|
64
65
|
const [isRenameSliceModalOpen, setIsRenameSliceModalOpen] = useState(false);
|
|
65
66
|
const [isCreateSliceFromImageModalOpen, setIsCreateSliceFromImageModalOpen] =
|
|
66
67
|
useState(false);
|
|
68
|
+
const [
|
|
69
|
+
isImportSlicesFromLibraryModalOpen,
|
|
70
|
+
setIsImportSlicesFromLibraryModalOpen,
|
|
71
|
+
] = useState(false);
|
|
67
72
|
|
|
68
73
|
const localLibraries: LibraryUI[] = libraries.filter(
|
|
69
74
|
(library) => library.isLocal,
|
|
@@ -145,6 +150,17 @@ const SlicesIndex: React.FunctionComponent = () => {
|
|
|
145
150
|
>
|
|
146
151
|
{sliceCreationOptions.fromScratch.title}
|
|
147
152
|
</DropdownMenuItem>
|
|
153
|
+
<DropdownMenuItem
|
|
154
|
+
renderStartIcon={() =>
|
|
155
|
+
sliceCreationOptions.importFromExternal.BackgroundIcon
|
|
156
|
+
}
|
|
157
|
+
onSelect={() => setIsImportSlicesFromLibraryModalOpen(true)}
|
|
158
|
+
description={
|
|
159
|
+
sliceCreationOptions.importFromExternal.description
|
|
160
|
+
}
|
|
161
|
+
>
|
|
162
|
+
{sliceCreationOptions.importFromExternal.title}
|
|
163
|
+
</DropdownMenuItem>
|
|
148
164
|
</DropdownMenuContent>
|
|
149
165
|
</DropdownMenu>
|
|
150
166
|
) : undefined}
|
|
@@ -340,6 +356,20 @@ const SlicesIndex: React.FunctionComponent = () => {
|
|
|
340
356
|
}}
|
|
341
357
|
onClose={closeCreateSliceFromImageModal}
|
|
342
358
|
/>
|
|
359
|
+
<ImportSlicesFromLibraryModal
|
|
360
|
+
open={isImportSlicesFromLibraryModalOpen}
|
|
361
|
+
location="slices"
|
|
362
|
+
onSuccess={({ library }: { library: string }) => {
|
|
363
|
+
toast.success(
|
|
364
|
+
<ToastMessageWithPath
|
|
365
|
+
message="Slice(s) added to slice zone and created at: "
|
|
366
|
+
path={library}
|
|
367
|
+
/>,
|
|
368
|
+
);
|
|
369
|
+
setIsImportSlicesFromLibraryModalOpen(false);
|
|
370
|
+
}}
|
|
371
|
+
onClose={() => setIsImportSlicesFromLibraryModalOpen(false)}
|
|
372
|
+
/>
|
|
343
373
|
</AppLayoutContent>
|
|
344
374
|
</AppLayout>
|
|
345
375
|
</>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,d,n,u,h,f,k,j,l,p,g,o,r,m,_,y,I,N){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,t,o,r,"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-bc83e25e8d316ca9.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-6f371ebe52dbe76a.js"],"/custom-types":[s,t,o,r,"static/chunks/pages/custom-types-5acd56959b60346f.js"],"/custom-types/[customTypeId]":[c,u,h,f,k,s,a,i,d,j,l,m,e,t,p,g,_,y,"static/chunks/pages/custom-types/[customTypeId]-80defa14b6ea36f7.js"],"/labs":["static/chunks/pages/labs-16d118a80936d583.js"],"/page-types/[pageTypeId]":[c,u,h,f,k,s,a,i,d,j,l,m,e,t,p,g,_,y,"static/chunks/pages/page-types/[pageTypeId]-f4ff9ad74b44bf09.js"],"/slices":[c,b,I,s,a,d,N,e,g,n,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-93fc784c443a996c.js"],"/slices/[lib]/[sliceName]/[variation]":[c,b,u,h,f,k,I,s,a,i,d,j,N,"static/chunks/484-3e011e79c41f0342.js",e,p,n,"static/css/e8e03c0d4003d1eb.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-0e9aa745ed9fe1ec.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[b,"static/chunks/72585f70-28b4d7d5384b3703.js",l,"static/chunks/429-e5d7e39160de9f5e.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-873c0c89aaf50b3c.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/882-8ab59c0c72307c87.js","static/chunks/647-a29bee23cb9ac7a2.js","static/chunks/183-4ea255b867ff171b.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/344-b64f09e670634ed1.js","static/chunks/593-7ffd1197c3405ef8.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/130-e1a16d2f94fb2b64.js","static/chunks/630-4fe1e982234bd925.js","static/chunks/633-2d20c3e815c79c7f.js","static/chunks/248-2902bda47821f37b.js","static/css/4e475d945cf8a890.css","static/chunks/21-f3962d02eda0a46e.js","static/chunks/660-a3ec593dcfbb44c9.js","static/css/56f2a6684a524374.css","static/chunks/52d4c156-89c6ec6efca0a0bb.js","static/chunks/444-d39213143f782fec.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|