@griddo/ax 1.61.5 → 1.62.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.
Files changed (73) hide show
  1. package/package.json +2 -2
  2. package/src/components/ActionMenu/style.tsx +1 -0
  3. package/src/components/ConfigPanel/Form/ConnectedField/NavConnectedField/index.tsx +3 -1
  4. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/index.tsx +17 -2
  5. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/index.tsx +3 -0
  6. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/index.tsx +3 -0
  7. package/src/components/ConfigPanel/Form/index.tsx +3 -1
  8. package/src/components/ConfigPanel/NavigationForm/Field/index.tsx +3 -1
  9. package/src/components/ConfigPanel/NavigationForm/index.tsx +3 -2
  10. package/src/components/ConfigPanel/index.tsx +4 -1
  11. package/src/components/ElementsTooltip/index.tsx +22 -8
  12. package/src/components/ElementsTooltip/style.tsx +6 -4
  13. package/src/components/FieldContainer/index.tsx +1 -0
  14. package/src/components/Fields/AnalyticsField/PageAnalytics/atoms.tsx +3 -2
  15. package/src/components/Fields/AnalyticsField/PageAnalytics/index.tsx +3 -3
  16. package/src/components/Fields/AnalyticsField/StructuredDataAnalytics/atoms.tsx +3 -2
  17. package/src/components/Fields/AnalyticsField/StructuredDataAnalytics/index.tsx +3 -3
  18. package/src/components/Fields/ColorPicker/index.tsx +28 -3
  19. package/src/components/Fields/ComponentArray/MixableComponentArray/AddItemButton/index.tsx +3 -1
  20. package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +4 -0
  21. package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +3 -0
  22. package/src/components/Fields/ComponentContainer/EmptyContainer/index.tsx +3 -1
  23. package/src/components/Fields/ComponentContainer/index.tsx +4 -0
  24. package/src/components/Fields/FieldGroup/index.tsx +4 -3
  25. package/src/components/Fields/FileField/index.tsx +0 -7
  26. package/src/components/Fields/ImageField/style.tsx +1 -0
  27. package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/style.tsx +0 -1
  28. package/src/components/Fields/TextArea/index.tsx +14 -3
  29. package/src/components/Fields/VisualUniqueSelection/ImageSelection/index.tsx +8 -2
  30. package/src/components/Fields/VisualUniqueSelection/ScrollableSelection/index.tsx +8 -4
  31. package/src/components/Fields/VisualUniqueSelection/utils.tsx +30 -0
  32. package/src/components/Gallery/index.tsx +10 -4
  33. package/src/components/MainWrapper/AppBar/style.tsx +0 -2
  34. package/src/components/MainWrapper/style.tsx +5 -3
  35. package/src/components/SideModal/SideModalOption/index.tsx +5 -4
  36. package/src/components/SideModal/index.tsx +19 -14
  37. package/src/containers/Analytics/actions.tsx +23 -1
  38. package/src/containers/Analytics/reducer.tsx +2 -0
  39. package/src/containers/Sites/actions.tsx +15 -5
  40. package/src/forms/fields.tsx +7 -2
  41. package/src/helpers/images.tsx +2 -5
  42. package/src/helpers/index.tsx +6 -0
  43. package/src/helpers/schemas.tsx +14 -2
  44. package/src/helpers/thumbnails.tsx +3 -3
  45. package/src/modules/Analytics/DimensionItem/index.tsx +2 -2
  46. package/src/modules/Analytics/DimensionPanel/index.tsx +60 -33
  47. package/src/modules/Analytics/DimensionPanel/style.tsx +10 -1
  48. package/src/modules/Analytics/GroupPanel/index.tsx +22 -5
  49. package/src/modules/Analytics/GroupPanel/style.tsx +1 -1
  50. package/src/modules/Analytics/index.tsx +8 -8
  51. package/src/modules/App/Routing/NavMenu/style.tsx +2 -0
  52. package/src/modules/Content/OptionTable/index.tsx +5 -2
  53. package/src/modules/Content/PageItem/index.tsx +2 -2
  54. package/src/modules/Content/index.tsx +7 -3
  55. package/src/modules/GlobalEditor/Editor/index.tsx +5 -1
  56. package/src/modules/GlobalSettings/Robots/Item/RobotsPanel/index.tsx +1 -1
  57. package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/index.tsx +5 -1
  58. package/src/modules/PageEditor/Editor/index.tsx +5 -1
  59. package/src/modules/Settings/Analytics/atoms.tsx +132 -0
  60. package/src/modules/Settings/Analytics/index.tsx +109 -0
  61. package/src/modules/Settings/Analytics/style.tsx +107 -0
  62. package/src/modules/Settings/ContentTypes/DataPacks/AddModal/index.tsx +10 -4
  63. package/src/modules/Settings/ContentTypes/DataPacks/Config/index.tsx +30 -20
  64. package/src/modules/Settings/ContentTypes/DataPacks/Item/index.tsx +12 -6
  65. package/src/modules/StructuredData/Form/ConnectedField/index.tsx +4 -2
  66. package/src/modules/StructuredData/Form/index.tsx +3 -3
  67. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +1 -1
  68. package/src/modules/StructuredData/StructuredDataList/OptionTable/index.tsx +7 -1
  69. package/src/modules/StructuredData/StructuredDataList/index.tsx +2 -2
  70. package/src/routes/site.tsx +6 -0
  71. package/src/schemas/pages/GlobalPage.tsx +13 -2
  72. package/src/schemas/pages/Page.tsx +13 -2
  73. package/src/types/index.tsx +1 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "1.61.5",
4
+ "version": "1.62.0",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -244,5 +244,5 @@
244
244
  "publishConfig": {
245
245
  "access": "public"
246
246
  },
247
- "gitHead": "8f38eefe62d2ac5de9bddc50731e829823531aba"
247
+ "gitHead": "ccd43cb7570877ce9c1e21d7656202dd35ec500f"
248
248
  }
@@ -43,6 +43,7 @@ export const ActionItem = styled.li<{ disabled?: boolean; color?: boolean }>`
43
43
  color: ${(p) => (p.disabled ? p.theme.color.interactiveDisabled : p.theme.color.textMediumEmphasis)};
44
44
  padding: ${(p) => p.theme.spacing.xs} ${(p) => p.theme.spacing.s};
45
45
  pointer-events: ${(p) => (p.disabled ? "none" : "auto")};
46
+ text-align: left;
46
47
  &:focus {
47
48
  background: ${(p) => (p.disabled ? "transparent" : p.theme.color.overlayFocusPrimary)};
48
49
  }
@@ -23,6 +23,7 @@ const NavConnectedField = (props: any) => {
23
23
  currentDefaultsContent,
24
24
  activatedTemplates,
25
25
  menus,
26
+ theme,
26
27
  } = props;
27
28
 
28
29
  const updateValue = (key: string, value: any) => {
@@ -54,7 +55,7 @@ const NavConnectedField = (props: any) => {
54
55
 
55
56
  if (isConditional) {
56
57
  const innerActions = { ...actions, updateValue, goTo };
57
- innerFields = getInnerFields(field.fields, innerActions, selectedContent, isTemplateActivated);
58
+ innerFields = getInnerFields(field.fields, innerActions, selectedContent, isTemplateActivated, theme);
58
59
  }
59
60
 
60
61
  return (
@@ -72,6 +73,7 @@ const NavConnectedField = (props: any) => {
72
73
  lang={lang}
73
74
  disabled={isDisabled}
74
75
  innerFields={innerFields}
76
+ theme={theme}
75
77
  />
76
78
  );
77
79
  };
@@ -24,9 +24,11 @@ const Field = (props: IProps): JSX.Element => {
24
24
  error,
25
25
  deleteError,
26
26
  errors,
27
+ theme,
27
28
  } = props;
28
29
 
29
30
  const isGroup = field.type === "FieldGroup";
31
+ const isCollapsed = isGroup && field.collapsed;
30
32
  const isConditional = field.type === "ConditionalField";
31
33
  const isArrayGroup = field.type === "ArrayFieldGroup";
32
34
 
@@ -34,11 +36,21 @@ const Field = (props: IProps): JSX.Element => {
34
36
 
35
37
  if (isGroup || isConditional || isArrayGroup) {
36
38
  const innerActions = { ...actions, updateValue, goTo };
37
- innerFields = getInnerFields(field.fields, innerActions, selectedContent, isTemplateActivated, errors, deleteError);
39
+ innerFields = getInnerFields(
40
+ field.fields,
41
+ innerActions,
42
+ selectedContent,
43
+ isTemplateActivated,
44
+ theme,
45
+ errors,
46
+ deleteError
47
+ );
38
48
  }
39
49
 
40
50
  return isGroup ? (
41
- <FieldGroup title={field.title}>{innerFields}</FieldGroup>
51
+ <FieldGroup title={field.title} collapsed={isCollapsed}>
52
+ {innerFields}
53
+ </FieldGroup>
42
54
  ) : (
43
55
  <FieldContainer
44
56
  whiteList={whiteList}
@@ -59,6 +71,7 @@ const Field = (props: IProps): JSX.Element => {
59
71
  categories={categories}
60
72
  error={error}
61
73
  deleteError={deleteError}
74
+ theme={theme}
62
75
  />
63
76
  );
64
77
  };
@@ -82,6 +95,8 @@ interface IProps {
82
95
  error?: IErrorItem;
83
96
  deleteError(error: IErrorItem): void;
84
97
  errors: IErrorItem[];
98
+ collapsed?: boolean;
99
+ theme: string;
85
100
  }
86
101
 
87
102
  export default Field;
@@ -24,6 +24,7 @@ export const TemplateManager = (props: IProps): JSX.Element => {
24
24
  isTemplateActivated,
25
25
  deleteError,
26
26
  errors,
27
+ theme,
27
28
  } = props;
28
29
 
29
30
  const isConfig = selectedTab === "config";
@@ -90,6 +91,7 @@ export const TemplateManager = (props: IProps): JSX.Element => {
90
91
  error={error}
91
92
  deleteError={deleteError}
92
93
  errors={errors}
94
+ theme={theme}
93
95
  />
94
96
  );
95
97
  })}
@@ -113,6 +115,7 @@ interface IProps {
113
115
  isTemplateActivated: boolean;
114
116
  deleteError(error: IErrorItem): void;
115
117
  errors: IErrorItem[];
118
+ theme: string;
116
119
  }
117
120
 
118
121
  const mapStateToProps = (state: IRootState) => ({
@@ -33,6 +33,7 @@ const PageConnectedField = (props: any) => {
33
33
  errors,
34
34
  deleteError,
35
35
  isGlobal,
36
+ theme,
36
37
  } = props;
37
38
 
38
39
  const isTemplate = field.type === "template";
@@ -153,6 +154,7 @@ const PageConnectedField = (props: any) => {
153
154
  isTemplateActivated={isTemplateActivated}
154
155
  deleteError={deleteError}
155
156
  errors={errors}
157
+ theme={theme}
156
158
  />
157
159
  );
158
160
  }
@@ -176,6 +178,7 @@ const PageConnectedField = (props: any) => {
176
178
  error={error}
177
179
  deleteError={deleteError}
178
180
  errors={errors}
181
+ theme={theme}
179
182
  />
180
183
  );
181
184
  };
@@ -6,7 +6,7 @@ import { Tabs } from "@ax/components";
6
6
  import ConnectedField from "./ConnectedField";
7
7
 
8
8
  export const Form = (props: IProps): JSX.Element => {
9
- const { schema, selectedTab, setSelectedTab, actions, isPage, isGlobal } = props;
9
+ const { schema, selectedTab, setSelectedTab, actions, isPage, isGlobal, theme } = props;
10
10
  const tabContent = schema.configTabs.find((tab: ISchemaTab) => tab.title === selectedTab);
11
11
  const setTab = (tab: string) => setSelectedTab(tab);
12
12
 
@@ -28,6 +28,7 @@ export const Form = (props: IProps): JSX.Element => {
28
28
  componentType={schema.schemaType}
29
29
  isPage={isPage}
30
30
  isGlobal={isGlobal}
31
+ theme={theme}
31
32
  />
32
33
  );
33
34
  };
@@ -67,6 +68,7 @@ interface IProps {
67
68
  setSelectedContent(editorID: number): void;
68
69
  isPage: boolean;
69
70
  isGlobal?: boolean;
71
+ theme: string;
70
72
  }
71
73
 
72
74
  export default Form;
@@ -10,7 +10,7 @@ import * as S from "./style";
10
10
  const pageEditorID = 0;
11
11
 
12
12
  const Field = (props: IProps) => {
13
- const { type, defaults, updateEditorContent, selectedContent } = props;
13
+ const { type, defaults, updateEditorContent, selectedContent, theme } = props;
14
14
  const { isOpen, toggleModal } = useModal();
15
15
 
16
16
  const options = defaults.filter((component: any) => component.type === type);
@@ -57,6 +57,7 @@ const Field = (props: IProps) => {
57
57
  toggleModal={toggleModal}
58
58
  isOpen={isOpen}
59
59
  setDefault={setDefault}
60
+ theme={theme}
60
61
  />
61
62
  )}
62
63
  </>
@@ -65,6 +66,7 @@ const Field = (props: IProps) => {
65
66
 
66
67
  interface IField {
67
68
  type: string;
69
+ theme: string;
68
70
  }
69
71
 
70
72
  interface IStateProps {
@@ -8,7 +8,7 @@ import * as S from "./style";
8
8
  const noteText = "To create a new header or configure one of them, go to Navigation/Navigations modules";
9
9
 
10
10
  const NavigationForm = (props: IProps): JSX.Element => {
11
- const { schema } = props;
11
+ const { schema, theme } = props;
12
12
 
13
13
  return (
14
14
  <>
@@ -17,7 +17,7 @@ const NavigationForm = (props: IProps): JSX.Element => {
17
17
  <NoteField value={{ text: noteText }} />
18
18
  </S.FieldWrapper>
19
19
  <S.FieldWrapper>
20
- <Field type={schema.type} />
20
+ <Field type={schema.type} theme={theme} />
21
21
  </S.FieldWrapper>
22
22
  </>
23
23
  );
@@ -25,6 +25,7 @@ const NavigationForm = (props: IProps): JSX.Element => {
25
25
 
26
26
  interface IProps {
27
27
  schema: any;
28
+ theme: string;
28
29
  }
29
30
 
30
31
  export default NavigationForm;
@@ -30,6 +30,7 @@ const ConfigPanel = (props: IStateProps): JSX.Element => {
30
30
  setHistoryPush,
31
31
  isPreviewMode,
32
32
  userEditing,
33
+ theme,
33
34
  } = props;
34
35
 
35
36
  if (isLoading || isEmptyObj(schema)) {
@@ -43,7 +44,7 @@ const ConfigPanel = (props: IStateProps): JSX.Element => {
43
44
  if (isPreviewMode) {
44
45
  return <PreviewForm setSelectedTab={setSelectedTab} selectedTab={selectedTab} userEditing={userEditing} />;
45
46
  } else if (showNavigationForm) {
46
- return <NavigationForm schema={schema} />;
47
+ return <NavigationForm schema={schema} theme={theme} />;
47
48
  } else if (isGlobalPageNotEditable) {
48
49
  return (
49
50
  <GlobalPageForm
@@ -65,6 +66,7 @@ const ConfigPanel = (props: IStateProps): JSX.Element => {
65
66
  selectedTab={selectedTab}
66
67
  isPage={isPage}
67
68
  isGlobal={isGlobal}
69
+ theme={theme}
68
70
  />
69
71
  );
70
72
  }
@@ -102,6 +104,7 @@ interface IStateProps {
102
104
  setHistoryPush?: (path: string, isEditor: boolean) => void;
103
105
  isPreviewMode?: boolean;
104
106
  userEditing?: IUserEditing | null;
107
+ theme: string;
105
108
  }
106
109
 
107
110
  export default ConfigPanel;
@@ -3,14 +3,21 @@ import { trimText } from "@ax/helpers";
3
3
 
4
4
  import * as S from "./style";
5
5
 
6
- const ExpandedTooltip = (props: IProps): JSX.Element => {
7
- const { elements, maxChar, defaultElements = 1, colors, rounded = false } = props;
6
+ const ElementsTooltip = (props: IProps): JSX.Element => {
7
+ const { elements, maxChar, defaultElements = 1, colors, rounded = false, elementsPerRow = 1 } = props;
8
8
 
9
9
  if (!elements) return <></>;
10
10
 
11
11
  const visibleElements = elements?.slice(0, defaultElements);
12
12
  const remainingElements = elements.length - defaultElements;
13
13
 
14
+ const elementsRows: string[][] = [];
15
+ elements.forEach((element, idx) => {
16
+ const row = Math.floor(idx / elementsPerRow);
17
+ const isNewRow = idx % elementsPerRow === 0;
18
+ elementsRows[row] = isNewRow ? [element] : [...elementsRows[row], element];
19
+ })
20
+
14
21
  return (
15
22
  <S.Wrapper>
16
23
  {visibleElements.map((fullElement, idx) => {
@@ -26,12 +33,18 @@ const ExpandedTooltip = (props: IProps): JSX.Element => {
26
33
  <S.Element rounded={rounded}>
27
34
  +{remainingElements}
28
35
  <S.Tooltip>
29
- {elements.map((element, idx) => {
30
- const color = colors && colors[element] ? colors[element] : undefined;
36
+ {elementsRows.map((row, idx) => {
31
37
  return (
32
- <S.Element key={idx} color={color} rounded={rounded}>
33
- {element}
34
- </S.Element>
38
+ <S.Row key={idx}>
39
+ {row.map((element, idx) => {
40
+ const color = colors && colors[element] ? colors[element] : undefined;
41
+ return (
42
+ <S.Element key={idx} color={color} rounded={rounded}>
43
+ {element}
44
+ </S.Element>
45
+ );
46
+ })}
47
+ </S.Row>
35
48
  );
36
49
  })}
37
50
  </S.Tooltip>
@@ -47,6 +60,7 @@ interface IProps {
47
60
  maxChar?: number;
48
61
  colors?: any;
49
62
  rounded?: boolean;
63
+ elementsPerRow?: number;
50
64
  }
51
65
 
52
- export default ExpandedTooltip;
66
+ export default ElementsTooltip;
@@ -9,14 +9,12 @@ const Tooltip = styled.div`
9
9
  position: absolute;
10
10
  z-index: 1;
11
11
  display: none;
12
- flex-flow: row wrap;
13
12
  padding: ${(p) => p.theme.spacing.s};
14
13
  top: -50%;
15
14
  transform: translateX(-50%);
16
15
  box-shadow: ${(p) => p.theme.shadow.shadowL};
17
16
  background-color: ${(p) => p.theme.colors.uiBarBackground};
18
17
  border-radius: ${(p) => p.theme.radii.s};
19
- max-width: 350px;
20
18
  `;
21
19
 
22
20
  const Element = styled.div<{ color?: string; rounded: boolean }>`
@@ -30,8 +28,12 @@ const Element = styled.div<{ color?: string; rounded: boolean }>`
30
28
  white-space: nowrap;
31
29
 
32
30
  &:hover > ${Tooltip} {
33
- display: flex;
31
+ display: block;
34
32
  }
35
33
  `;
36
34
 
37
- export { Wrapper, Element, Tooltip };
35
+ const Row = styled.div`
36
+ display: flex;
37
+ `;
38
+
39
+ export { Wrapper, Element, Tooltip, Row };
@@ -76,4 +76,5 @@ interface IProps {
76
76
  activatedModules?: string[];
77
77
  error?: any;
78
78
  deleteError?(error: any): void;
79
+ theme: string;
79
80
  }
@@ -51,12 +51,13 @@ const DimensionValue = (props: { dimension: IDimension, setDimension: (value: Re
51
51
  }
52
52
 
53
53
  const isNullValue = dimensionValues.includes("null");
54
+ const fieldValue = values && dimension ? values[dimension.name] : "";
54
55
 
55
56
  return isNullValue ? (
56
57
  <FieldsBehavior
57
58
  title={dimension?.name}
58
59
  fieldType="TextField"
59
- value={dimension ? values[dimension.name] : ""}
60
+ value={fieldValue}
60
61
  onChange={handleOnChange}
61
62
  placeholder="Type a variable"
62
63
  />
@@ -65,7 +66,7 @@ const DimensionValue = (props: { dimension: IDimension, setDimension: (value: Re
65
66
  title={dimension?.name}
66
67
  fieldType="Select"
67
68
  options={options}
68
- value={dimension ? values[dimension.name] : ""}
69
+ value={fieldValue}
69
70
  onChange={handleOnChange}
70
71
  placeholder="Select variable"
71
72
  />
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
 
3
- import { NoteField, FieldsBehavior, FieldGroup } from "@ax/components";
3
+ import { NoteField, FieldsBehavior } from "@ax/components";
4
4
 
5
5
  import { IAnalyticsFieldProps, IState } from "..";
6
6
  import { DimensionsGroup, DimensionsSelection } from "./atoms";
@@ -93,7 +93,7 @@ const PageAnalytics = (props: IAnalyticsFieldProps): JSX.Element => {
93
93
  });
94
94
 
95
95
  return (
96
- <FieldGroup title="Analytics Data Layer">
96
+ <>
97
97
  <NoteField value={{ text: noteText }} />
98
98
  <S.FieldWrapper>
99
99
  <FieldsBehavior
@@ -133,7 +133,7 @@ const PageAnalytics = (props: IAnalyticsFieldProps): JSX.Element => {
133
133
  {!!state.dimensionsSelect && <DimensionsSelection {...{ analytics, state, setDimension }} />}
134
134
  </>
135
135
  )}
136
- </FieldGroup>
136
+ </>
137
137
  );
138
138
  };
139
139
 
@@ -46,12 +46,13 @@ const DimensionValue = (props: { dimension: IDimension, setDimension: (value: Re
46
46
  }
47
47
 
48
48
  const isNullValue = dimensionValues.includes("null");
49
+ const fieldValue = values && dimension ? values[dimension.name] : "";
49
50
 
50
51
  return isNullValue ? (
51
52
  <FieldsBehavior
52
53
  title={dimension?.name}
53
54
  fieldType="TextField"
54
- value={dimension ? values[dimension.name] : ""}
55
+ value={fieldValue}
55
56
  onChange={handleOnChange}
56
57
  placeholder="Type a variable"
57
58
  />
@@ -60,7 +61,7 @@ const DimensionValue = (props: { dimension: IDimension, setDimension: (value: Re
60
61
  title={dimension?.name}
61
62
  fieldType="Select"
62
63
  options={options}
63
- value={dimension ? values[dimension.name] : ""}
64
+ value={fieldValue}
64
65
  onChange={handleOnChange}
65
66
  placeholder="Select variable"
66
67
  />
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
 
3
- import { FieldsBehavior, FieldGroup } from "@ax/components";
3
+ import { FieldsBehavior } from "@ax/components";
4
4
 
5
5
  import { IAnalyticsFieldProps, IState } from "..";
6
6
  import { getTemplateDimensions } from "../utils";
@@ -65,7 +65,7 @@ const StructuredDataAnalytics = (props: IAnalyticsFieldProps): JSX.Element => {
65
65
  });
66
66
 
67
67
  return (
68
- <FieldGroup title="Analytics Data Layer">
68
+ <>
69
69
  <TemplateDimensions dimensionNames={templateDimensions} {...{ analytics, state, setDimension }} />
70
70
  {dimensionOptions.length > 1 && (
71
71
  <>
@@ -83,7 +83,7 @@ const StructuredDataAnalytics = (props: IAnalyticsFieldProps): JSX.Element => {
83
83
  {!!state.dimensionsSelect && <DimensionsSelection {...{ analytics, state, setDimension }} />}
84
84
  </>
85
85
  )}
86
- </FieldGroup>
86
+ </>
87
87
  );
88
88
  };
89
89
 
@@ -8,7 +8,7 @@ import { hex3to6 } from "./helpers";
8
8
  import * as S from "./style";
9
9
 
10
10
  const ColorPicker = (props: IProps): JSX.Element => {
11
- const { value, onChange, error, colors, handleValidation } = props;
11
+ const { value, onChange, error, colors, handleValidation, theme } = props;
12
12
 
13
13
  const initialState = { color: value, inputValue: value };
14
14
  const reducer = useCallback((state: any, payload: any) => ({ ...state, ...payload }), []);
@@ -59,6 +59,30 @@ const ColorPicker = (props: IProps): JSX.Element => {
59
59
 
60
60
  const icon = isVisible ? "close" : "colorPicker";
61
61
 
62
+ const defaultOptions = (vusOptions: Record<string, unknown>[]) => {
63
+ return !vusOptions.find((entry) => entry.theme);
64
+ };
65
+
66
+ const getOptions = (theme: string, colorOptions: any[] | undefined) => {
67
+ if (!colorOptions) return undefined;
68
+
69
+ const themes = colorOptions.filter((entry) => entry.theme).map((entry) => entry.theme);
70
+ const themeExists = themes.includes(theme);
71
+ const defaultsOptions = colorOptions.filter((entry) => typeof entry === "string");
72
+
73
+ // 1 - Si options solo tiene las defaults options (legacy) devuelve las defaults.
74
+ // 2 - Si options no tiene el theme, devuelve las defaults.
75
+ if (defaultOptions(colorOptions) || !themeExists) return defaultsOptions;
76
+
77
+ // Si options tiene el theme, devuelve las options de ese theme.
78
+ if (themeExists) {
79
+ const optionsObj = colorOptions.find((entry) => entry.theme === theme);
80
+ return optionsObj && optionsObj.options;
81
+ }
82
+
83
+ return [];
84
+ };
85
+
62
86
  return (
63
87
  <S.Wrapper ref={wrapper}>
64
88
  <S.InputWrapper>
@@ -75,7 +99,7 @@ const ColorPicker = (props: IProps): JSX.Element => {
75
99
  <IconAction icon={icon} size="s" onClick={togglePicker} />
76
100
  </S.IconWrapper>
77
101
  </S.InputWrapper>
78
- {isVisible && <Picker value={state.color} onChange={handlePickerChange} colors={colors} />}
102
+ {isVisible && <Picker value={state.color} onChange={handlePickerChange} colors={getOptions(theme, colors)} />}
79
103
  </S.Wrapper>
80
104
  );
81
105
  };
@@ -83,9 +107,10 @@ const ColorPicker = (props: IProps): JSX.Element => {
83
107
  export interface IProps {
84
108
  value: string;
85
109
  error?: boolean;
86
- colors?: string[];
110
+ colors?: string[] | Record<string, unknown>[];
87
111
  onChange: (newColor: string) => void;
88
112
  handleValidation?: (value: string, validators: Record<string, unknown>) => void;
113
+ theme: string;
89
114
  }
90
115
 
91
116
  export default memo(ColorPicker);
@@ -3,7 +3,7 @@ import { useModal } from "@ax/hooks";
3
3
  import { IconAction, SideModal, Tooltip } from "@ax/components";
4
4
 
5
5
  const AddItemButton = (props: IProps) => {
6
- const { handleClick, whiteList, isModuleArr, categories } = props;
6
+ const { handleClick, whiteList, isModuleArr, categories, theme } = props;
7
7
  const { isOpen, toggleModal } = useModal();
8
8
  const optionsType = isModuleArr ? "modules" : "components";
9
9
  const addAction = whiteList.length <= 1 ? () => handleClick(whiteList[0]) : toggleModal;
@@ -22,6 +22,7 @@ const AddItemButton = (props: IProps) => {
22
22
  toggleModal={toggleModal}
23
23
  isOpen={isOpen}
24
24
  handleClick={handleClick}
25
+ theme={theme}
25
26
  showSearch
26
27
  />
27
28
  </>
@@ -33,6 +34,7 @@ interface IProps {
33
34
  whiteList: any[];
34
35
  isModuleArr: boolean;
35
36
  categories?: any;
37
+ theme: string;
36
38
  }
37
39
 
38
40
  export default memo(AddItemButton);
@@ -24,6 +24,7 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
24
24
  objKey,
25
25
  field,
26
26
  mandatory,
27
+ theme,
27
28
  } = props;
28
29
 
29
30
  const type = getTypefromKey(objKey);
@@ -70,6 +71,7 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
70
71
  categories={categories}
71
72
  handleClick={handleAdd}
72
73
  isModuleArr={isModuleArr}
74
+ theme={theme}
73
75
  />
74
76
  )}
75
77
  </S.ItemRow>
@@ -99,6 +101,7 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
99
101
  disabled={disabled}
100
102
  canDuplicate={showAddItemButton && !isModuleDeactivated}
101
103
  parentKey={objKey}
104
+ theme={theme}
102
105
  />
103
106
  );
104
107
  })}
@@ -121,6 +124,7 @@ export interface IMixableComponentArrayProps {
121
124
  objKey: string;
122
125
  field: any;
123
126
  mandatory?: boolean;
127
+ theme: string;
124
128
  }
125
129
 
126
130
  export default MixableComponentArray;
@@ -24,6 +24,7 @@ const SameComponentArray = (props: ISameComponentArrayProps): JSX.Element => {
24
24
  objKey,
25
25
  field,
26
26
  mandatory,
27
+ theme,
27
28
  } = props;
28
29
 
29
30
  const type = getTypefromKey(objKey);
@@ -93,6 +94,7 @@ const SameComponentArray = (props: ISameComponentArrayProps): JSX.Element => {
93
94
  disabled={disabled}
94
95
  canDuplicate={showAddItemButton && !isModuleDeactivated}
95
96
  parentKey={objKey}
97
+ theme={theme}
96
98
  />
97
99
  );
98
100
  })}
@@ -116,6 +118,7 @@ export interface ISameComponentArrayProps {
116
118
  objKey: string;
117
119
  field: any;
118
120
  mandatory?: boolean;
121
+ theme: string;
119
122
  }
120
123
 
121
124
  export default SameComponentArray;
@@ -4,7 +4,7 @@ import { useModal } from "@ax/hooks";
4
4
  import { HiddenField, SideModal } from "@ax/components";
5
5
 
6
6
  const EmptyContainer = (props: IProps) => {
7
- const { hasMultipleOptions, whiteList, handleAdd, goTo, componentOptions, title, categories } = props;
7
+ const { hasMultipleOptions, whiteList, handleAdd, goTo, componentOptions, title, categories, theme } = props;
8
8
  const { isOpen, toggleModal } = useModal();
9
9
 
10
10
  const handleClick = () => (hasMultipleOptions ? toggleModal() : goTo());
@@ -23,6 +23,7 @@ const EmptyContainer = (props: IProps) => {
23
23
  handleClick={handleAdd}
24
24
  isOpen={isOpen}
25
25
  componentOptions={componentOptions}
26
+ theme={theme}
26
27
  />
27
28
  )}
28
29
  </>
@@ -37,6 +38,7 @@ interface IProps {
37
38
  title?: string;
38
39
  categories?: any;
39
40
  handleAdd: any;
41
+ theme: string;
40
42
  }
41
43
 
42
44
  export default EmptyContainer;
@@ -27,6 +27,7 @@ const ComponentContainer = (props: IComponentContainerProps): JSX.Element => {
27
27
  disabled,
28
28
  canDuplicate,
29
29
  parentKey,
30
+ theme
30
31
  } = props;
31
32
 
32
33
  let deleteModuleAction: any;
@@ -125,6 +126,7 @@ const ComponentContainer = (props: IComponentContainerProps): JSX.Element => {
125
126
  handleAdd={handleOptionClick}
126
127
  componentOptions={containerOptions}
127
128
  title={title}
129
+ theme={theme}
128
130
  />
129
131
  ) : (
130
132
  <>
@@ -155,6 +157,7 @@ const ComponentContainer = (props: IComponentContainerProps): JSX.Element => {
155
157
  isOpen={isOpen}
156
158
  componentOptions={containerOptions}
157
159
  current={currentComponent}
160
+ theme={theme}
158
161
  />
159
162
  )}
160
163
  </>
@@ -179,6 +182,7 @@ interface IComponentContainerProps {
179
182
  disabled?: boolean;
180
183
  canDuplicate?: boolean;
181
184
  parentKey?: string;
185
+ theme: string;
182
186
  }
183
187
 
184
188
  export default ComponentContainer;
@@ -2,9 +2,9 @@ import React, { useState } from "react";
2
2
 
3
3
  import * as S from "./style";
4
4
 
5
- const FieldGroup = (props: IFieldsGroupProps) => {
6
- const { title, children } = props;
7
- const [isOpen, setIsOpen] = useState(true);
5
+ const FieldGroup = (props: IFieldsGroupProps): React.ReactElement => {
6
+ const { title, children, collapsed } = props;
7
+ const [isOpen, setIsOpen] = useState(!collapsed);
8
8
 
9
9
  const handleClick = () => {
10
10
  setIsOpen(!isOpen);
@@ -25,4 +25,5 @@ export default FieldGroup;
25
25
  interface IFieldsGroupProps {
26
26
  title: string;
27
27
  children: any;
28
+ collapsed?: boolean;
28
29
  }