@griddo/ax 11.10.16 → 11.10.17-rc.1

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 (79) hide show
  1. package/README.md +1 -0
  2. package/config/griddo-config/index.js +1 -0
  3. package/package.json +2 -2
  4. package/src/__tests__/components/BulkSelectionOptions/BulkSelectionOptions.test.tsx +10 -24
  5. package/src/components/BulkSelectionOptions/index.tsx +9 -11
  6. package/src/components/BulkSelectionOptions/style.tsx +12 -5
  7. package/src/components/Fields/CheckField/index.tsx +4 -5
  8. package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +17 -17
  9. package/src/components/Fields/UniqueCheck/index.tsx +21 -16
  10. package/src/components/Fields/UniqueCheck/style.tsx +17 -0
  11. package/src/components/FileGallery/GalleryPanel/DetailPanel/index.tsx +2 -1
  12. package/src/components/FilterTagsBar/style.tsx +2 -0
  13. package/src/components/Gallery/GalleryPanel/DetailPanel/index.tsx +2 -1
  14. package/src/components/Gallery/index.tsx +25 -26
  15. package/src/components/TableList/TableItem/style.tsx +4 -1
  16. package/src/components/TableList/index.tsx +3 -3
  17. package/src/components/TableList/style.tsx +11 -1
  18. package/src/hooks/bulk.tsx +17 -8
  19. package/src/hooks/index.tsx +8 -7
  20. package/src/locales/en-US.ts +47 -0
  21. package/src/locales/es-ES.ts +47 -0
  22. package/src/locales/index.ts +11 -0
  23. package/src/modules/Categories/CategoriesList/BulkHeader/TableHeader/index.tsx +1 -3
  24. package/src/modules/Categories/CategoriesList/BulkHeader/TableHeader/style.tsx +4 -2
  25. package/src/modules/Categories/CategoriesList/BulkHeader/index.tsx +6 -2
  26. package/src/modules/Categories/CategoriesList/index.tsx +29 -28
  27. package/src/modules/Categories/CategoriesList/utils.tsx +3 -2
  28. package/src/modules/Content/BulkHeader/TableHeader/style.tsx +4 -3
  29. package/src/modules/Content/BulkHeader/index.tsx +6 -2
  30. package/src/modules/Content/index.tsx +51 -51
  31. package/src/modules/FileDrive/BulkGridHeader/GridHeader/style.tsx +2 -0
  32. package/src/modules/FileDrive/BulkGridHeader/index.tsx +5 -3
  33. package/src/modules/FileDrive/BulkGridHeader/style.tsx +6 -4
  34. package/src/modules/FileDrive/BulkListHeader/TableHeader/style.tsx +5 -3
  35. package/src/modules/FileDrive/BulkListHeader/index.tsx +15 -4
  36. package/src/modules/FileDrive/BulkListHeader/style.tsx +5 -4
  37. package/src/modules/FileDrive/FileModal/DetailPanel/index.tsx +9 -7
  38. package/src/modules/FileDrive/index.tsx +25 -23
  39. package/src/modules/Forms/FormCategoriesList/BulkHeader/TableHeader/style.tsx +4 -2
  40. package/src/modules/Forms/FormCategoriesList/BulkHeader/index.tsx +6 -2
  41. package/src/modules/Forms/FormCategoriesList/BulkHeader/style.tsx +3 -3
  42. package/src/modules/Forms/FormCategoriesList/index.tsx +13 -12
  43. package/src/modules/Forms/FormList/BulkHeader/TableHeader/style.tsx +5 -2
  44. package/src/modules/Forms/FormList/BulkHeader/index.tsx +6 -2
  45. package/src/modules/Forms/FormList/index.tsx +20 -19
  46. package/src/modules/MediaGallery/BulkGridHeader/GridHeader/style.tsx +2 -0
  47. package/src/modules/MediaGallery/BulkGridHeader/index.tsx +5 -3
  48. package/src/modules/MediaGallery/BulkGridHeader/style.tsx +6 -4
  49. package/src/modules/MediaGallery/BulkListHeader/TableHeader/style.tsx +4 -3
  50. package/src/modules/MediaGallery/BulkListHeader/index.tsx +6 -3
  51. package/src/modules/MediaGallery/BulkListHeader/style.tsx +3 -4
  52. package/src/modules/MediaGallery/ImageModal/DetailPanel/index.tsx +7 -6
  53. package/src/modules/MediaGallery/index.tsx +27 -25
  54. package/src/modules/Navigation/Defaults/BulkHeader/TableHeader/style.tsx +6 -4
  55. package/src/modules/Navigation/Defaults/BulkHeader/index.tsx +15 -3
  56. package/src/modules/Navigation/Defaults/index.tsx +8 -9
  57. package/src/modules/Redirects/BulkHeader/TableHeader/style.tsx +4 -2
  58. package/src/modules/Redirects/BulkHeader/index.tsx +7 -2
  59. package/src/modules/Redirects/index.tsx +12 -12
  60. package/src/modules/Settings/Integrations/BulkHeader/TableHeader/style.tsx +4 -2
  61. package/src/modules/Settings/Integrations/BulkHeader/index.tsx +5 -2
  62. package/src/modules/Settings/Integrations/index.tsx +16 -16
  63. package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/style.tsx +4 -3
  64. package/src/modules/Sites/SitesList/ListView/BulkHeader/index.tsx +5 -3
  65. package/src/modules/Sites/SitesList/ListView/BulkHeader/style.tsx +4 -2
  66. package/src/modules/Sites/SitesList/index.tsx +25 -18
  67. package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/style.tsx +4 -2
  68. package/src/modules/StructuredData/StructuredDataList/BulkHeader/index.tsx +6 -2
  69. package/src/modules/StructuredData/StructuredDataList/index.tsx +46 -45
  70. package/src/modules/StructuredData/StructuredDataList/utils.tsx +7 -5
  71. package/src/modules/Users/Roles/BulkHeader/TableHeader/style.tsx +4 -2
  72. package/src/modules/Users/Roles/BulkHeader/index.tsx +6 -2
  73. package/src/modules/Users/Roles/index.tsx +7 -7
  74. package/src/modules/Users/UserList/BulkHeader/TableHeader/style.tsx +4 -2
  75. package/src/modules/Users/UserList/BulkHeader/index.tsx +6 -2
  76. package/src/modules/Users/UserList/index.tsx +14 -15
  77. package/src/schemas/pages/GlobalPage.tsx +17 -0
  78. package/src/schemas/pages/Page.tsx +17 -0
  79. package/tsconfig.paths.json +1 -0
package/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  - [Estándares de commits](docs/COMMITS.md)
5
5
  - [Comandos de npm](#comandos-de-npm)
6
6
  - [AGENTS.md](#agentsmd)
7
+ - [Centralización de textos de UI](docs/LOCALE-UI-TEXTS.md)
7
8
 
8
9
  ## AGENTS.md
9
10
 
@@ -87,6 +87,7 @@ const griddoAxAliases = {
87
87
  "@ax/routes": path.resolve(__dirname, "../../src/routes"),
88
88
  "@ax/types": path.resolve(__dirname, "../../src/types"),
89
89
  "@ax/schemas": path.resolve(__dirname, "../../src/schemas"),
90
+ "@ax/locales": path.resolve(__dirname, "../../src/locales"),
90
91
  };
91
92
 
92
93
  const griddoComponentsLibAliases = getComponentsLibAliases();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "11.10.16",
4
+ "version": "11.10.17-rc.1",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -217,5 +217,5 @@
217
217
  "publishConfig": {
218
218
  "access": "public"
219
219
  },
220
- "gitHead": "ddb737f01274ea3d5981c463b4f98857320e6950"
220
+ "gitHead": "00364b55b0b2954da9c57dfc53bcb84530219e06"
221
221
  }
@@ -1,14 +1,13 @@
1
- import * as React from "react";
2
-
1
+ import { cleanup, fireEvent, render, screen } from "@testing-library/react";
3
2
  import { ThemeProvider } from "styled-components";
4
- import { render, cleanup, screen, fireEvent } from "@testing-library/react";
5
3
  import "@testing-library/jest-dom";
6
- import userEvent from "@testing-library/user-event";
7
4
 
8
- import { parseTheme } from "@ax/helpers";
9
5
  import BulkSelectionOptions from "@ax/components/BulkSelectionOptions";
6
+ import { parseTheme } from "@ax/helpers";
10
7
  import globalTheme from "@ax/themes/theme.json";
11
8
 
9
+ import userEvent from "@testing-library/user-event";
10
+
12
11
  afterEach(() => {
13
12
  jest.resetAllMocks();
14
13
  cleanup();
@@ -27,6 +26,12 @@ const defaultProps = {
27
26
  ],
28
27
  selectItems: selectItemsMock,
29
28
  totalItems: 1234,
29
+ selectedItems: {
30
+ all: [],
31
+ notPublished: [],
32
+ published: [],
33
+ drafts: [],
34
+ },
30
35
  };
31
36
 
32
37
  describe("Browser component rendering", () => {
@@ -36,22 +41,15 @@ describe("Browser component rendering", () => {
36
41
  <BulkSelectionOptions {...defaultProps} />
37
42
  </ThemeProvider>,
38
43
  );
39
-
40
44
  const bulkHeaderWrapper = screen.getByTestId("bulk-header-wrapper");
41
45
  expect(bulkHeaderWrapper).toBeTruthy();
42
-
43
- const tableCounter = screen.getByTestId("table-counter");
44
- expect(tableCounter).toBeTruthy();
45
- expect(screen.getByText("1234 results")).toBeInTheDocument();
46
46
  });
47
-
48
47
  it("should call the action on onclick", () => {
49
48
  render(
50
49
  <ThemeProvider theme={parseTheme(globalTheme)}>
51
50
  <BulkSelectionOptions {...defaultProps} />
52
51
  </ThemeProvider>,
53
52
  );
54
-
55
53
  const bulkHeaderWrapper = screen.getByTestId("bulk-header-wrapper");
56
54
  expect(bulkHeaderWrapper).toBeTruthy();
57
55
  const buttonText = screen.getByTestId("button-text");
@@ -59,7 +57,6 @@ describe("Browser component rendering", () => {
59
57
  fireEvent.click(buttonText);
60
58
  expect(propActionMock).toHaveBeenCalled();
61
59
  });
62
-
63
60
  it("should call the action on onchange", async () => {
64
61
  const user = userEvent.setup();
65
62
  render(
@@ -67,7 +64,6 @@ describe("Browser component rendering", () => {
67
64
  <BulkSelectionOptions {...defaultProps} />
68
65
  </ThemeProvider>,
69
66
  );
70
-
71
67
  const bulkHeaderWrapper = screen.getByTestId("bulk-header-wrapper");
72
68
  expect(bulkHeaderWrapper).toBeTruthy();
73
69
  const checkFieldInput = screen.getByTestId<HTMLInputElement>("check-field-input");
@@ -75,7 +71,6 @@ describe("Browser component rendering", () => {
75
71
  await user.click(checkFieldInput);
76
72
  expect(selectItemsMock).toHaveBeenCalled();
77
73
  });
78
-
79
74
  it("should mark the check if isAllSelected", () => {
80
75
  const defaultPropsCheck = {
81
76
  isScrolling: false,
@@ -90,22 +85,18 @@ describe("Browser component rendering", () => {
90
85
  selectItems: selectItemsMock,
91
86
  totalItems: 10,
92
87
  };
93
-
94
88
  render(
95
89
  <ThemeProvider theme={parseTheme(globalTheme)}>
96
90
  <BulkSelectionOptions {...defaultPropsCheck} />
97
91
  </ThemeProvider>,
98
92
  );
99
-
100
93
  const bulkHeaderWrapper = screen.getByTestId("bulk-header-wrapper");
101
94
  expect(bulkHeaderWrapper).toBeTruthy();
102
-
103
95
  const checkFieldCheckMark = screen.getAllByTestId<HTMLInputElement>("check-field-check-mark");
104
96
  checkFieldCheckMark.map((item) => {
105
97
  expect(item.checked).toBe(true);
106
98
  });
107
99
  });
108
-
109
100
  it("should change the style if indeterminate is true", () => {
110
101
  const defaultPropsCheck = {
111
102
  isScrolling: false,
@@ -120,25 +111,21 @@ describe("Browser component rendering", () => {
120
111
  selectItems: selectItemsMock,
121
112
  totalItems: 10,
122
113
  };
123
-
124
114
  render(
125
115
  <ThemeProvider theme={parseTheme(globalTheme)}>
126
116
  <BulkSelectionOptions {...defaultPropsCheck} />
127
117
  </ThemeProvider>,
128
118
  );
129
-
130
119
  const bulkHeaderWrapper = screen.getByTestId("bulk-header-wrapper");
131
120
  expect(bulkHeaderWrapper).toBeTruthy();
132
121
  const theme = parseTheme(globalTheme);
133
122
  expect(bulkHeaderWrapper).not.toHaveStyle(`border-bottom: 1px solid ${theme.color.uiLine}`);
134
-
135
123
  const checkFieldCheckMark = screen.getAllByTestId<HTMLInputElement>("check-field-check-mark");
136
124
  checkFieldCheckMark.map((item) => {
137
125
  expect(item.checked).toBe(false);
138
126
  expect(item).toHaveStyle("border: 2px solid #5057FF");
139
127
  });
140
128
  });
141
-
142
129
  it("should show the borderBottom whe isScrolling is true", () => {
143
130
  const defaultPropsCheck = {
144
131
  isScrolling: true,
@@ -153,7 +140,6 @@ describe("Browser component rendering", () => {
153
140
  selectItems: selectItemsMock,
154
141
  totalItems: 10,
155
142
  };
156
-
157
143
  render(
158
144
  <ThemeProvider theme={parseTheme(globalTheme)}>
159
145
  <BulkSelectionOptions {...defaultPropsCheck} />
@@ -1,14 +1,13 @@
1
- import React from "react";
2
-
3
- import { Button, CheckField, ExportButton, TableCounter } from "@ax/components";
4
- import { IBulkAction } from "@ax/types";
1
+ import { Button, CheckField, ExportButton } from "@ax/components";
2
+ import type { IBulkSelectedItems } from "@ax/hooks";
3
+ import type { IBulkAction } from "@ax/types";
5
4
 
6
5
  import * as S from "./style";
7
6
 
8
- const BulkSelectionOptions = (props: IBulkSelectionProps): JSX.Element => {
9
- const { isScrolling, checkState, actions, selectItems, totalItems, className, exportAction } = props;
7
+ const BulkSelectionOptions = (props: IBulkSelectionProps) => {
8
+ const { isScrolling, checkState, actions, selectItems, className, exportAction, selectedItems } = props;
10
9
 
11
- const filteredActions = actions.filter((action: IBulkAction | undefined | null) => !!action);
10
+ const filteredActions = actions.filter((action) => !!action);
12
11
 
13
12
  return (
14
13
  <S.BulkHeader isScrolling={isScrolling} data-testid="bulk-header-wrapper" className={className}>
@@ -25,9 +24,10 @@ const BulkSelectionOptions = (props: IBulkSelectionProps): JSX.Element => {
25
24
  error={false}
26
25
  />
27
26
  </S.SelectAllCheckField>
27
+ <S.SelectedCount>{selectedItems?.all?.length} selected</S.SelectedCount>
28
28
  <S.BulkActions>
29
29
  {filteredActions.map(
30
- (item: IBulkAction | undefined | null) =>
30
+ (item) =>
31
31
  item && (
32
32
  <Button key={item.text} type="button" buttonStyle="text" icon={item.icon} onClick={item.action}>
33
33
  {item.text}
@@ -36,9 +36,6 @@ const BulkSelectionOptions = (props: IBulkSelectionProps): JSX.Element => {
36
36
  )}
37
37
  {exportAction && <ExportButton onClick={exportAction} />}
38
38
  </S.BulkActions>
39
- <S.Counter>
40
- <TableCounter totalItems={totalItems} />
41
- </S.Counter>
42
39
  </S.BulkActionsWrapper>
43
40
  </S.BulkHeader>
44
41
  );
@@ -52,6 +49,7 @@ interface IBulkSelectionProps {
52
49
  isScrolling?: boolean;
53
50
  className?: string;
54
51
  exportAction?: (formats: (string | number)[]) => void;
52
+ selectedItems: IBulkSelectedItems;
55
53
  }
56
54
 
57
55
  export default BulkSelectionOptions;
@@ -5,8 +5,11 @@ const BulkHeader = styled.div<{ isScrolling?: boolean }>`
5
5
  display: flex;
6
6
  flex-direction: row;
7
7
  align-items: center;
8
- padding: ${(p) => `${p.theme.spacing.s} ${p.theme.spacing.m}`};
9
8
  border-bottom: ${(p) => (p.isScrolling ? `1px solid ${p.theme.color.uiLine};` : "")};
9
+ padding-inline: ${(p) => p.theme.spacing.m};
10
+ background: ${({ theme }) => theme.color.uiBackground03};
11
+ border-radius: ${({ theme }) => theme.radii.s};
12
+ min-height: 40px;
10
13
  `;
11
14
 
12
15
  const BulkActionsWrapper = styled.div`
@@ -17,8 +20,6 @@ const BulkActionsWrapper = styled.div`
17
20
 
18
21
  const BulkActions = styled.div`
19
22
  display: flex;
20
- margin-top: 2px;
21
- min-height: 32px;
22
23
  button {
23
24
  margin-right: ${(p) => p.theme.spacing.xs};
24
25
  }
@@ -27,7 +28,6 @@ const BulkActions = styled.div`
27
28
  const SelectAllCheckField = styled.span`
28
29
  width: ${(p) => p.theme.spacing.s};
29
30
  margin-right: ${(p) => p.theme.spacing.s};
30
- margin-left: ${(p) => p.theme.spacing.m};
31
31
  `;
32
32
 
33
33
  const Counter = styled.div`
@@ -36,4 +36,11 @@ const Counter = styled.div`
36
36
  align-items: center;
37
37
  `;
38
38
 
39
- export { BulkHeader, BulkActionsWrapper, BulkActions, SelectAllCheckField, Counter };
39
+ const SelectedCount = styled.span`
40
+ margin-right: ${(p) => p.theme.spacing.s};
41
+ color: ${(p) => p.theme.color.textHighEmphasis};
42
+ ${(p) => p.theme.textStyle.uiL};
43
+ font-weight: ${(p) => p.theme.fontWeight.regular};
44
+ `;
45
+
46
+ export { BulkHeader, BulkActionsWrapper, BulkActions, SelectAllCheckField, Counter, SelectedCount };
@@ -1,6 +1,5 @@
1
- import React from "react";
2
- import { ICheck } from "@ax/types";
3
1
  import Icon from "@ax/components/Icon";
2
+ import type { ICheck } from "@ax/types";
4
3
 
5
4
  import * as S from "./style";
6
5
 
@@ -23,12 +22,12 @@ const CheckField = (props: ICheckFieldProps): JSX.Element => {
23
22
 
24
23
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
25
24
  const isChecked = e.target.checked;
26
- onChange && onChange({ value, isChecked });
25
+ onChange?.({ value, isChecked });
27
26
  };
28
27
 
29
- const handleMouseOver = () => setHoverCheck && setHoverCheck(true);
28
+ const handleMouseOver = () => setHoverCheck?.(true);
30
29
 
31
- const handleMouseLeave = () => setHoverCheck && setHoverCheck(false);
30
+ const handleMouseLeave = () => setHoverCheck?.(false);
32
31
 
33
32
  return (
34
33
  <S.Wrapper className={className}>
@@ -1,7 +1,7 @@
1
- import React, { useState } from "react";
1
+ import { useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
- import { IDataSource, ILanguage, IRootState, ISchemaField, ISite, IStructuredData } from "@ax/types";
4
+ import type { IDataSource, ILanguage, IRootState, ISchemaField, ISite, IStructuredData } from "@ax/types";
5
5
  import {
6
6
  Button,
7
7
  FloatingMenu,
@@ -14,7 +14,8 @@ import {
14
14
  UniqueCheck,
15
15
  } from "@ax/components";
16
16
 
17
- import { IReferenceState, IRefField, ISource, useReference } from "../Context";
17
+ import type { IReferenceState, IRefField, ISource } from "../Context";
18
+ import { useReference } from "../Context";
18
19
  import AutoItem from "./AutoItem";
19
20
 
20
21
  import * as S from "./style";
@@ -36,9 +37,9 @@ const AutoPanel = (props: IProps): JSX.Element => {
36
37
  };
37
38
  const [configState, setConfigState] = useState<IConfigState>(initConfig);
38
39
  const initToggle = {
39
- isSiteActive: state.site && state.site !== "global" ? true : false,
40
- isLangActive: state.lang ? true : false,
41
- isGlobalActive: state.site && state.site === "global" ? true : false,
40
+ isSiteActive: !!(state.site && state.site !== "global" ),
41
+ isLangActive: !!state.lang,
42
+ isGlobalActive: !!(state.site && state.site === "global" ),
42
43
  errorSite: false,
43
44
  errorLang: false,
44
45
  errorMsg: "",
@@ -130,8 +131,8 @@ const AutoPanel = (props: IProps): JSX.Element => {
130
131
  title: "",
131
132
  value: state.quantity,
132
133
  onChange: (quantity: number) => setState((state: IReferenceState) => ({ ...state, quantity })),
133
- maxValue: validators && validators.maxValue ? validators.maxValue : undefined,
134
- minValue: validators && validators.minValue ? validators.minValue : undefined,
134
+ maxValue: validators?.maxValue ? validators.maxValue : undefined,
135
+ minValue: validators?.minValue ? validators.minValue : undefined,
135
136
  };
136
137
 
137
138
  const checkErrors = (): boolean => {
@@ -258,7 +259,7 @@ const AutoPanel = (props: IProps): JSX.Element => {
258
259
  };
259
260
 
260
261
  const handleLangChange = (value: string) => {
261
- const lang = value.length ? parseInt(value) : undefined;
262
+ const lang = value.length ? parseInt(value, 10) : undefined;
262
263
  setState((state: IReferenceState) => ({ ...state, lang }));
263
264
  if (value) {
264
265
  setToggleState({ ...toggleState, isLangActive: true, errorLang: false, errorMsg: "" });
@@ -295,7 +296,8 @@ const AutoPanel = (props: IProps): JSX.Element => {
295
296
  state.sources.map((singleSource: ISource) => {
296
297
  const source = state.sourceTitles.find((el: IDataSource) => el.id === singleSource.structuredData);
297
298
  const { filters = [], filterOperator, globalOperator } = singleSource;
298
- return source ? (
299
+ if(!source) return null;
300
+ return (
299
301
  <AutoItem
300
302
  key={singleSource.structuredData}
301
303
  source={source}
@@ -309,9 +311,7 @@ const AutoPanel = (props: IProps): JSX.Element => {
309
311
  globalOperator={globalOperator}
310
312
  siteID={state.site || site?.id}
311
313
  />
312
- ) : (
313
- <></>
314
- );
314
+ )
315
315
  })}
316
316
  </S.SourcesWrapper>
317
317
  <S.RadioWrapper>
@@ -383,9 +383,9 @@ const AutoPanel = (props: IProps): JSX.Element => {
383
383
  </S.SubConfigContent>
384
384
  </S.ConfigWrapper>
385
385
  </>
386
- ) : (
387
- <></>
388
- )}
386
+ ) :
387
+ null
388
+ }
389
389
 
390
390
  <S.OptionLabel
391
391
  onClick={() => toggleConfig("isDataOpen")}
@@ -483,7 +483,7 @@ const AutoPanel = (props: IProps): JSX.Element => {
483
483
  <UniqueCheck
484
484
  name="preferenceLanguageCheck"
485
485
  options={[
486
- { value: false, name: "preferenceLanguage", title: `${currentLang} content shown first` },
486
+ { title: `${currentLang} content shown first` },
487
487
  ]}
488
488
  value={state.preferenceLanguage}
489
489
  onChange={handlePreferenceLanguageChange}
@@ -1,8 +1,9 @@
1
- import React from "react";
2
1
  import { CheckField } from "@ax/components";
3
2
 
3
+ import * as S from "./style";
4
+
4
5
  const UniqueCheck = (props: IProps) => {
5
- const { name, value, options, onChange, disabled, inversed = false, className } = props;
6
+ const { name, value, options, onChange, disabled, inversed = false, className, description } = props;
6
7
  const uniqueOption = options[0];
7
8
 
8
9
  const handleChange = (changeEvt: ICheckEvent) => {
@@ -10,17 +11,22 @@ const UniqueCheck = (props: IProps) => {
10
11
  onChange(isChecked);
11
12
  };
12
13
 
14
+ const classes = description ? "with-subtitle" : "";
15
+
13
16
  return (
14
- <CheckField
15
- name={name}
16
- checked={!!value && value}
17
- title={uniqueOption.title}
18
- value={value}
19
- onChange={handleChange}
20
- disabled={disabled}
21
- inversed={inversed}
22
- className={className}
23
- />
17
+ <S.Wrapper className={classes}>
18
+ <CheckField
19
+ name={name}
20
+ checked={!!value}
21
+ title={uniqueOption.title}
22
+ value={value}
23
+ onChange={handleChange}
24
+ disabled={disabled}
25
+ inversed={inversed}
26
+ className={className}
27
+ />
28
+ <S.Subtitle>{description}</S.Subtitle>
29
+ </S.Wrapper>
24
30
  );
25
31
  };
26
32
 
@@ -31,17 +37,16 @@ interface ICheckEvent {
31
37
 
32
38
  interface IProps {
33
39
  name: string;
34
- value: any;
40
+ value: string | number;
35
41
  options: ICheck[];
36
- onChange: any;
42
+ onChange(isChecked: boolean): void;
37
43
  disabled?: boolean;
38
44
  inversed?: boolean;
39
45
  className?: string;
46
+ description?: string;
40
47
  }
41
48
 
42
49
  interface ICheck {
43
- name: string;
44
- value: any;
45
50
  title: string;
46
51
  }
47
52
 
@@ -0,0 +1,17 @@
1
+ import styled from "styled-components";
2
+
3
+ const Wrapper = styled.div`
4
+ &.with-subtitle label {
5
+ ${(p) => p.theme.textStyle.uiL};
6
+ font-weight: 600;
7
+ }
8
+ `;
9
+
10
+ const Subtitle = styled.div`
11
+ ${(p) => p.theme.textStyle.uiS};
12
+ font-weight: 400;
13
+ color: ${(p) => p.theme.color.textHighEmphasis};
14
+ padding-left: ${(p) => p.theme.spacing.m};
15
+ `;
16
+
17
+ export { Wrapper, Subtitle };
@@ -4,6 +4,7 @@ import { connect } from "react-redux";
4
4
  import { Button, FieldsBehavior, IconAction } from "@ax/components";
5
5
  import { fileDriveActions } from "@ax/containers/FileDrive";
6
6
  import { formatBytes, getFileIcon, getFormattedDateWithTimezone } from "@ax/helpers";
7
+ import { LOCALE } from "@ax/locales";
7
8
  import type { IFile, IRootState } from "@ax/types";
8
9
 
9
10
  import * as S from "./style";
@@ -107,7 +108,7 @@ const GalleryDetailPanel = (props: IProps) => {
107
108
  fieldType="TagsField"
108
109
  onChange={handleTags}
109
110
  disabled={!isAllowedToEdit}
110
- helptext="Type a tag and press enter to create it"
111
+ helptext={LOCALE.fields.tags.helptext}
111
112
  />
112
113
  </S.FormWrapper>
113
114
  </S.PanelForm>
@@ -1,4 +1,5 @@
1
1
  import styled from "styled-components";
2
+
2
3
  import Tag from "../Tag";
3
4
 
4
5
  const Wrapper = styled.div`
@@ -7,6 +8,7 @@ const Wrapper = styled.div`
7
8
  width: 100%;
8
9
  padding: ${(p) => `${p.theme.spacing.xs} ${p.theme.spacing.m}`};
9
10
  align-items: center;
11
+ border-radius: ${({ theme }) => theme.radii.s};
10
12
  `;
11
13
 
12
14
  const Text = styled.div`
@@ -4,6 +4,7 @@ import { connect } from "react-redux";
4
4
  import { Button, FieldsBehavior, IconAction } from "@ax/components";
5
5
  import { galleryActions } from "@ax/containers/Gallery";
6
6
  import { formatBytes, getFileExtension, getFormattedDateWithTimezone } from "@ax/helpers";
7
+ import { LOCALE } from "@ax/locales";
7
8
  import type { IGetFolderParams, IImage, IRootState } from "@ax/types";
8
9
 
9
10
  import * as S from "./style";
@@ -115,7 +116,7 @@ const GalleryDetailPanel = (props: IProps) => {
115
116
  fieldType="TagsField"
116
117
  onChange={handleTags}
117
118
  disabled={!isAllowedToEdit}
118
- helptext="Type a tag and press enter to create it"
119
+ helptext={LOCALE.fields.tags.helptext}
119
120
  />
120
121
  </S.FormWrapper>
121
122
  </S.PanelForm>
@@ -1,7 +1,29 @@
1
- import React, { useEffect, useState, memo, useRef, useCallback, useLayoutEffect } from "react";
1
+ import { memo, useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
4
  import {
5
+ BackFolder,
6
+ EmptyState,
7
+ ErrorToast,
8
+ FilterTagsBar,
9
+ Icon,
10
+ Loader,
11
+ SearchField,
12
+ SearchTagsBar,
13
+ Tabs,
14
+ Tooltip,
15
+ } from "@ax/components";
16
+ import { galleryActions } from "@ax/containers/Gallery";
17
+ import { usePermission, useResizable } from "@ax/hooks";
18
+ // refactor
19
+ import Breadcrumb from "@ax/modules/MediaGallery/Breadcrumb";
20
+ import FolderTree from "@ax/modules/MediaGallery/FolderTree";
21
+ import { useFilterQuery, useSortedListStatus } from "@ax/modules/MediaGallery/hooks";
22
+ import Orientation from "@ax/modules/MediaGallery/ImageFilters/Orientation";
23
+ import SortBy from "@ax/modules/MediaGallery/ImageFilters/SortBy";
24
+ import Type from "@ax/modules/MediaGallery/ImageFilters/Type";
25
+ import { getSortedListStatus } from "@ax/modules/MediaGallery/utils";
26
+ import type {
5
27
  IFolder,
6
28
  IFolderTree,
7
29
  IGetFolderParams,
@@ -11,35 +33,12 @@ import {
11
33
  IRootState,
12
34
  ISite,
13
35
  } from "@ax/types";
14
- import {
15
- Loader,
16
- Tabs,
17
- SearchField,
18
- EmptyState,
19
- ErrorToast,
20
- Tooltip,
21
- Icon,
22
- BackFolder,
23
- SearchTagsBar,
24
- FilterTagsBar,
25
- } from "@ax/components";
26
- import { galleryActions } from "@ax/containers/Gallery";
27
- import { usePermission, useResizable } from "@ax/hooks";
28
36
 
29
- import GalleryPanel from "./GalleryPanel";
30
37
  import FolderItem from "./FolderItem";
38
+ import GalleryPanel from "./GalleryPanel";
31
39
 
32
40
  import * as S from "./style";
33
41
 
34
- // refactor
35
- import Breadcrumb from "@ax/modules/MediaGallery/Breadcrumb";
36
- import FolderTree from "@ax/modules/MediaGallery/FolderTree";
37
- import Type from "@ax/modules/MediaGallery/ImageFilters/Type";
38
- import SortBy from "@ax/modules/MediaGallery/ImageFilters/SortBy";
39
- import Orientation from "@ax/modules/MediaGallery/ImageFilters/Orientation";
40
- import { useFilterQuery, useSortedListStatus } from "@ax/modules/MediaGallery/hooks";
41
- import { getSortedListStatus } from "@ax/modules/MediaGallery/utils";
42
-
43
42
  const Gallery = (props: IProps): JSX.Element => {
44
43
  const { currentFolderContent, site, breadcrumb, toggleModal, getFolderContent, getFoldersTree, getImageSelected } =
45
44
  props;
@@ -113,7 +112,7 @@ const Gallery = (props: IProps): JSX.Element => {
113
112
  pagination: true,
114
113
  page,
115
114
  itemsPerPage,
116
- infinite: page > 1 ? true : false,
115
+ infinite: page > 1,
117
116
  };
118
117
 
119
118
  return params;
@@ -30,7 +30,10 @@ export const Row = styled.div<{ selected: boolean; global?: boolean }>`
30
30
  :before {
31
31
  content: "";
32
32
  background-color: ${(p) => (p.selected ? p.theme.color.overlayPressedPrimary : `transparent`)};
33
- border-radius: ${(p) => p.theme.radii.s};
33
+ /* This border-radius does not comply with the design system, but it prevents
34
+ * a "gap" from appearing between the row and the selected row due to the
35
+ * border-radius not matching (because of the border-width) */
36
+ border-radius: 3px;
34
37
  position: absolute;
35
38
  top: 0;
36
39
  left: 0;
@@ -1,7 +1,7 @@
1
- import { IRootState } from "@ax/types";
2
- import React from "react";
3
1
  import { connect } from "react-redux";
2
+
4
3
  import { Loading, Pagination } from "@ax/components";
4
+ import type { IRootState } from "@ax/types";
5
5
 
6
6
  import * as S from "./style";
7
7
 
@@ -14,7 +14,7 @@ const TableList = (props: ITableListProps): JSX.Element => {
14
14
  <S.TableList onScroll={onScroll} ref={tableRef} data-testid="table-list">
15
15
  <S.Table>
16
16
  <>
17
- <S.TableHeader hasFixedHeader={hasFixedHeader} data-testid="table-list-header">
17
+ <S.TableHeader hasFixedHeader={hasFixedHeader} data-testid="table-list-header" className={className}>
18
18
  {tableHeader}
19
19
  </S.TableHeader>
20
20
  {isLoading ? (
@@ -15,7 +15,7 @@ const Table = styled.div`
15
15
  flex-grow: 1;
16
16
  `;
17
17
 
18
- const TableHeader = styled.div<{ hasFixedHeader?: boolean }>`
18
+ const TableHeader = styled.div<{ hasFixedHeader?: boolean; fullWidth?: boolean }>`
19
19
  display: flex;
20
20
  flex-direction: row;
21
21
  width: 100%;
@@ -24,6 +24,16 @@ const TableHeader = styled.div<{ hasFixedHeader?: boolean }>`
24
24
  z-index: 6;
25
25
  top: 0;
26
26
  background: ${(p) => p.theme.color.uiBackground01};
27
+ min-height: 40px;
28
+ padding-top: ${({ theme }) => theme.spacing.s};
29
+ padding-bottom: ${({ theme }) => theme.spacing.xs};
30
+ background-color: ${({ theme }) => theme.color.uiBackground01};
31
+ padding-inline: 24px;
32
+
33
+ &.no-padding {
34
+ padding-inline: 0;
35
+ padding-top: 0;
36
+ }
27
37
  `;
28
38
 
29
39
  const Header = styled.div<{ isActive?: boolean }>`