slice-machine-ui 1.23.0 → 1.23.1-alpha.xru-fix-group-field-repeat.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.
@@ -0,0 +1,70 @@
1
+ import { Checkbox, Label, Box } from "theme-ui";
2
+
3
+ import { Col, Flex as FlexGrid } from "@components/Flex";
4
+ import { DefaultFields } from "@lib/forms/defaults";
5
+ import WidgetFormField from "@lib/builders/common/EditModal/Field";
6
+ import { CheckBox } from "@lib/forms/fields";
7
+ import { createFieldNameFromKey } from "@lib/forms";
8
+
9
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10
+ const FormFields = {
11
+ ...DefaultFields,
12
+ repeat: CheckBox("Repeatable", false, true),
13
+ };
14
+
15
+ const Form = (props) => {
16
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
17
+ const { initialValues, fields, values, setFieldValue } = props;
18
+
19
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
20
+ const {
21
+ config: { repeat },
22
+ } = values;
23
+
24
+ return (
25
+ <FlexGrid>
26
+ {
27
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
28
+ Object.entries(FormFields)
29
+ .filter(([key]) => key !== "repeat")
30
+ .map(([key, field]) => (
31
+ <Col key={key}>
32
+ <WidgetFormField
33
+ fieldName={createFieldNameFromKey(key)}
34
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
35
+ formField={field}
36
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
37
+ fields={fields}
38
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
39
+ initialValues={initialValues}
40
+ />
41
+ </Col>
42
+ ))
43
+ }
44
+
45
+ <Col>
46
+ <Box
47
+ sx={{
48
+ mt: 2,
49
+ alignItems: "center",
50
+ display: "flex",
51
+ height: "130%",
52
+ }}
53
+ >
54
+ <Label variant="label.border" sx={{ mb: 0 }}>
55
+ <Checkbox
56
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
57
+ checked={repeat}
58
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/strict-boolean-expressions
59
+ onChange={() => setFieldValue("config.repeat", !repeat)}
60
+ />
61
+ Repeatable
62
+ </Label>
63
+ </Box>
64
+ </Col>
65
+ </FlexGrid>
66
+ );
67
+ };
68
+
69
+ export { FormFields };
70
+ export default Form;
@@ -1,9 +1,9 @@
1
1
  import * as yup from "yup";
2
- import { DefaultFields } from "@lib/forms/defaults";
3
2
  import { MdPlaylistAdd } from "react-icons/md";
4
3
  import { Widget } from "../Widget";
5
4
  import CustomListItem from "./ListItem";
6
5
  import { GroupSM } from "@lib/models/common/Group";
6
+ import Form, { FormFields } from "./Form";
7
7
 
8
8
  const Meta = {
9
9
  icon: MdPlaylistAdd,
@@ -20,18 +20,20 @@ const schema = yup.object().shape({
20
20
  fields: yup.array(),
21
21
  label: yup.string(),
22
22
  placeholder: yup.string(),
23
+ repeat: yup.boolean().optional(),
23
24
  }),
24
25
  });
25
26
 
26
27
  export const GroupWidget: Widget<GroupSM, typeof schema> = {
27
28
  Meta,
28
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
29
- FormFields: DefaultFields,
29
+ Form,
30
+ FormFields,
30
31
  schema,
31
32
  create: (label: string) => ({
32
33
  type: "Group",
33
34
  config: {
34
35
  label,
36
+ repeat: true,
35
37
  fields: [],
36
38
  },
37
39
  }),
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/1aa04669758c24f4.css" as="style"/><link rel="stylesheet" href="/_next/static/css/1aa04669758c24f4.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-b0c43816b02da519.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/3KLIDO9Xh74NCghiilQKu/_buildManifest.js" defer=""></script><script src="/_next/static/3KLIDO9Xh74NCghiilQKu/_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":"3KLIDO9Xh74NCghiilQKu","runtimeConfig":{"sentryEnvironment":"production"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
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/1aa04669758c24f4.css" as="style"/><link rel="stylesheet" href="/_next/static/css/1aa04669758c24f4.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-90158816c137e34a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/LTvzz7JJLL15-fYk42DlJ/_buildManifest.js" defer=""></script><script src="/_next/static/LTvzz7JJLL15-fYk42DlJ/_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":"LTvzz7JJLL15-fYk42DlJ","runtimeConfig":{"sentryEnvironment":"alpha"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -1 +1 @@
1
- self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,f,d,n,u,h,l,k,j,p,g,o,r){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[a,j,p,"static/chunks/pages/index-64cfb8b0948ba8ef.js"],"/_error":["static/chunks/pages/_error-69b4f498bafdd188.js"],"/changelog":[s,e,"static/chunks/870-0c7a8a9622de78b7.js","static/chunks/pages/changelog-68d115a14f1423d7.js"],"/changes":[s,t,"static/chunks/8eec4907-b712959d9f984b68.js",i,"static/chunks/918-5bb55fb464e34768.js",c,f,"static/css/7d650bca12dc4061.css","static/chunks/pages/changes-2a9c3aeb3b079662.js"],"/custom-types":[a,j,p,"static/chunks/pages/custom-types-94b8f8dbf7727412.js"],"/custom-types/[customTypeId]":[s,d,n,u,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/custom-types/[customTypeId]-3f862ad6111a1fc0.js"],"/labs":["static/chunks/pages/labs-526bb7d60a1b90f4.js"],"/page-types/[pageTypeId]":[s,d,n,u,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/page-types/[pageTypeId]-d1ffca11c42f2603.js"],"/slices":[s,t,b,c,f,"static/css/cb33580e45d01b59.css","static/chunks/pages/slices-9628f8aa54968d6a.js"],"/slices/[lib]/[sliceName]/[variation]":[s,t,d,n,u,h,e,b,i,l,c,k,f,"static/css/77abb01eee0e43a7.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-e89e2e6f772a3454.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[t,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/18539003-7b2711e6c51d6fac.js","static/chunks/376-0ed5822f8afcaa7c.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-897ca93c114a1435.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/59b4e022-7a3b5554b806349f.js","static/chunks/25-8fedd33ad9b6de5b.js","static/chunks/731-501990ebe6a71b32.js","static/chunks/183-aab7066c73ebde44.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/543-f8766685f7f451e2.js","static/chunks/50-cfc2514205b86001.js","static/chunks/787-727e3aef5d2a10a8.js","static/chunks/f36c6662-03bb5e9d9aa0b0aa.js","static/chunks/4c744e84-e3161d754618373f.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-2c5b6c0367fcde86.js","static/chunks/696-b12edad30a3617e5.js","static/chunks/318-a34ba79016e879f9.js","static/chunks/727-15cf3f2fea9a37e5.js","static/css/be1f49e49a5aa7eb.css","static/chunks/474-5a072e6fac61f703.js","static/chunks/904-ccd8ca3368ce29fc.js","static/css/5da5d3cd7a87c3cf.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
1
+ self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,f,d,n,u,h,l,k,j,p,g,o,r){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[a,j,p,"static/chunks/pages/index-64cfb8b0948ba8ef.js"],"/_error":["static/chunks/pages/_error-69b4f498bafdd188.js"],"/changelog":[s,e,"static/chunks/870-0c7a8a9622de78b7.js","static/chunks/pages/changelog-68d115a14f1423d7.js"],"/changes":[s,t,"static/chunks/8eec4907-b712959d9f984b68.js",i,"static/chunks/918-5bb55fb464e34768.js",c,f,"static/css/7d650bca12dc4061.css","static/chunks/pages/changes-2a9c3aeb3b079662.js"],"/custom-types":[a,j,p,"static/chunks/pages/custom-types-94b8f8dbf7727412.js"],"/custom-types/[customTypeId]":[s,d,n,u,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/custom-types/[customTypeId]-3f862ad6111a1fc0.js"],"/labs":["static/chunks/pages/labs-526bb7d60a1b90f4.js"],"/page-types/[pageTypeId]":[s,d,n,u,h,e,b,i,l,g,c,a,k,o,r,"static/chunks/pages/page-types/[pageTypeId]-d1ffca11c42f2603.js"],"/slices":[s,t,b,c,f,"static/css/cb33580e45d01b59.css","static/chunks/pages/slices-9628f8aa54968d6a.js"],"/slices/[lib]/[sliceName]/[variation]":[s,t,d,n,u,h,e,b,i,l,c,k,f,"static/css/77abb01eee0e43a7.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-e89e2e6f772a3454.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[t,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/18539003-7b2711e6c51d6fac.js","static/chunks/376-0ed5822f8afcaa7c.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-897ca93c114a1435.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/59b4e022-7a3b5554b806349f.js","static/chunks/25-8fedd33ad9b6de5b.js","static/chunks/731-501990ebe6a71b32.js","static/chunks/183-4feb6bb3eddbc768.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/543-f8766685f7f451e2.js","static/chunks/50-cfc2514205b86001.js","static/chunks/787-727e3aef5d2a10a8.js","static/chunks/f36c6662-03bb5e9d9aa0b0aa.js","static/chunks/4c744e84-e3161d754618373f.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-2c5b6c0367fcde86.js","static/chunks/696-b12edad30a3617e5.js","static/chunks/318-ce7e74f18f2d5b22.js","static/chunks/727-15cf3f2fea9a37e5.js","static/css/be1f49e49a5aa7eb.css","static/chunks/474-5a072e6fac61f703.js","static/chunks/904-415edffc34e8d4c9.js","static/css/5da5d3cd7a87c3cf.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();