slice-machine-ui 2.2.2-beta.1 → 2.2.2-beta.11

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.
Files changed (108) hide show
  1. package/next.config.mjs +11 -1
  2. package/out/404.html +1 -1
  3. package/out/_next/static/chunks/18539003-7b839478e0b5720a.js +22 -0
  4. package/out/_next/static/chunks/{66-d37d30551288858b.js → 210-565d01ee9777d1a1.js} +2 -2
  5. package/out/_next/static/chunks/{212-cbaa35389c0aacf1.js → 212-b6a2b8d9d16ef3c5.js} +1 -1
  6. package/out/_next/static/chunks/448-a0de8b21d55d4da3.js +1 -0
  7. package/out/_next/static/chunks/{465-47a6d2a5f66f521e.js → 465-d5dd75edd8e6bb65.js} +1 -1
  8. package/out/_next/static/chunks/574-319271e279f042bc.js +1 -0
  9. package/out/_next/static/chunks/59b4e022-8e544a511d670317.js +1 -0
  10. package/out/_next/static/chunks/695-603bd96af31f4302.js +12 -0
  11. package/out/_next/static/chunks/{816-68d4db26c0adab2e.js → 816-17afd84d2642f4c4.js} +1 -1
  12. package/out/_next/static/chunks/f36c6662-1f3a854183168b10.js +1 -0
  13. package/out/_next/static/chunks/pages/_app-f7a7229e62fc765c.js +544 -0
  14. package/out/_next/static/chunks/pages/{changelog-d309ea186a0e56bf.js → changelog-1d15a7ef498f499a.js} +1 -1
  15. package/out/_next/static/chunks/pages/{changes-1bb1a7b784a22151.js → changes-0af2a1a5244418f9.js} +1 -1
  16. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-74be2c0ac9c854c7.js → [customTypeId]-a6ff1618238b3510.js} +1 -1
  17. package/out/_next/static/chunks/pages/{index-785a0ab6e2a4fc27.js → index-2610e550d79c5bb1.js} +1 -1
  18. package/out/_next/static/chunks/pages/{labs-2e4f3a5f68e65b93.js → labs-240ba57bfdabe998.js} +1 -1
  19. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-d35c87b9aaec445a.js → [pageTypeId]-c300f963db847451.js} +1 -1
  20. package/out/_next/static/chunks/pages/{settings-25eb02893ed871b7.js → settings-039476a9a63d25a1.js} +1 -1
  21. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-b47a72d5e94bd946.js → simulator-cfc19e3e799745bb.js} +1 -1
  22. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-58e6cb0f278ea03c.js +1 -0
  23. package/out/_next/static/chunks/pages/{slices-cc44eeccd58d23a9.js → slices-9894ce968d74baf6.js} +1 -1
  24. package/out/_next/static/css/82c8c4f05b25d3af.css +1 -0
  25. package/out/_next/static/lnoCw12ueMqf698VD8pfN/_buildManifest.js +1 -0
  26. package/out/changelog.html +1 -1
  27. package/out/changes.html +1 -1
  28. package/out/custom-types/[customTypeId].html +1 -1
  29. package/out/custom-types.html +1 -1
  30. package/out/index.html +1 -1
  31. package/out/labs.html +1 -1
  32. package/out/page-types/[pageTypeId].html +1 -1
  33. package/out/settings.html +1 -1
  34. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  35. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  36. package/out/slices.html +1 -1
  37. package/package.json +11 -10
  38. package/src/domain/fields.ts +223 -0
  39. package/src/features/builder/AddFieldDropdown.tsx +119 -0
  40. package/src/features/onboarding/OnboardingGuide.tsx +45 -0
  41. package/src/features/onboarding/OnboardingProgressStepper.tsx +71 -0
  42. package/src/features/onboarding/OnboardingProvider.tsx +82 -0
  43. package/src/features/onboarding/OnboardingStepDialog/OnboardingStepDialog.tsx +46 -0
  44. package/src/features/onboarding/OnboardingStepDialog/OnboardingStepDialogContent.tsx +38 -0
  45. package/src/features/onboarding/OnboardingStepDialog/index.ts +1 -0
  46. package/src/features/onboarding/content.tsx +115 -0
  47. package/src/features/onboarding/types.ts +32 -0
  48. package/src/features/onboarding/useOnboardingExperiment.ts +6 -0
  49. package/src/hooks/useNestedGroupExperiment.ts +8 -0
  50. package/src/hooks/usePersistedState.ts +20 -3
  51. package/src/legacy/components/ListItem/index.tsx +1 -1
  52. package/src/legacy/components/Navigation/index.tsx +2 -0
  53. package/src/legacy/lib/builders/CustomTypeBuilder/TabZone/index.tsx +22 -4
  54. package/src/legacy/lib/builders/SliceBuilder/FieldZones/index.tsx +23 -8
  55. package/src/legacy/lib/builders/SliceBuilder/VariationsList/index.tsx +5 -2
  56. package/src/legacy/lib/builders/SliceBuilder/index.tsx +1 -1
  57. package/src/legacy/lib/builders/common/EditModal/index.jsx +1 -1
  58. package/src/legacy/lib/builders/common/Zone/Card/components/Hints/index.tsx +8 -1
  59. package/src/legacy/lib/builders/common/Zone/Card/components/NewField.tsx +1 -1
  60. package/src/legacy/lib/builders/common/Zone/Card/index.jsx +3 -1
  61. package/src/legacy/lib/builders/common/Zone/components/ZoneEmptyState/ZoneEmptyState.tsx +4 -13
  62. package/src/legacy/lib/builders/common/Zone/index.jsx +26 -31
  63. package/src/legacy/lib/builders/utils/index.ts +8 -0
  64. package/src/legacy/lib/models/common/Group.ts +51 -28
  65. package/src/legacy/lib/models/common/widgets/Boolean/index.ts +2 -4
  66. package/src/legacy/lib/models/common/widgets/Color/index.ts +2 -4
  67. package/src/legacy/lib/models/common/widgets/ContentRelationship/index.ts +0 -2
  68. package/src/legacy/lib/models/common/widgets/Date/index.ts +0 -2
  69. package/src/legacy/lib/models/common/widgets/Embed/index.ts +2 -4
  70. package/src/legacy/lib/models/common/widgets/GeoPoint/index.ts +2 -4
  71. package/src/legacy/lib/models/common/widgets/Group/ListItem/index.jsx +46 -26
  72. package/src/legacy/lib/models/common/widgets/Group/createGroupWidget.ts +81 -0
  73. package/src/legacy/lib/models/common/widgets/Group/index.tsx +72 -0
  74. package/src/legacy/lib/models/common/widgets/Image/index.ts +2 -4
  75. package/src/legacy/lib/models/common/widgets/Link/index.ts +2 -4
  76. package/src/legacy/lib/models/common/widgets/LinkToMedia/index.ts +2 -4
  77. package/src/legacy/lib/models/common/widgets/NestedGroup/index.tsx +40 -0
  78. package/src/legacy/lib/models/common/widgets/Number/index.ts +2 -4
  79. package/src/legacy/lib/models/common/widgets/Select/index.ts +2 -4
  80. package/src/legacy/lib/models/common/widgets/StructuredText/index.ts +0 -2
  81. package/src/legacy/lib/models/common/widgets/Text/index.ts +0 -2
  82. package/src/legacy/lib/models/common/widgets/Timestamp/index.ts +2 -4
  83. package/src/legacy/lib/models/common/widgets/UID/index.ts +2 -4
  84. package/src/legacy/lib/models/common/widgets/Widget.ts +10 -3
  85. package/src/legacy/lib/models/common/widgets/groupWidgets.ts +7 -0
  86. package/src/legacy/lib/models/common/widgets/index.ts +7 -31
  87. package/src/legacy/lib/models/common/widgets/nonGroupWidgets.ts +33 -0
  88. package/test/lib/builders/buildersUtils.test.ts +1 -1
  89. package/test/lib/models/common/widgets/index.test.ts +1 -1
  90. package/tsconfig.json +0 -1
  91. package/out/_next/static/JGphUg6eFq0-W11Pa7cMU/_buildManifest.js +0 -1
  92. package/out/_next/static/chunks/18539003-eda642ad962ef598.js +0 -22
  93. package/out/_next/static/chunks/264-4bb6f3fb14863ef3.js +0 -1
  94. package/out/_next/static/chunks/574-6039c48fbc93b4a8.js +0 -1
  95. package/out/_next/static/chunks/59b4e022-7a3b5554b806349f.js +0 -1
  96. package/out/_next/static/chunks/756-1e44fe84bedc262b.js +0 -10
  97. package/out/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js +0 -1
  98. package/out/_next/static/chunks/pages/_app-05ac13d573829b68.js +0 -532
  99. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-996e20b9b295a912.js +0 -1
  100. package/out/_next/static/css/b3bb731ce567d63f.css +0 -1
  101. package/src/legacy/lib/builders/common/SelectFieldTypeModal/FieldTypeCard.jsx +0 -51
  102. package/src/legacy/lib/builders/common/SelectFieldTypeModal/index.jsx +0 -84
  103. package/src/legacy/lib/models/common/widgets/Group/index.ts +0 -44
  104. package/src/legacy/lib/models/common/widgets/ctBuilderArray.ts +0 -20
  105. package/src/legacy/lib/models/common/widgets/groupBuilderArray.ts +0 -18
  106. package/src/legacy/lib/models/common/widgets/sliceBuilderArray.ts +0 -19
  107. package/src/legacy/lib/models/common/widgets/withGroup.ts +0 -2
  108. /package/out/_next/static/{JGphUg6eFq0-W11Pa7cMU → lnoCw12ueMqf698VD8pfN}/_ssgManifest.js +0 -0
@@ -1,51 +0,0 @@
1
- import { Box, Flex, Heading, Text, useThemeUI } from "theme-ui";
2
-
3
- const FieldTypeCard = ({ title, description, icon: WidgetIcon, onSelect }) => {
4
- const { theme } = useThemeUI();
5
- return (
6
- <Flex
7
- sx={{
8
- p: 3,
9
- my: 2,
10
- alignItems: "center",
11
- cursor: "pointer",
12
- borderRadius: "3px",
13
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
14
- border: (t) => `1px solid ${t.colors?.borders}`,
15
- "&:hover": {
16
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
17
- border: ({ colors }) => `1px solid ${colors.primary}`,
18
- boxShadow: "0 0 0 3px rgba(81, 99, 186, 0.2)",
19
- },
20
- }}
21
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
22
- data-testid={title}
23
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
24
- onClick={onSelect}
25
- >
26
- <WidgetIcon
27
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions
28
- label={`Select field of type "${title}"`}
29
- style={{
30
- color: theme.colors.primary,
31
- marginRight: "8px",
32
- borderRadius: "4px",
33
- padding: "5px",
34
- border: "2px solid",
35
- borderColor: theme.colors.primary,
36
- }}
37
- size={32}
38
- />
39
- <Box ml={1}>
40
- <Heading as="h4" sx={{ fontSize: 1 }}>
41
- <b>{title}</b>
42
- </Heading>
43
- <Text as="p" variant="xs">
44
- {description}
45
- </Text>
46
- </Box>
47
- </Flex>
48
- );
49
- };
50
-
51
- export default FieldTypeCard;
@@ -1,84 +0,0 @@
1
- import Modal from "react-modal";
2
- import { Close, Flex, Heading } from "theme-ui";
3
-
4
- import Card from "@/legacy/components/Card";
5
- import { Col, Flex as FlexGrid } from "@/legacy/components/Flex";
6
- import SliceMachineModal from "@/legacy/components/SliceMachineModal";
7
-
8
- import FieldTypeCard from "./FieldTypeCard";
9
-
10
- if (process.env.NODE_ENV !== "test") {
11
- Modal.setAppElement("#__next");
12
- }
13
-
14
- const SelectFieldTypeModal = ({ data, close, onSelect, widgetsArray }) => {
15
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/strict-boolean-expressions
16
- if (!data.isOpen) {
17
- return null;
18
- }
19
- return (
20
- <SliceMachineModal
21
- isOpen
22
- shouldCloseOnOverlayClick
23
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
24
- onRequestClose={close}
25
- contentLabel="Widget Form Modal"
26
- >
27
- <Card
28
- borderFooter
29
- footerSx={{ p: 3 }}
30
- bodySx={{ pt: 2, pb: 4, px: 4 }}
31
- sx={{ border: "none" }}
32
- Header={({ radius }) => (
33
- <Flex
34
- sx={{
35
- position: "sticky",
36
- top: 0,
37
- zIndex: 1,
38
- p: 3,
39
- pl: 4,
40
- bg: "headSection",
41
- alignItems: "center",
42
- justifyContent: "space-between",
43
- borderTopLeftRadius: radius,
44
- borderTopRightRadius: radius,
45
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
46
- borderBottom: (t) => `1px solid ${t.colors?.borders}`,
47
- }}
48
- >
49
- <Heading>Add a new field</Heading>
50
-
51
- <Close // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-assignment
52
- onClick={close}
53
- />
54
- </Flex>
55
- )}
56
- >
57
- <FlexGrid>
58
- {
59
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
60
- widgetsArray
61
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
62
- .filter((e) => e)
63
- .map((widget) => {
64
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
65
- const { Meta, TYPE_NAME, CUSTOM_NAME } = widget;
66
- return (
67
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/strict-boolean-expressions
68
- <Col key={CUSTOM_NAME || TYPE_NAME}>
69
- <FieldTypeCard
70
- {...Meta}
71
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/strict-boolean-expressions
72
- onSelect={() => onSelect(CUSTOM_NAME || TYPE_NAME)}
73
- />
74
- </Col>
75
- );
76
- })
77
- }
78
- </FlexGrid>
79
- </Card>
80
- </SliceMachineModal>
81
- );
82
- };
83
-
84
- export default SelectFieldTypeModal;
@@ -1,44 +0,0 @@
1
- import { MdPlaylistAdd } from "react-icons/md";
2
- import * as yup from "yup";
3
-
4
- import { GroupSM } from "@/legacy/lib/models/common/Group";
5
-
6
- import { Widget } from "../Widget";
7
- import Form, { FormFields } from "./Form";
8
- import CustomListItem from "./ListItem";
9
-
10
- const Meta = {
11
- icon: MdPlaylistAdd,
12
- title: "Group",
13
- description: "A repeatable set of fields",
14
- };
15
-
16
- const schema = yup.object().shape({
17
- type: yup
18
- .string()
19
- .matches(/^Group$/, { excludeEmptyString: true })
20
- .required(),
21
- config: yup.object().shape({
22
- fields: yup.array(),
23
- label: yup.string(),
24
- placeholder: yup.string(),
25
- repeat: yup.boolean().optional(),
26
- }),
27
- });
28
-
29
- export const GroupWidget: Widget<GroupSM, typeof schema> = {
30
- Meta,
31
- Form,
32
- FormFields,
33
- schema,
34
- create: (label: string) => ({
35
- type: "Group",
36
- config: {
37
- label,
38
- repeat: true,
39
- fields: [],
40
- },
41
- }),
42
- CustomListItem,
43
- TYPE_NAME: "Group",
44
- };
@@ -1,20 +0,0 @@
1
- import * as Widgets from "./withGroup";
2
-
3
- export default [
4
- Widgets.UID,
5
- Widgets.Group,
6
- Widgets.StructuredText,
7
- Widgets.Image,
8
- Widgets.Link,
9
- Widgets.LinkToMedia,
10
- Widgets.ContentRelationship,
11
- Widgets.Select,
12
- Widgets.Boolean,
13
- Widgets.Date,
14
- Widgets.Timestamp,
15
- Widgets.Embed,
16
- Widgets.Number,
17
- Widgets.GeoPoint,
18
- Widgets.Color,
19
- Widgets.Text,
20
- ];
@@ -1,18 +0,0 @@
1
- import * as Widgets from ".";
2
-
3
- export default [
4
- Widgets.StructuredText,
5
- Widgets.Image,
6
- Widgets.Link,
7
- Widgets.LinkToMedia,
8
- Widgets.ContentRelationship,
9
- Widgets.Select,
10
- Widgets.Boolean,
11
- Widgets.Date,
12
- Widgets.Timestamp,
13
- Widgets.Embed,
14
- Widgets.Number,
15
- Widgets.GeoPoint,
16
- Widgets.Color,
17
- Widgets.Text,
18
- ];
@@ -1,19 +0,0 @@
1
- import * as Widgets from "./withGroup";
2
-
3
- export default [
4
- Widgets.Group,
5
- Widgets.StructuredText,
6
- Widgets.Image,
7
- Widgets.Link,
8
- Widgets.LinkToMedia,
9
- Widgets.ContentRelationship,
10
- Widgets.Select,
11
- Widgets.Boolean,
12
- Widgets.Date,
13
- Widgets.Timestamp,
14
- Widgets.Embed,
15
- Widgets.Number,
16
- Widgets.GeoPoint,
17
- Widgets.Color,
18
- Widgets.Text,
19
- ];
@@ -1,2 +0,0 @@
1
- export * from ".";
2
- export { GroupWidget as Group } from "./Group";