@griddo/ax 10.2.11 → 10.2.13

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 (56) hide show
  1. package/package.json +2 -2
  2. package/src/__tests__/components/Fields/ReferenceField/ReferenceField.test.tsx +1 -1
  3. package/src/__tests__/components/Fields/UrlField/UrlField.test.tsx +1 -1
  4. package/src/components/Fields/AsyncSelect/index.tsx +12 -8
  5. package/src/components/Fields/AsyncSelect/style.tsx +58 -1
  6. package/src/components/Fields/CheckField/index.tsx +15 -2
  7. package/src/components/Fields/IntegrationsField/IntegrationItem/CustomPanel/index.tsx +49 -47
  8. package/src/components/Fields/IntegrationsField/IntegrationItem/CustomPanel/style.tsx +6 -1
  9. package/src/components/Fields/IntegrationsField/IntegrationItem/VariablesPanel/index.tsx +13 -11
  10. package/src/components/Fields/IntegrationsField/IntegrationItem/VariablesPanel/style.tsx +6 -3
  11. package/src/components/Fields/MultiCheckSelect/style.tsx +1 -0
  12. package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/index.tsx +6 -5
  13. package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +277 -40
  14. package/src/components/Fields/ReferenceField/AutoPanel/style.tsx +117 -15
  15. package/src/components/Fields/ReferenceField/Context/index.tsx +18 -10
  16. package/src/components/Fields/ReferenceField/ItemList/Item/index.tsx +9 -30
  17. package/src/components/Fields/ReferenceField/ItemList/Item/style.tsx +9 -51
  18. package/src/components/Fields/ReferenceField/ItemList/index.tsx +14 -18
  19. package/src/components/Fields/ReferenceField/ManualPanel/Item/index.tsx +1 -1
  20. package/src/components/Fields/ReferenceField/ManualPanel/Item/style.tsx +25 -26
  21. package/src/components/Fields/ReferenceField/ManualPanel/index.tsx +91 -36
  22. package/src/components/Fields/ReferenceField/ManualPanel/style.tsx +29 -1
  23. package/src/components/Fields/ReferenceField/index.tsx +18 -11
  24. package/src/components/Fields/Select/index.tsx +10 -13
  25. package/src/components/Fields/Select/style.tsx +13 -7
  26. package/src/components/Fields/TimeField/index.tsx +1 -0
  27. package/src/components/Fields/UniqueCheck/index.tsx +3 -1
  28. package/src/components/Fields/UrlField/index.tsx +3 -1
  29. package/src/components/Fields/UrlField/style.tsx +6 -1
  30. package/src/components/FloatingPanel/style.tsx +0 -1
  31. package/src/components/PageFinder/index.tsx +8 -7
  32. package/src/components/SearchField/index.tsx +2 -3
  33. package/src/helpers/arrays.tsx +2 -2
  34. package/src/modules/Analytics/DimensionPanel/index.tsx +44 -42
  35. package/src/modules/Analytics/DimensionPanel/style.tsx +6 -1
  36. package/src/modules/Analytics/GroupPanel/index.tsx +57 -64
  37. package/src/modules/Analytics/GroupPanel/style.tsx +6 -0
  38. package/src/modules/Categories/CategoriesList/CategoryPanel/index.tsx +15 -13
  39. package/src/modules/Categories/CategoriesList/CategoryPanel/style.tsx +11 -4
  40. package/src/modules/GlobalSettings/Robots/Item/RobotsPanel/index.tsx +20 -18
  41. package/src/modules/GlobalSettings/Robots/Item/RobotsPanel/style.tsx +6 -1
  42. package/src/modules/Navigation/Menus/List/Table/ConfigPanel/index.tsx +8 -6
  43. package/src/modules/Navigation/Menus/List/Table/ConfigPanel/style.tsx +6 -1
  44. package/src/modules/Navigation/Menus/List/Table/SidePanel/index.tsx +15 -13
  45. package/src/modules/Navigation/Menus/List/Table/SidePanel/style.tsx +9 -2
  46. package/src/modules/PublicPreview/index.tsx +1 -1
  47. package/src/modules/Redirects/RedirectPanel/index.tsx +33 -31
  48. package/src/modules/Redirects/RedirectPanel/style.tsx +6 -1
  49. package/src/modules/Redirects/index.tsx +0 -1
  50. package/src/modules/Settings/Integrations/IntegrationForm/VariablePanel/index.tsx +63 -61
  51. package/src/modules/Settings/Integrations/IntegrationForm/VariablePanel/style.tsx +6 -1
  52. package/src/modules/Settings/Integrations/IntegrationForm/index.tsx +5 -3
  53. package/src/modules/Settings/Integrations/IntegrationForm/style.tsx +6 -0
  54. package/src/modules/Settings/Languages/LanguagePanel/index.tsx +14 -12
  55. package/src/modules/Settings/Languages/LanguagePanel/style.tsx +8 -1
  56. package/src/types/index.tsx +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "10.2.11",
4
+ "version": "10.2.13",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -231,5 +231,5 @@
231
231
  "publishConfig": {
232
232
  "access": "public"
233
233
  },
234
- "gitHead": "fadf0b0c9ced3461dea8670ad2df493d5cbf754a"
234
+ "gitHead": "f1f00452bac5e4e6342947c1903ced3e2b5a309c"
235
235
  }
@@ -61,7 +61,7 @@ describe("ReferenceField component rendering", () => {
61
61
  defaultProps.value = {
62
62
  order: "alpha-DESC",
63
63
  };
64
- defaultProps.selectionType = ["automatic"];
64
+ defaultProps.selectionType = ["auto"];
65
65
  const onChange = jest.fn();
66
66
  const initialState = { ...initialStore, ...defaultProps };
67
67
 
@@ -293,7 +293,7 @@ describe("UrlField component rendering", () => {
293
293
  const selectComponents = screen.getAllByTestId("select-component");
294
294
 
295
295
  await act(async () => {
296
- selectComponents[3].click();
296
+ selectComponents[2].click();
297
297
  });
298
298
 
299
299
  expect(selectComponents).toBeTruthy();
@@ -23,6 +23,8 @@ const AsyncSelect = (props: IAsyncSelectProps): JSX.Element => {
23
23
  filter,
24
24
  options,
25
25
  source,
26
+ type,
27
+ maxWidth,
26
28
  } = props;
27
29
 
28
30
  const initialState: { items: IOption[]; hasEmptyOption: boolean } = {
@@ -110,16 +112,14 @@ const AsyncSelect = (props: IAsyncSelectProps): JSX.Element => {
110
112
 
111
113
  // tslint:disable-next-line: no-shadowed-variable
112
114
  const getObjectValue = (val: any, options: IOption[]) => {
113
- if (!val) {
114
- return null;
115
- }
116
115
  const fixedVal = Array.isArray(val) ? val[0] : val;
117
- const selectedValue = typeof fixedVal === "object" ? fixedVal.id : fixedVal;
116
+ const selectedValue = fixedVal && typeof fixedVal === "object" ? fixedVal.id : fixedVal;
118
117
 
119
118
  return options && options.find((option: IOption) => option.value === selectedValue);
120
119
  };
121
120
 
122
- const className = error ? "react-select-error" : "";
121
+ const className = error ? `react-select-error ${type}` : type;
122
+ const searchable = type === "inline" ? false : true;
123
123
 
124
124
  return (
125
125
  <div data-testid="asyncSelect">
@@ -137,6 +137,8 @@ const AsyncSelect = (props: IAsyncSelectProps): JSX.Element => {
137
137
  className={className}
138
138
  mandatory={mandatory}
139
139
  hasEmptyOption={state.hasEmptyOption}
140
+ isSearchable={searchable}
141
+ maxWidth={maxWidth}
140
142
  />
141
143
  </div>
142
144
  );
@@ -160,14 +162,16 @@ export interface IAsyncSelectProps {
160
162
  error?: boolean;
161
163
  disabled?: boolean;
162
164
  onChange: (value: string | number | null) => void;
163
- site: ISite | null;
164
- lang: string;
165
- selectedContent: any;
165
+ site?: ISite | null;
166
+ lang?: string;
167
+ selectedContent?: any;
166
168
  mandatory?: boolean;
167
169
  placeholder?: string;
168
170
  filter?: any[];
169
171
  options?: any[];
170
172
  source?: string;
173
+ type?: string;
174
+ maxWidth?: number;
171
175
  }
172
176
 
173
177
  export default AsyncSelect;
@@ -1,7 +1,11 @@
1
1
  import styled, { css } from "styled-components";
2
2
  import AsyncSelect from "react-select/async";
3
3
 
4
- export const StyledSelect = styled(AsyncSelect)<{ isDisabled: boolean | undefined; error: boolean | undefined }>`
4
+ export const StyledSelect = styled(AsyncSelect)<{
5
+ isDisabled: boolean | undefined;
6
+ error: boolean | undefined;
7
+ maxWidth?: number;
8
+ }>`
5
9
  ${(p) => p.theme.textStyle.fieldContent};
6
10
  color: ${(p) => p.theme.color.textHighEmphasis};
7
11
  margin-bottom: ${(p) => p.theme.spacing.xxs};
@@ -90,4 +94,57 @@ export const StyledSelect = styled(AsyncSelect)<{ isDisabled: boolean | undefine
90
94
  }
91
95
  }
92
96
  }
97
+
98
+ &.inline {
99
+ ${(p) => p.theme.textStyle.uiS};
100
+ text-transform: capitalize;
101
+
102
+ .react-select__control {
103
+ background: transparent;
104
+ border: none;
105
+ height: auto;
106
+ justify-content: ${(p) => (p.alignRight ? "flex-end" : "flex-start")};
107
+ min-width: auto;
108
+
109
+ .react-select__value-container {
110
+ flex: 0 1 auto;
111
+ padding: 0;
112
+ .react-select__single-value {
113
+ position: relative;
114
+ transform: none;
115
+ color: ${(p) => (p.error ? p.theme.color.error : p.theme.color.interactive01)};
116
+ white-space: nowrap;
117
+ text-overflow: ellipsis;
118
+ max-width: ${(p) => (p.maxWidth ? `${p.maxWidth}px` : `calc(${p.theme.spacing.xl} * 4)`)};
119
+ display: block;
120
+ overflow: hidden;
121
+ }
122
+ }
123
+ .react-select__indicator {
124
+ color: ${(p) => (p.error ? p.theme.color.error : p.theme.color.interactive01)};
125
+ padding: 0;
126
+ svg {
127
+ width: ${(p) => p.theme.spacing.s};
128
+ height: ${(p) => p.theme.spacing.s};
129
+ }
130
+ }
131
+ .react-select__input {
132
+ input {
133
+ cursor: default;
134
+ }
135
+ }
136
+ }
137
+
138
+ .react-select__control--is-disabled {
139
+ .react-select__value-container {
140
+ .react-select__single-value {
141
+ color: ${(p) => p.theme.color.interactiveDisabled};
142
+ }
143
+ }
144
+ }
145
+
146
+ .react-select__menu {
147
+ ${(p) => p.theme.textStyle.fieldContent};
148
+ }
149
+ }
93
150
  `;
@@ -5,7 +5,19 @@ import Icon from "@ax/components/Icon";
5
5
  import * as S from "./style";
6
6
 
7
7
  const CheckField = (props: ICheckFieldProps): JSX.Element => {
8
- const { name, title, value, checked, error, disabled, indeterminate, onChange, icon, inversed = false } = props;
8
+ const {
9
+ name,
10
+ title,
11
+ value,
12
+ checked,
13
+ error,
14
+ disabled,
15
+ indeterminate,
16
+ onChange,
17
+ icon,
18
+ className,
19
+ inversed = false,
20
+ } = props;
9
21
 
10
22
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
11
23
  const isChecked = e.target.checked;
@@ -15,7 +27,7 @@ const CheckField = (props: ICheckFieldProps): JSX.Element => {
15
27
  };
16
28
 
17
29
  return (
18
- <S.Wrapper>
30
+ <S.Wrapper className={className}>
19
31
  <S.Label data-testid="check-field-label" disabled={disabled} inversed={inversed}>
20
32
  {icon ? (
21
33
  <S.IconLabelWrapper data-testid="check-field-icon-label">
@@ -60,6 +72,7 @@ export interface ICheckFieldProps {
60
72
  onChange?: (value: ICheck) => void;
61
73
  icon?: string;
62
74
  inversed?: boolean;
75
+ className?: string;
63
76
  }
64
77
 
65
78
  export default CheckField;
@@ -40,53 +40,55 @@ const CustomPanel = (props: IProps): JSX.Element => {
40
40
 
41
41
  return (
42
42
  <FloatingPanel title="Add custom code" toggleModal={toggleModal} isOpen={isOpen}>
43
- <S.ContentWrapper>
44
- <S.NoteWrapper>
45
- <NoteField value={{ text: noteText }} />
46
- </S.NoteWrapper>
47
- <FieldsBehavior
48
- title="Name"
49
- name="name"
50
- fieldType="TextField"
51
- value={form.name}
52
- placeholder="Type a name"
53
- onChange={(value: string) => handleChange({ name: value })}
54
- mandatory
55
- validators={{ mandatory: true }}
56
- />
57
- <FieldsBehavior
58
- title="Head Code"
59
- name="contentHead"
60
- fieldType="TextArea"
61
- value={form.contentHead}
62
- placeholder="Enter the code that will be injected into the head’s page."
63
- onChange={(value: string) => handleChange({ contentHead: value })}
64
- rows={4}
65
- />
66
- <FieldsBehavior
67
- title="Body Code"
68
- name="contentBody"
69
- fieldType="TextArea"
70
- value={form.contentBody}
71
- placeholder="Enter the code that will be injected into the body’s page."
72
- onChange={(value: string) => handleChange({ contentBody: value })}
73
- rows={4}
74
- />
75
- <FieldsBehavior
76
- title="Page body code in:"
77
- name="contentBodyPosition"
78
- fieldType="RadioGroup"
79
- value={form.contentBodyPosition}
80
- options={bodyCodeOptions}
81
- onChange={(value: string) => handleChange({ contentBodyPosition: value })}
82
- disabled={!form.contentBody?.length}
83
- />
84
- </S.ContentWrapper>
85
- <S.Footer>
86
- <Button className="button" type="button" onClick={editButton.action} disabled={!form.name?.length}>
87
- {editButton.label}
88
- </Button>
89
- </S.Footer>
43
+ <S.Wrapper>
44
+ <S.ContentWrapper>
45
+ <S.NoteWrapper>
46
+ <NoteField value={{ text: noteText }} />
47
+ </S.NoteWrapper>
48
+ <FieldsBehavior
49
+ title="Name"
50
+ name="name"
51
+ fieldType="TextField"
52
+ value={form.name}
53
+ placeholder="Type a name"
54
+ onChange={(value: string) => handleChange({ name: value })}
55
+ mandatory
56
+ validators={{ mandatory: true }}
57
+ />
58
+ <FieldsBehavior
59
+ title="Head Code"
60
+ name="contentHead"
61
+ fieldType="TextArea"
62
+ value={form.contentHead}
63
+ placeholder="Enter the code that will be injected into the head’s page."
64
+ onChange={(value: string) => handleChange({ contentHead: value })}
65
+ rows={4}
66
+ />
67
+ <FieldsBehavior
68
+ title="Body Code"
69
+ name="contentBody"
70
+ fieldType="TextArea"
71
+ value={form.contentBody}
72
+ placeholder="Enter the code that will be injected into the body’s page."
73
+ onChange={(value: string) => handleChange({ contentBody: value })}
74
+ rows={4}
75
+ />
76
+ <FieldsBehavior
77
+ title="Page body code in:"
78
+ name="contentBodyPosition"
79
+ fieldType="RadioGroup"
80
+ value={form.contentBodyPosition}
81
+ options={bodyCodeOptions}
82
+ onChange={(value: string) => handleChange({ contentBodyPosition: value })}
83
+ disabled={!form.contentBody?.length}
84
+ />
85
+ </S.ContentWrapper>
86
+ <S.Footer>
87
+ <Button className="button" type="button" onClick={editButton.action} disabled={!form.name?.length}>
88
+ {editButton.label}
89
+ </Button>
90
+ </S.Footer>
91
+ </S.Wrapper>
90
92
  </FloatingPanel>
91
93
  );
92
94
  };
@@ -1,5 +1,10 @@
1
1
  import styled from "styled-components";
2
2
 
3
+ const Wrapper = styled.div`
4
+ padding: ${(p) => p.theme.spacing.m};
5
+ height: 100%;
6
+ `;
7
+
3
8
  const Footer = styled.div`
4
9
  position: absolute;
5
10
  bottom: ${(p) => p.theme.spacing.m};
@@ -20,4 +25,4 @@ const ContentWrapper = styled.div`
20
25
  padding: 0 ${(p) => p.theme.spacing.m} ${(p) => p.theme.spacing.s} ${(p) => p.theme.spacing.m};
21
26
  `;
22
27
 
23
- export { Footer, NoteWrapper, ContentWrapper };
28
+ export { Wrapper, Footer, NoteWrapper, ContentWrapper };
@@ -94,17 +94,19 @@ const VariablesPanel = (props: IProps): JSX.Element => {
94
94
 
95
95
  return (
96
96
  <FloatingPanel title="Define values" toggleModal={toggleModal} isOpen={isOpen}>
97
- <S.ContentWrapper>
98
- <S.NoteWrapper>
99
- <NoteField value={{ text: noteText }} />
100
- </S.NoteWrapper>
101
- {renderVariables()}
102
- </S.ContentWrapper>
103
- <S.Footer>
104
- <Button className="button" type="button" onClick={editButton.action}>
105
- {editButton.label}
106
- </Button>
107
- </S.Footer>
97
+ <S.Wrapper>
98
+ <S.ContentWrapper>
99
+ <S.NoteWrapper>
100
+ <NoteField value={{ text: noteText }} />
101
+ </S.NoteWrapper>
102
+ {renderVariables()}
103
+ </S.ContentWrapper>
104
+ <S.Footer>
105
+ <Button className="button" type="button" onClick={editButton.action}>
106
+ {editButton.label}
107
+ </Button>
108
+ </S.Footer>
109
+ </S.Wrapper>
108
110
  </FloatingPanel>
109
111
  );
110
112
  };
@@ -1,5 +1,10 @@
1
1
  import styled from "styled-components";
2
2
 
3
+ const Wrapper = styled.div`
4
+ padding: ${(p) => p.theme.spacing.m};
5
+ height: 100%;
6
+ `;
7
+
3
8
  const Footer = styled.div`
4
9
  position: absolute;
5
10
  bottom: ${(p) => p.theme.spacing.m};
@@ -8,9 +13,7 @@ const Footer = styled.div`
8
13
 
9
14
  const NoteWrapper = styled.div`
10
15
  margin-bottom: ${(p) => p.theme.spacing.m};
11
-
12
16
  `
13
-
14
17
  const ContentWrapper = styled.div`
15
18
  height: calc(100% - ${(p) => p.theme.spacing.s} * 10);
16
19
  overflow-y: scroll;
@@ -20,4 +23,4 @@ const ContentWrapper = styled.div`
20
23
  padding: 0 ${(p) => p.theme.spacing.m} ${(p) => p.theme.spacing.s} ${(p) => p.theme.spacing.m};
21
24
  `;
22
25
 
23
- export { Footer, NoteWrapper, ContentWrapper };
26
+ export { Wrapper, Footer, NoteWrapper, ContentWrapper };
@@ -55,6 +55,7 @@ const DropDown = styled.div<{ floating?: boolean; isOpen: boolean }>`
55
55
  z-index: 2;
56
56
  height: ${(p) => (p.isOpen ? "100%" : 0)};
57
57
  max-height: 130px;
58
+ min-height: 100px;
58
59
  overflow: ${(p) => (p.isOpen ? "auto" : "hidden")};
59
60
  position: ${(p) => (p.floating ? "absolute" : "block")};
60
61
  `;
@@ -8,7 +8,7 @@ import { Button, CheckField, FieldsBehavior, FloatingMenu, Icon, IconAction, Sea
8
8
  import * as S from "./style";
9
9
 
10
10
  const AutoItem = (props: IProps) => {
11
- const { source, canDelete, filter, handleDelete, addFilter, site, structuredDataSite } = props;
11
+ const { source, canDelete, filter, handleDelete, addFilter, currentSite, structuredDataSite, siteID } = props;
12
12
 
13
13
  const initState: IState = {
14
14
  selected: "",
@@ -75,10 +75,10 @@ const AutoItem = (props: IProps) => {
75
75
  order: "alpha-asc",
76
76
  };
77
77
 
78
- const siteID = getIsGlobal(newValue) ? null : site.id;
78
+ const site = getIsGlobal(newValue) ? null : siteID;
79
79
 
80
80
  try {
81
- const result = await structuredData.getDataContents(params, siteID);
81
+ const result = await structuredData.getDataContents(params, site);
82
82
  if (isReqOk(result.status)) {
83
83
  setState({ ...state, selected: newValue, options: result.data.items, filteredOptions: result.data.items });
84
84
  }
@@ -164,7 +164,7 @@ const AutoItem = (props: IProps) => {
164
164
  entity="categories"
165
165
  onChange={handleSelectOnChange}
166
166
  entityId={source.id}
167
- site={site}
167
+ site={currentSite}
168
168
  />
169
169
  {state.options.length > 0 && (
170
170
  <S.SearchWrapper>
@@ -208,10 +208,11 @@ interface IProps {
208
208
  source: IDataSource;
209
209
  canDelete: boolean;
210
210
  filter: number[];
211
- site: ISite;
211
+ currentSite: ISite | null;
212
212
  structuredDataSite: IStructuredData[];
213
213
  handleDelete: (value: string) => void;
214
214
  addFilter: (value: any[], source: string) => void;
215
+ siteID?: number | null;
215
216
  }
216
217
 
217
218
  export default AutoItem;