slice-machine-ui 2.12.4-beta.2 → 2.13.0
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/{2dkmJlql74YL10AqIwMoe → c4CIPIVGvVyI3J9mf2Kiz}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/150-e030a221a6bd2282.js +1 -0
- package/out/_next/static/chunks/157-c5160b3e32759582.js +8 -0
- package/out/_next/static/chunks/4c744e84-480e426e4b1cfef3.js +1 -0
- package/out/_next/static/chunks/574-0c1b117bcea4181c.js +1 -0
- package/out/_next/static/chunks/pages/_app-939839b8833d7917.js +647 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5b65c5cb79e1e66a.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-1628edd314d05be8.js +1 -0
- package/out/_next/static/css/f4e7c8aa02acffa5.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/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 +13 -13
- package/src/domain/fields.ts +16 -6
- package/src/domain/slice.ts +3 -1
- package/src/features/builder/useTableFieldExperiment.ts +8 -0
- package/src/legacy/components/Simulator/index.tsx +21 -17
- package/src/legacy/lib/builders/CustomTypeBuilder/TabZone/index.tsx +8 -1
- package/src/legacy/lib/builders/SliceBuilder/FieldZones/index.tsx +13 -3
- package/src/legacy/lib/models/common/widgets/Group/index.tsx +12 -3
- package/src/legacy/lib/models/common/widgets/Link/components.tsx +5 -5
- package/src/legacy/lib/models/common/widgets/NestedGroup/index.tsx +17 -8
- package/src/legacy/lib/models/common/widgets/Table/index.ts +52 -0
- package/src/legacy/lib/models/common/widgets/nonGroupWidgets.ts +2 -0
- package/out/_next/static/chunks/150-2328555354d79c01.js +0 -1
- package/out/_next/static/chunks/429-159ed82b9198a550.js +0 -8
- package/out/_next/static/chunks/4c744e84-642bc2ece03445a4.js +0 -1
- package/out/_next/static/chunks/574-51e1dc5d26f148e4.js +0 -1
- package/out/_next/static/chunks/pages/_app-e66b6003aff25746.js +0 -644
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-252ec274cf2c422e.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-eee8fd501e56e955.js +0 -1
- package/out/_next/static/css/69a583909471a453.css +0 -1
- /package/out/_next/static/{2dkmJlql74YL10AqIwMoe → c4CIPIVGvVyI3J9mf2Kiz}/_ssgManifest.js +0 -0
package/out/labs.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/
|
|
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/f4e7c8aa02acffa5.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f4e7c8aa02acffa5.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-a31bc948075f7bde.js" defer=""></script><script src="/_next/static/chunks/main-8e15d66b38d840e9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-939839b8833d7917.js" defer=""></script><script src="/_next/static/chunks/pages/labs-41db727cff0af1a9.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_buildManifest.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/labs","query":{},"buildId":"c4CIPIVGvVyI3J9mf2Kiz","runtimeConfig":{"sentryEnvironment":"production"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
|
|
@@ -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/
|
|
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/f4e7c8aa02acffa5.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f4e7c8aa02acffa5.css" data-n-g=""/><link rel="preload" href="/_next/static/css/850c81be38195a0f.css" as="style"/><link rel="stylesheet" href="/_next/static/css/850c81be38195a0f.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-a31bc948075f7bde.js" defer=""></script><script src="/_next/static/chunks/main-8e15d66b38d840e9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-939839b8833d7917.js" defer=""></script><script src="/_next/static/chunks/59b4e022-8e544a511d670317.js" defer=""></script><script src="/_next/static/chunks/f36c6662-1f3a854183168b10.js" defer=""></script><script src="/_next/static/chunks/4c744e84-480e426e4b1cfef3.js" defer=""></script><script src="/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js" defer=""></script><script src="/_next/static/chunks/1cc2734a-09fb3b997ad1eb70.js" defer=""></script><script src="/_next/static/chunks/183-b1a9f55f45cb8d8e.js" defer=""></script><script src="/_next/static/chunks/50-586dc7ab5e584e76.js" defer=""></script><script src="/_next/static/chunks/434-c7ad3ff97354e3b7.js" defer=""></script><script src="/_next/static/chunks/479-6205c85aa978fc0b.js" defer=""></script><script src="/_next/static/chunks/772-7401e6c6e7ca075e.js" defer=""></script><script src="/_next/static/chunks/372-718a5541f567e738.js" defer=""></script><script src="/_next/static/chunks/574-0c1b117bcea4181c.js" defer=""></script><script src="/_next/static/chunks/150-e030a221a6bd2282.js" defer=""></script><script src="/_next/static/chunks/pages/page-types/%5BpageTypeId%5D-5bb8851689eb84cb.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_buildManifest.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/page-types/[pageTypeId]","query":{},"buildId":"c4CIPIVGvVyI3J9mf2Kiz","runtimeConfig":{"sentryEnvironment":"production"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
|
package/out/settings.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/
|
|
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/f4e7c8aa02acffa5.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f4e7c8aa02acffa5.css" data-n-g=""/><link rel="preload" href="/_next/static/css/e5f781f20e24a5ea.css" as="style"/><link rel="stylesheet" href="/_next/static/css/e5f781f20e24a5ea.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-a31bc948075f7bde.js" defer=""></script><script src="/_next/static/chunks/main-8e15d66b38d840e9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-939839b8833d7917.js" defer=""></script><script src="/_next/static/chunks/pages/settings-4efa7c64dc4f2468.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_buildManifest.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/settings","query":{},"buildId":"c4CIPIVGvVyI3J9mf2Kiz","runtimeConfig":{"sentryEnvironment":"production"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
|
|
@@ -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/
|
|
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/f4e7c8aa02acffa5.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f4e7c8aa02acffa5.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-a31bc948075f7bde.js" defer=""></script><script src="/_next/static/chunks/main-8e15d66b38d840e9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-939839b8833d7917.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/72585f70-28b4d7d5384b3703.js" defer=""></script><script src="/_next/static/chunks/157-c5160b3e32759582.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D/simulator-5b65c5cb79e1e66a.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_buildManifest.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]/simulator","query":{},"buildId":"c4CIPIVGvVyI3J9mf2Kiz","runtimeConfig":{"sentryEnvironment":"production"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
|
|
@@ -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/
|
|
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/f4e7c8aa02acffa5.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f4e7c8aa02acffa5.css" data-n-g=""/><link rel="preload" href="/_next/static/css/9740e73b8aa87666.css" as="style"/><link rel="stylesheet" href="/_next/static/css/9740e73b8aa87666.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-a31bc948075f7bde.js" defer=""></script><script src="/_next/static/chunks/main-8e15d66b38d840e9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-939839b8833d7917.js" defer=""></script><script src="/_next/static/chunks/59b4e022-8e544a511d670317.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/f36c6662-1f3a854183168b10.js" defer=""></script><script src="/_next/static/chunks/4c744e84-480e426e4b1cfef3.js" defer=""></script><script src="/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js" defer=""></script><script src="/_next/static/chunks/1cc2734a-09fb3b997ad1eb70.js" defer=""></script><script src="/_next/static/chunks/183-b1a9f55f45cb8d8e.js" defer=""></script><script src="/_next/static/chunks/50-586dc7ab5e584e76.js" defer=""></script><script src="/_next/static/chunks/434-c7ad3ff97354e3b7.js" defer=""></script><script src="/_next/static/chunks/772-7401e6c6e7ca075e.js" defer=""></script><script src="/_next/static/chunks/574-0c1b117bcea4181c.js" defer=""></script><script src="/_next/static/chunks/639-424b570eee9a37fb.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D-1628edd314d05be8.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_buildManifest.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]","query":{},"buildId":"c4CIPIVGvVyI3J9mf2Kiz","runtimeConfig":{"sentryEnvironment":"production"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
|
package/out/slices.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/
|
|
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/f4e7c8aa02acffa5.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f4e7c8aa02acffa5.css" data-n-g=""/><link rel="preload" href="/_next/static/css/b5323377600915db.css" as="style"/><link rel="stylesheet" href="/_next/static/css/b5323377600915db.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-a31bc948075f7bde.js" defer=""></script><script src="/_next/static/chunks/main-8e15d66b38d840e9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-939839b8833d7917.js" defer=""></script><script src="/_next/static/chunks/59b4e022-8e544a511d670317.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/50-586dc7ab5e584e76.js" defer=""></script><script src="/_next/static/chunks/772-7401e6c6e7ca075e.js" defer=""></script><script src="/_next/static/chunks/639-424b570eee9a37fb.js" defer=""></script><script src="/_next/static/chunks/pages/slices-f42c28ddc74a5b2b.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_buildManifest.js" defer=""></script><script src="/_next/static/c4CIPIVGvVyI3J9mf2Kiz/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices","query":{},"buildId":"c4CIPIVGvVyI3J9mf2Kiz","runtimeConfig":{"sentryEnvironment":"production"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slice-machine-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A visual builder for your Slice Models with all the tools you need to generate data models and mock CMS content locally.",
|
|
6
6
|
"repository": {
|
|
@@ -35,28 +35,29 @@
|
|
|
35
35
|
"start-slicemachine": "./bin/start-slicemachine.cjs"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"
|
|
40
|
-
"start-slicemachine": "0.12.46-beta.2"
|
|
38
|
+
"@slicemachine/manager": "0.24.4",
|
|
39
|
+
"start-slicemachine": "0.12.46"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@emotion/react": "11.11.1",
|
|
44
43
|
"@extractus/oembed-extractor": "3.1.8",
|
|
45
|
-
"@prismicio/client": "7.
|
|
46
|
-
"@prismicio/editor-fields": "0.4.
|
|
47
|
-
"@prismicio/editor-support": "0.4.
|
|
48
|
-
"@prismicio/editor-ui": "0.4.
|
|
49
|
-
"@prismicio/mock": "0.
|
|
50
|
-
"@prismicio/mocks": "2.
|
|
44
|
+
"@prismicio/client": "7.16.1",
|
|
45
|
+
"@prismicio/editor-fields": "0.4.64",
|
|
46
|
+
"@prismicio/editor-support": "0.4.64",
|
|
47
|
+
"@prismicio/editor-ui": "0.4.64",
|
|
48
|
+
"@prismicio/mock": "0.7.1",
|
|
49
|
+
"@prismicio/mocks": "2.9.1",
|
|
51
50
|
"@prismicio/simulator": "0.1.4",
|
|
52
|
-
"@prismicio/types-internal": "3.
|
|
51
|
+
"@prismicio/types-internal": "3.6.0",
|
|
53
52
|
"@radix-ui/react-hover-card": "1.0.6",
|
|
54
53
|
"@radix-ui/react-tabs": "1.0.4",
|
|
54
|
+
"@radix-ui/react-visually-hidden": "1.1.1",
|
|
55
55
|
"@reach/menu-button": "0.18.0",
|
|
56
56
|
"@sentry/nextjs": "7.43.0",
|
|
57
57
|
"@storybook/addon-essentials": "7.0.10",
|
|
58
58
|
"@storybook/react": "7.0.10",
|
|
59
59
|
"@storybook/react-vite": "7.0.10",
|
|
60
|
+
"@tanstack/react-query": "5.55.4",
|
|
60
61
|
"@testing-library/dom": "9.3.0",
|
|
61
62
|
"@testing-library/jest-dom": "5.16.5",
|
|
62
63
|
"@testing-library/react": "14.0.0",
|
|
@@ -135,6 +136,5 @@
|
|
|
135
136
|
"vitest": "0.32.0",
|
|
136
137
|
"yup": "0.32.11",
|
|
137
138
|
"zod": "3.23.8"
|
|
138
|
-
}
|
|
139
|
-
"stableVersion": "2.12.3"
|
|
139
|
+
}
|
|
140
140
|
}
|
package/src/domain/fields.ts
CHANGED
|
@@ -130,6 +130,15 @@ export const numberField: NestableField = {
|
|
|
130
130
|
type: "Number",
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
export const richTextField: NestableField = {
|
|
134
|
+
name: "Rich Text",
|
|
135
|
+
description: "Text with formatting options.",
|
|
136
|
+
icon: "textFields",
|
|
137
|
+
thumbnail:
|
|
138
|
+
"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295530/DEV_TOOLS/SM_FIELDS/Type_Rich_Text_fxdyar.png",
|
|
139
|
+
type: "StructuredText",
|
|
140
|
+
};
|
|
141
|
+
|
|
133
142
|
export const selectField: NestableField = {
|
|
134
143
|
name: "Select",
|
|
135
144
|
description: "A dropdown of options.",
|
|
@@ -139,13 +148,13 @@ export const selectField: NestableField = {
|
|
|
139
148
|
type: "Select",
|
|
140
149
|
};
|
|
141
150
|
|
|
142
|
-
export const
|
|
143
|
-
name: "
|
|
144
|
-
description: "
|
|
145
|
-
icon: "
|
|
151
|
+
export const tableField: NestableField = {
|
|
152
|
+
name: "Table",
|
|
153
|
+
description: "A structured table.",
|
|
154
|
+
icon: "table",
|
|
146
155
|
thumbnail:
|
|
147
|
-
"https://res.cloudinary.com/dmtf1daqp/image/upload/
|
|
148
|
-
type: "
|
|
156
|
+
"https://res.cloudinary.com/dmtf1daqp/image/upload/v1737381854/FIELDS_SM/Table_f47jnq.png",
|
|
157
|
+
type: "Table",
|
|
149
158
|
};
|
|
150
159
|
|
|
151
160
|
export const textField: NestableField = {
|
|
@@ -177,6 +186,7 @@ export const nestableFields: NestableField[] = [
|
|
|
177
186
|
LinkToMediaField,
|
|
178
187
|
colorField,
|
|
179
188
|
dateField,
|
|
189
|
+
tableField,
|
|
180
190
|
timestampField,
|
|
181
191
|
embedField,
|
|
182
192
|
geoPointField,
|
package/src/domain/slice.ts
CHANGED
|
@@ -71,7 +71,9 @@ export function getNonSharedSliceLabel(
|
|
|
71
71
|
slice.config?.label ??
|
|
72
72
|
(slice.type === "Group" ||
|
|
73
73
|
slice.type === "Slice" ||
|
|
74
|
-
(slice.type !== "Boolean" &&
|
|
74
|
+
(slice.type !== "Boolean" &&
|
|
75
|
+
slice.type !== "Separator" &&
|
|
76
|
+
slice.type !== "Table")
|
|
75
77
|
? slice.fieldset
|
|
76
78
|
: undefined) ??
|
|
77
79
|
slice.type
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useExperimentVariant } from "@/hooks/useExperimentVariant";
|
|
2
|
+
|
|
3
|
+
type UseTableFieldExperimentReturnType = { eligible: boolean };
|
|
4
|
+
|
|
5
|
+
export function useTableFieldExperiment(): UseTableFieldExperimentReturnType {
|
|
6
|
+
const variant = useExperimentVariant("slicemachine-table-field");
|
|
7
|
+
return { eligible: variant?.value === "on" };
|
|
8
|
+
}
|
|
@@ -2,6 +2,7 @@ import { EditorConfig, SharedSliceEditor } from "@prismicio/editor-fields";
|
|
|
2
2
|
import { DefaultErrorMessage } from "@prismicio/editor-ui";
|
|
3
3
|
import { renderSliceMock } from "@prismicio/mocks";
|
|
4
4
|
import { SharedSliceContent } from "@prismicio/types-internal/lib/content";
|
|
5
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
6
|
import {
|
|
6
7
|
FC,
|
|
7
8
|
Suspense,
|
|
@@ -44,6 +45,8 @@ type SimulatorProps = {
|
|
|
44
45
|
|
|
45
46
|
const IFRAME_CONNECTION_TIMEOUT = 20000;
|
|
46
47
|
|
|
48
|
+
const queryClient = new QueryClient();
|
|
49
|
+
|
|
47
50
|
const Simulator: FC<SimulatorProps> = ({ slice, variation }) => {
|
|
48
51
|
const { updateSliceMockSuccess } = useSliceMachineActions();
|
|
49
52
|
const { simulatorUrl, endpoints } = useSelector(
|
|
@@ -65,7 +68,6 @@ const Simulator: FC<SimulatorProps> = ({ slice, variation }) => {
|
|
|
65
68
|
|
|
66
69
|
useEffect(() => {
|
|
67
70
|
void telemetry.track({ event: "slice-simulator:open" });
|
|
68
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
71
|
}, []);
|
|
70
72
|
|
|
71
73
|
const startedNewEditorSessionRef = useRef(false);
|
|
@@ -294,22 +296,24 @@ const Simulator: FC<SimulatorProps> = ({ slice, variation }) => {
|
|
|
294
296
|
)}
|
|
295
297
|
>
|
|
296
298
|
<Suspense>
|
|
297
|
-
<
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
299
|
+
<QueryClientProvider client={queryClient}>
|
|
300
|
+
<SharedSliceEditor
|
|
301
|
+
/**
|
|
302
|
+
* Because of a re-render issue on the richtext /* we
|
|
303
|
+
* enforce re-rendering the editor when the variation
|
|
304
|
+
* change. /* this change should be removed once the editor
|
|
305
|
+
* is fixed.
|
|
306
|
+
*/
|
|
307
|
+
key={variation.id}
|
|
308
|
+
config={editorConfig}
|
|
309
|
+
content={editorContent}
|
|
310
|
+
onContentChange={(c) => {
|
|
311
|
+
setEditorState(c);
|
|
312
|
+
trackWidgetUsed(slice.model.id);
|
|
313
|
+
}}
|
|
314
|
+
sharedSlice={sharedSlice}
|
|
315
|
+
/>
|
|
316
|
+
</QueryClientProvider>
|
|
313
317
|
</Suspense>
|
|
314
318
|
</ErrorBoundary>
|
|
315
319
|
</Flex>
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
updateField,
|
|
21
21
|
} from "@/domain/customType";
|
|
22
22
|
import { ErrorBoundary } from "@/ErrorBoundary";
|
|
23
|
+
import { useTableFieldExperiment } from "@/features/builder/useTableFieldExperiment";
|
|
23
24
|
import { useCustomTypeState } from "@/features/customTypes/customTypesBuilder/CustomTypeProvider";
|
|
24
25
|
import {
|
|
25
26
|
CustomTypes,
|
|
@@ -53,6 +54,7 @@ const widgetsArray = [
|
|
|
53
54
|
Widgets.Number,
|
|
54
55
|
Widgets.Color,
|
|
55
56
|
Widgets.Date,
|
|
57
|
+
Widgets.Table,
|
|
56
58
|
Widgets.Embed,
|
|
57
59
|
Widgets.Timestamp,
|
|
58
60
|
Widgets.GeoPoint,
|
|
@@ -76,6 +78,11 @@ type OnSaveFieldProps = {
|
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
const TabZone: FC<TabZoneProps> = ({ tabId }) => {
|
|
81
|
+
const tableFieldExperiment = useTableFieldExperiment();
|
|
82
|
+
const maybeFilteredWidgetsArray = tableFieldExperiment.eligible
|
|
83
|
+
? widgetsArray
|
|
84
|
+
: widgetsArray.filter((widget) => widget.TYPE_NAME !== "Table");
|
|
85
|
+
|
|
79
86
|
const { customType, setCustomType } = useCustomTypeState();
|
|
80
87
|
const customTypeSM = CustomTypes.toSM(customType);
|
|
81
88
|
|
|
@@ -258,7 +265,7 @@ const TabZone: FC<TabZoneProps> = ({ tabId }) => {
|
|
|
258
265
|
poolOfFieldsToCheck={poolOfFields}
|
|
259
266
|
showHints={true}
|
|
260
267
|
EditModal={EditModal}
|
|
261
|
-
widgetsArray={
|
|
268
|
+
widgetsArray={maybeFilteredWidgetsArray}
|
|
262
269
|
onDeleteItem={onDeleteItem}
|
|
263
270
|
onSave={onCreateOrSave}
|
|
264
271
|
onDragEnd={onDragEnd}
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
reorderField,
|
|
25
25
|
updateField,
|
|
26
26
|
} from "@/domain/slice";
|
|
27
|
+
import { useTableFieldExperiment } from "@/features/builder/useTableFieldExperiment";
|
|
27
28
|
import { useSliceState } from "@/features/slices/sliceBuilder/SliceBuilderProvider";
|
|
28
29
|
import EditModal from "@/legacy/lib/builders/common/EditModal";
|
|
29
30
|
import Zone from "@/legacy/lib/builders/common/Zone";
|
|
@@ -56,6 +57,7 @@ const itemsWidgetsArray = [
|
|
|
56
57
|
Widgets.Number,
|
|
57
58
|
Widgets.Color,
|
|
58
59
|
Widgets.Date,
|
|
60
|
+
Widgets.Table,
|
|
59
61
|
Widgets.Embed,
|
|
60
62
|
Widgets.Timestamp,
|
|
61
63
|
Widgets.GeoPoint,
|
|
@@ -63,8 +65,6 @@ const itemsWidgetsArray = [
|
|
|
63
65
|
Widgets.LinkToMedia,
|
|
64
66
|
];
|
|
65
67
|
|
|
66
|
-
const primaryWidgetsArray = [Widgets.Group, ...itemsWidgetsArray];
|
|
67
|
-
|
|
68
68
|
type OnSaveFieldProps = {
|
|
69
69
|
apiId: string;
|
|
70
70
|
newKey: string;
|
|
@@ -79,6 +79,16 @@ const FieldZones: FC = () => {
|
|
|
79
79
|
setIsDeleteRepeatableZoneDialogOpen,
|
|
80
80
|
] = useState(false);
|
|
81
81
|
|
|
82
|
+
const tableFieldExperiment = useTableFieldExperiment();
|
|
83
|
+
const maybeFilteredItemsWidgetsArray = tableFieldExperiment.eligible
|
|
84
|
+
? itemsWidgetsArray
|
|
85
|
+
: itemsWidgetsArray.filter((widget) => widget.TYPE_NAME !== "Table");
|
|
86
|
+
|
|
87
|
+
const primaryWidgetsArray = [
|
|
88
|
+
Widgets.Group,
|
|
89
|
+
...maybeFilteredItemsWidgetsArray,
|
|
90
|
+
];
|
|
91
|
+
|
|
82
92
|
// We won't show the Repeatable Zone if no items are configured.
|
|
83
93
|
const hasItems = Boolean(
|
|
84
94
|
variation.items && Object.keys(variation.items).length > 0,
|
|
@@ -244,7 +254,7 @@ const FieldZones: FC = () => {
|
|
|
244
254
|
isRepeatable
|
|
245
255
|
title="Repeatable Zone"
|
|
246
256
|
dataTip={dataTipText2}
|
|
247
|
-
widgetsArray={
|
|
257
|
+
widgetsArray={maybeFilteredItemsWidgetsArray}
|
|
248
258
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
249
259
|
fields={variation.items}
|
|
250
260
|
EditModal={EditModal}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type DroppableStateSnapshot } from "react-beautiful-dnd";
|
|
2
2
|
|
|
3
3
|
import { useNestedGroupExperiment } from "@/features/builder/useNestedGroupExperiment";
|
|
4
|
+
import { useTableFieldExperiment } from "@/features/builder/useTableFieldExperiment";
|
|
4
5
|
import { type Item } from "@/legacy/components/ListItem";
|
|
5
6
|
import { type TabField } from "@/legacy/lib/models/common/CustomType";
|
|
6
7
|
import { type GroupSM } from "@/legacy/lib/models/common/Group";
|
|
@@ -20,6 +21,7 @@ const widgetsArray = [
|
|
|
20
21
|
Widgets.Number,
|
|
21
22
|
Widgets.Color,
|
|
22
23
|
Widgets.Date,
|
|
24
|
+
Widgets.Table,
|
|
23
25
|
Widgets.Embed,
|
|
24
26
|
Widgets.Timestamp,
|
|
25
27
|
Widgets.GeoPoint,
|
|
@@ -54,9 +56,16 @@ const hintItemName = "item";
|
|
|
54
56
|
|
|
55
57
|
const GroupListItem = (props: GroupListItemProps<GroupSM>): JSX.Element => {
|
|
56
58
|
const nestedGroupExperiment = useNestedGroupExperiment();
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
const tableFieldExperiment = useTableFieldExperiment();
|
|
60
|
+
|
|
61
|
+
const maybeFilteredWidgetsArray = widgetsArray.filter((widget) => {
|
|
62
|
+
if (!nestedGroupExperiment.eligible && widget.CUSTOM_NAME === "NestedGroup")
|
|
63
|
+
return false;
|
|
64
|
+
if (!tableFieldExperiment.eligible && widget.TYPE_NAME === "Table")
|
|
65
|
+
return false;
|
|
66
|
+
return true;
|
|
67
|
+
});
|
|
68
|
+
|
|
60
69
|
return (
|
|
61
70
|
<CustomListItem
|
|
62
71
|
Widgets={Widgets}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
TextInput,
|
|
9
9
|
Tooltip,
|
|
10
10
|
} from "@prismicio/editor-ui";
|
|
11
|
-
import { useRef } from "react";
|
|
11
|
+
import { useRef, useState } from "react";
|
|
12
12
|
import { Checkbox, Flex, Label } from "theme-ui";
|
|
13
13
|
|
|
14
14
|
import { Col } from "@/legacy/components/Flex";
|
|
@@ -23,8 +23,8 @@ interface CommonCheckboxProps {
|
|
|
23
23
|
export function DisplayTextCheckbox(props: CommonCheckboxProps) {
|
|
24
24
|
const { checked, height = 130, setFieldValue } = props;
|
|
25
25
|
|
|
26
|
-
//
|
|
27
|
-
const container =
|
|
26
|
+
// Container to position the tooltip inside it.
|
|
27
|
+
const [container, setContainer] = useState<HTMLElement | null>(null);
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
30
|
<Col>
|
|
@@ -41,7 +41,7 @@ export function DisplayTextCheckbox(props: CommonCheckboxProps) {
|
|
|
41
41
|
justifyContent="space-between"
|
|
42
42
|
alignItems="center"
|
|
43
43
|
width="100%"
|
|
44
|
-
ref={
|
|
44
|
+
ref={setContainer}
|
|
45
45
|
>
|
|
46
46
|
<Flex>
|
|
47
47
|
<Checkbox
|
|
@@ -53,7 +53,7 @@ export function DisplayTextCheckbox(props: CommonCheckboxProps) {
|
|
|
53
53
|
Allow display text
|
|
54
54
|
</Flex>
|
|
55
55
|
<Tooltip
|
|
56
|
-
|
|
56
|
+
container={container}
|
|
57
57
|
align="end"
|
|
58
58
|
content="Allow editors to customize the link display text"
|
|
59
59
|
>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useTableFieldExperiment } from "@/features/builder/useTableFieldExperiment";
|
|
1
2
|
import { type NestedGroupSM } from "@/legacy/lib/models/common/Group";
|
|
2
3
|
import { type GroupListItemProps } from "@/legacy/lib/models/common/widgets/Group";
|
|
3
4
|
import { createGroupWidget } from "@/legacy/lib/models/common/widgets/Group/createGroupWidget";
|
|
@@ -14,6 +15,7 @@ const widgetsArray = [
|
|
|
14
15
|
Widgets.Number,
|
|
15
16
|
Widgets.Color,
|
|
16
17
|
Widgets.Date,
|
|
18
|
+
Widgets.Table,
|
|
17
19
|
Widgets.Embed,
|
|
18
20
|
Widgets.Timestamp,
|
|
19
21
|
Widgets.GeoPoint,
|
|
@@ -23,14 +25,21 @@ const widgetsArray = [
|
|
|
23
25
|
|
|
24
26
|
const hintItemName = "subItem";
|
|
25
27
|
|
|
26
|
-
const NestedGroupListItem = (props: GroupListItemProps<NestedGroupSM>) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
widgetsArray
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const NestedGroupListItem = (props: GroupListItemProps<NestedGroupSM>) => {
|
|
29
|
+
const tableFieldExperiment = useTableFieldExperiment();
|
|
30
|
+
const maybeFilteredWidgetsArray = tableFieldExperiment.eligible
|
|
31
|
+
? widgetsArray
|
|
32
|
+
: widgetsArray.filter((widget) => widget.TYPE_NAME !== "Table");
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<CustomListItem
|
|
36
|
+
Widgets={Widgets}
|
|
37
|
+
widgetsArray={maybeFilteredWidgetsArray}
|
|
38
|
+
hintBase={hintItemName}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
34
43
|
|
|
35
44
|
export const NestedGroupWidget = createGroupWidget({
|
|
36
45
|
schemaTypeRegex: /^NestedGroup$/,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
2
|
+
import { Table } from "@prismicio/types-internal/lib/customtypes/widgets/nestable";
|
|
3
|
+
import { FaTable } from "react-icons/fa";
|
|
4
|
+
import * as yup from "yup";
|
|
5
|
+
|
|
6
|
+
import { DefaultFields } from "../../../../forms/defaults";
|
|
7
|
+
import { Widget } from "../Widget";
|
|
8
|
+
|
|
9
|
+
/** : {
|
|
10
|
+
"type" : "Table",
|
|
11
|
+
"config" : {
|
|
12
|
+
"label" : "Gable's Fabled Table"
|
|
13
|
+
}
|
|
14
|
+
} */
|
|
15
|
+
|
|
16
|
+
const FormFields = {
|
|
17
|
+
label: DefaultFields.label,
|
|
18
|
+
id: DefaultFields.id,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const schema = yup.object().shape({
|
|
22
|
+
type: yup
|
|
23
|
+
.string()
|
|
24
|
+
.matches(/^Table$/, { excludeEmptyString: true })
|
|
25
|
+
.required(),
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
|
27
|
+
config: yup
|
|
28
|
+
.object()
|
|
29
|
+
.shape({
|
|
30
|
+
label: yup.string(),
|
|
31
|
+
})
|
|
32
|
+
.required()
|
|
33
|
+
.default(undefined)
|
|
34
|
+
.noUnknown(true),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const Meta = {
|
|
38
|
+
icon: FaTable,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const TableWidget: Widget<Table, typeof schema> = {
|
|
42
|
+
create: (label: string) => ({
|
|
43
|
+
type: "Table",
|
|
44
|
+
config: {
|
|
45
|
+
label,
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
FormFields,
|
|
49
|
+
TYPE_NAME: "Table",
|
|
50
|
+
schema,
|
|
51
|
+
Meta,
|
|
52
|
+
};
|
|
@@ -10,6 +10,7 @@ import { LinkToMediaWidget } from "./LinkToMedia";
|
|
|
10
10
|
import { NumberWidget } from "./Number";
|
|
11
11
|
import { SelectWidget } from "./Select";
|
|
12
12
|
import { StructuredTextWidget } from "./StructuredText";
|
|
13
|
+
import { TableWidget } from "./Table";
|
|
13
14
|
import { TextWidget } from "./Text";
|
|
14
15
|
import { TimestampWidget } from "./Timestamp";
|
|
15
16
|
import { UIDWidget } from "./UID";
|
|
@@ -27,6 +28,7 @@ export const NonGroupWidgets = {
|
|
|
27
28
|
Number: NumberWidget,
|
|
28
29
|
Select: SelectWidget,
|
|
29
30
|
StructuredText: StructuredTextWidget,
|
|
31
|
+
Table: TableWidget,
|
|
30
32
|
Text: TextWidget,
|
|
31
33
|
Timestamp: TimestampWidget,
|
|
32
34
|
UID: UIDWidget,
|