@griddo/ax 11.11.8-rc.0 → 11.11.8
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.
- package/config/jest/componentsMock.js +5 -7
- package/package.json +2 -2
- package/src/__tests__/components/Browser/Browser.test.tsx +87 -438
- package/src/__tests__/components/ConfigPanel/ConfigPanel.test.tsx +3 -1
- package/src/__tests__/components/Fields/Button/Button.test.tsx +27 -29
- package/src/__tests__/components/ResizePanel/ResizePanel.test.tsx +1 -1
- package/src/components/Browser/index.tsx +139 -301
- package/src/components/Browser/style.tsx +6 -75
- package/src/components/BrowserContent/index.tsx +2 -2
- package/src/components/Button/index.tsx +1 -2
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/index.tsx +4 -2
- package/src/components/Fields/AsyncSelect/style.tsx +0 -13
- package/src/components/Fields/FieldGroup/index.tsx +2 -5
- package/src/components/Fields/FieldGroup/style.tsx +7 -32
- package/src/components/Fields/HeadingField/index.tsx +2 -2
- package/src/components/Fields/HiddenField/style.tsx +1 -1
- package/src/components/Fields/NumberField/index.tsx +16 -15
- package/src/components/Fields/NumberField/style.tsx +0 -2
- package/src/components/Fields/ReferenceField/index.tsx +1 -1
- package/src/components/Fields/Select/index.tsx +1 -5
- package/src/components/Fields/Select/style.tsx +0 -56
- package/src/components/Fields/SummaryButton/index.tsx +9 -18
- package/src/components/Fields/SummaryButton/style.tsx +2 -1
- package/src/components/Fields/TagsField/index.tsx +9 -8
- package/src/components/Fields/UrlField/index.tsx +27 -26
- package/src/components/Fields/index.tsx +0 -2
- package/src/components/FloatingPanel/index.tsx +2 -5
- package/src/components/FloatingPanel/style.tsx +1 -2
- package/src/components/IconAction/index.tsx +1 -1
- package/src/components/MainWrapper/AppBar/index.tsx +1 -8
- package/src/components/MainWrapper/index.tsx +1 -7
- package/src/components/Notification/index.tsx +2 -2
- package/src/components/OcassionalToast/index.tsx +8 -1
- package/src/components/OcassionalToast/style.tsx +15 -1
- package/src/components/PageFinder/index.tsx +1 -1
- package/src/components/ResizePanel/index.tsx +3 -4
- package/src/components/ResizePanel/style.tsx +1 -1
- package/src/components/SearchField/style.tsx +2 -2
- package/src/components/SideModal/index.tsx +1 -2
- package/src/components/Tabs/index.tsx +4 -13
- package/src/components/Tabs/style.tsx +8 -7
- package/src/components/Toast/index.tsx +2 -4
- package/src/components/Tooltip/index.tsx +3 -4
- package/src/components/index.tsx +0 -10
- package/src/forms/fields.tsx +68 -70
- package/src/hooks/forms.tsx +1 -22
- package/src/hooks/index.tsx +3 -13
- package/src/hooks/modals.tsx +15 -103
- package/src/hooks/users.tsx +8 -25
- package/src/modules/Forms/atoms.tsx +2 -2
- package/src/modules/FramePreview/index.tsx +16 -55
- package/src/modules/FramePreview/style.tsx +2 -34
- package/src/modules/GlobalEditor/Editor/index.tsx +3 -37
- package/src/modules/GlobalEditor/PageBrowser/index.tsx +2 -19
- package/src/modules/GlobalEditor/Preview/index.tsx +2 -0
- package/src/modules/GlobalEditor/Preview/style.tsx +1 -1
- package/src/modules/GlobalEditor/index.tsx +57 -119
- package/src/modules/PageEditor/Editor/index.tsx +2 -33
- package/src/modules/PageEditor/PageBrowser/index.tsx +2 -20
- package/src/modules/PageEditor/Preview/index.tsx +2 -0
- package/src/modules/PageEditor/Preview/style.tsx +1 -1
- package/src/modules/PageEditor/atoms.tsx +1 -1
- package/src/modules/PageEditor/index.tsx +66 -130
- package/src/modules/PublicPreview/index.tsx +5 -8
- package/src/schemas/pages/GlobalPage.ts +70 -87
- package/src/schemas/pages/Page.ts +70 -87
- package/src/types/index.tsx +0 -12
- package/src/__tests__/components/Browser/Browser.utils.test.ts +0 -55
- package/src/__tests__/components/HeadingsPreviewModal/ErrorsBanner/ErrorItem/ErrorItem.test.tsx +0 -158
- package/src/__tests__/components/HeadingsPreviewModal/ErrorsBanner/ErrorsBanner.test.tsx +0 -90
- package/src/__tests__/components/HeadingsPreviewModal/HeadingsPreviewModal.test.tsx +0 -178
- package/src/__tests__/components/HeadingsPreviewModal/HeadingsPreviewModal.utils.test.tsx +0 -150
- package/src/__tests__/components/KeywordsPreviewModal/KeywordItem/KeywordItem.test.tsx +0 -91
- package/src/__tests__/components/KeywordsPreviewModal/KeywordsPreviewModal.test.tsx +0 -122
- package/src/__tests__/components/KeywordsPreviewModal/KeywordsPreviewModal.utils.test.ts +0 -15
- package/src/__tests__/components/KeywordsPreviewModal/atoms.test.tsx +0 -101
- package/src/__tests__/modules/FramePreview/FramePreview.test.tsx +0 -318
- package/src/__tests__/modules/FramePreview/FramePreview.utils.test.ts +0 -242
- package/src/__tests__/modules/FramePreview/HeadingsOverlay/HeadingsOverlay.test.tsx +0 -185
- package/src/components/Browser/utils.tsx +0 -13
- package/src/components/Fields/SEOPreview/index.tsx +0 -36
- package/src/components/Fields/SEOPreview/style.tsx +0 -24
- package/src/components/FloatingNote/index.tsx +0 -35
- package/src/components/FloatingNote/style.tsx +0 -26
- package/src/components/HeadingsPreviewModal/ErrorsBanner/ErrorItem/index.tsx +0 -85
- package/src/components/HeadingsPreviewModal/ErrorsBanner/ErrorItem/style.tsx +0 -80
- package/src/components/HeadingsPreviewModal/ErrorsBanner/index.tsx +0 -57
- package/src/components/HeadingsPreviewModal/ErrorsBanner/style.tsx +0 -82
- package/src/components/HeadingsPreviewModal/HeadingItem/index.tsx +0 -71
- package/src/components/HeadingsPreviewModal/HeadingItem/style.tsx +0 -77
- package/src/components/HeadingsPreviewModal/index.tsx +0 -146
- package/src/components/HeadingsPreviewModal/style.tsx +0 -82
- package/src/components/HeadingsPreviewModal/utils.tsx +0 -257
- package/src/components/KeywordsPreviewModal/KeywordItem/index.tsx +0 -46
- package/src/components/KeywordsPreviewModal/KeywordItem/style.tsx +0 -64
- package/src/components/KeywordsPreviewModal/atoms.tsx +0 -96
- package/src/components/KeywordsPreviewModal/index.tsx +0 -99
- package/src/components/KeywordsPreviewModal/style.tsx +0 -87
- package/src/components/KeywordsPreviewModal/utils.tsx +0 -22
- package/src/components/PageInfoBanner/index.tsx +0 -38
- package/src/components/PageInfoBanner/styles.tsx +0 -40
- package/src/modules/FramePreview/HeadingsOverlay/index.tsx +0 -113
- package/src/modules/FramePreview/HeadingsOverlay/style.tsx +0 -24
- package/src/modules/FramePreview/utils.tsx +0 -140
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import { FloatingNote } from "@ax/components";
|
|
2
|
-
|
|
3
1
|
import styled, { css } from "styled-components";
|
|
4
2
|
|
|
5
|
-
const BrowserWrapper = styled.div
|
|
3
|
+
const BrowserWrapper = styled.div`
|
|
6
4
|
background-color: ${(p) => p.theme.color.uiBackground01};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
height: ${(p) => (p.isPreview ? "100%" : `calc(100vh - ${p.theme.spacing.xl} - (${p.theme.spacing.m} * 2))`)};
|
|
10
|
-
min-width: 360px;
|
|
11
|
-
width: ${(p) => (p.scaledWidth !== undefined ? `${p.scaledWidth}px` : "100%")};
|
|
12
|
-
margin: 0 auto;
|
|
5
|
+
height: 100%;
|
|
6
|
+
width: 100%;
|
|
13
7
|
`;
|
|
14
8
|
|
|
15
9
|
const NavBar = styled.div`
|
|
@@ -28,9 +22,6 @@ const NavUrl = styled.div`
|
|
|
28
22
|
height: ${(p) => p.theme.spacing.m};
|
|
29
23
|
padding: ${(p) => p.theme.spacing.xxs} ${(p) => p.theme.spacing.s};
|
|
30
24
|
width: 100%;
|
|
31
|
-
overflow: hidden;
|
|
32
|
-
white-space: nowrap;
|
|
33
|
-
text-overflow: ellipsis;
|
|
34
25
|
`;
|
|
35
26
|
|
|
36
27
|
const NavActions = styled.div`
|
|
@@ -68,14 +59,8 @@ const FrameWrapper = styled.div<{ hasBorder: boolean; isFormEditor: boolean }>`
|
|
|
68
59
|
border-bottom: ${(p) => (p.hasBorder ? `1px solid ${p.theme.color.uiLine}` : "none")};
|
|
69
60
|
display: flex;
|
|
70
61
|
justify-content: center;
|
|
71
|
-
flex: 1;
|
|
72
|
-
min-height: 0;
|
|
73
|
-
padding: ${(p) => (p.isFormEditor ? p.theme.spacing.m : "0")};
|
|
74
|
-
`;
|
|
75
|
-
|
|
76
|
-
const OuterContainer = styled.div`
|
|
77
|
-
width: 100%;
|
|
78
62
|
height: 100%;
|
|
63
|
+
padding: ${(p) => (p.isFormEditor ? p.theme.spacing.m : "0")};
|
|
79
64
|
`;
|
|
80
65
|
|
|
81
66
|
const Wrapper = styled.div`
|
|
@@ -84,8 +69,7 @@ const Wrapper = styled.div`
|
|
|
84
69
|
border-bottom: 1px solid ${(p) => p.theme.color.uiLine};
|
|
85
70
|
overflow: auto;
|
|
86
71
|
scroll-behavior: smooth;
|
|
87
|
-
|
|
88
|
-
min-height: 0;
|
|
72
|
+
height: 100%;
|
|
89
73
|
position: relative;
|
|
90
74
|
|
|
91
75
|
.headroom {
|
|
@@ -93,57 +77,4 @@ const Wrapper = styled.div`
|
|
|
93
77
|
}
|
|
94
78
|
`;
|
|
95
79
|
|
|
96
|
-
|
|
97
|
-
display: flex;
|
|
98
|
-
flex-direction: column;
|
|
99
|
-
position: relative;
|
|
100
|
-
width: 100%;
|
|
101
|
-
flex: 1;
|
|
102
|
-
min-height: 0;
|
|
103
|
-
`;
|
|
104
|
-
|
|
105
|
-
const StyledFloatingNote = styled(({ $compact: _, ...props }) => <FloatingNote {...props} />)<{ $compact?: boolean }>`
|
|
106
|
-
position: absolute;
|
|
107
|
-
left: ${(p) => p.theme.spacing.s};
|
|
108
|
-
top: ${(p) => p.theme.spacing.s};
|
|
109
|
-
right: ${(p) => p.theme.spacing.s};
|
|
110
|
-
${(p) => p.$compact && `&& { padding: ${p.theme.spacing.xs} ${p.theme.spacing.s}; }`}
|
|
111
|
-
`;
|
|
112
|
-
|
|
113
|
-
const ResolutionWrapper = styled.div`
|
|
114
|
-
display: flex;
|
|
115
|
-
margin-left: ${(p) => p.theme.spacing.xs};
|
|
116
|
-
min-width: 115px;
|
|
117
|
-
background-color: ${(p) => p.theme.color.uiBackground02};
|
|
118
|
-
border-radius: 10px;
|
|
119
|
-
align-items: center;
|
|
120
|
-
height: 24px;
|
|
121
|
-
`;
|
|
122
|
-
|
|
123
|
-
const SelectLabel = styled.div`
|
|
124
|
-
${(p) => p.theme.textStyle.uiXS};
|
|
125
|
-
flex-shrink: 0;
|
|
126
|
-
padding-left: ${(p) => p.theme.spacing.xs};
|
|
127
|
-
color: ${(p) => p.theme.color.textMediumEmphasis};
|
|
128
|
-
`;
|
|
129
|
-
|
|
130
|
-
const ZoomWrapper = styled.div`
|
|
131
|
-
margin-left: ${(p) => p.theme.spacing.s};
|
|
132
|
-
min-width: 65px;
|
|
133
|
-
`;
|
|
134
|
-
|
|
135
|
-
export {
|
|
136
|
-
OuterContainer,
|
|
137
|
-
BrowserWrapper,
|
|
138
|
-
NavBar,
|
|
139
|
-
NavUrl,
|
|
140
|
-
NavActions,
|
|
141
|
-
IconWrapper,
|
|
142
|
-
FrameWrapper,
|
|
143
|
-
Wrapper,
|
|
144
|
-
ContentWrapper,
|
|
145
|
-
StyledFloatingNote,
|
|
146
|
-
ResolutionWrapper,
|
|
147
|
-
ZoomWrapper,
|
|
148
|
-
SelectLabel,
|
|
149
|
-
};
|
|
80
|
+
export { BrowserWrapper, FrameWrapper, IconWrapper, NavActions, NavBar, NavUrl, Wrapper };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { OcassionalToast } from "@ax/components";
|
|
4
4
|
import { formatDate } from "@ax/helpers";
|
|
5
5
|
import type { ILanguage, ISocialState } from "@ax/types";
|
|
6
6
|
|
|
@@ -59,7 +59,7 @@ const BrowserContent = (props: IProps) => {
|
|
|
59
59
|
selectHoverEditorID={selectHoverEditorID}
|
|
60
60
|
>
|
|
61
61
|
{renderer === "sharedPage" && showBanner && (
|
|
62
|
-
<
|
|
62
|
+
<OcassionalToast
|
|
63
63
|
message={`This draft link expires on ${shareEndDate ? formatDate(new Date(shareEndDate)) : "..."}`}
|
|
64
64
|
icon="scheduled"
|
|
65
65
|
onDismiss={() => setShowBanner(false)}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
1
3
|
import { getInnerFields } from "@ax/forms";
|
|
2
4
|
import { FieldContainer, FieldGroup } from "@ax/components";
|
|
3
|
-
import
|
|
5
|
+
import { IErrorItem, IPage, ISite, ILanguage } from "@ax/types";
|
|
4
6
|
|
|
5
7
|
const Field = (props: IFieldProps): JSX.Element => {
|
|
6
8
|
const {
|
|
@@ -54,7 +56,7 @@ const Field = (props: IFieldProps): JSX.Element => {
|
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
return isGroup ? (
|
|
57
|
-
<FieldGroup title={field.title} collapsed={isCollapsed}
|
|
59
|
+
<FieldGroup title={field.title} collapsed={isCollapsed}>
|
|
58
60
|
{innerFields}
|
|
59
61
|
</FieldGroup>
|
|
60
62
|
) : (
|
|
@@ -56,25 +56,12 @@ export const StyledSelect = styled(AsyncSelect)<{
|
|
|
56
56
|
max-width: calc(${(p) => p.theme.spacing.xl} * 6);
|
|
57
57
|
margin-top: 0;
|
|
58
58
|
z-index: 99;
|
|
59
|
-
|
|
60
59
|
.react-select__menu-list {
|
|
61
60
|
border: 1px solid ${(p) => p.theme.color.uiLine};
|
|
62
61
|
border-radius: 4px;
|
|
63
62
|
max-height: calc(${(p) => p.theme.spacing.l} * 3);
|
|
64
63
|
overflow: auto;
|
|
65
64
|
padding: 0;
|
|
66
|
-
|
|
67
|
-
&::-webkit-scrollbar {
|
|
68
|
-
-webkit-appearance: none;
|
|
69
|
-
width: 4px;
|
|
70
|
-
height: 100%;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&::-webkit-scrollbar-thumb {
|
|
74
|
-
border-radius: 4px;
|
|
75
|
-
background-color: ${(p) => p.theme.colors.iconNonActive};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
65
|
.react-select__option {
|
|
79
66
|
background-color: ${(p) => p.theme.color.interactiveBackground};
|
|
80
67
|
min-height: ${(p) => p.theme.spacing.l};
|
|
@@ -3,17 +3,15 @@ import React from "react";
|
|
|
3
3
|
import * as S from "./style";
|
|
4
4
|
|
|
5
5
|
const FieldGroup = (props: IFieldsGroupProps): React.ReactElement => {
|
|
6
|
-
const { title, children, collapsed
|
|
6
|
+
const { title, children, collapsed } = props;
|
|
7
7
|
const [isOpen, setIsOpen] = React.useState(!collapsed);
|
|
8
8
|
|
|
9
9
|
const handleClick = () => {
|
|
10
10
|
setIsOpen(!isOpen);
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
const className = solid ? "filled" : "";
|
|
14
|
-
|
|
15
13
|
return (
|
|
16
|
-
<S.Wrapper data-testid="field-group-wrapper"
|
|
14
|
+
<S.Wrapper data-testid="field-group-wrapper">
|
|
17
15
|
<S.Label data-testid="field-group-label" onClick={handleClick} isOpen={isOpen}>
|
|
18
16
|
{title}
|
|
19
17
|
</S.Label>
|
|
@@ -30,5 +28,4 @@ interface IFieldsGroupProps {
|
|
|
30
28
|
title: string;
|
|
31
29
|
children: any;
|
|
32
30
|
collapsed?: boolean;
|
|
33
|
-
solid?: boolean;
|
|
34
31
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
export const Wrapper = styled.div`
|
|
4
|
+
margin: ${(p) => `${p.theme.spacing.m} 0 ${p.theme.spacing.m} 0`};
|
|
5
|
+
`;
|
|
6
|
+
|
|
7
|
+
export const Label = styled.div<{ isOpen: boolean }>`
|
|
4
8
|
position: relative;
|
|
5
9
|
${(p) => p.theme.textStyle.headingXXS};
|
|
6
10
|
color: ${(p) => p.theme.colors.textMediumEmphasis};
|
|
@@ -21,37 +25,8 @@ const Label = styled.div<{ isOpen: boolean }>`
|
|
|
21
25
|
}
|
|
22
26
|
`;
|
|
23
27
|
|
|
24
|
-
const Content = styled.div<{ isOpen: boolean }>`
|
|
28
|
+
export const Content = styled.div<{ isOpen: boolean }>`
|
|
25
29
|
overflow-y: ${(p) => (p.isOpen ? "visible" : "hidden")};
|
|
26
|
-
max-height: ${(p) => (p.isOpen ?
|
|
30
|
+
max-height: ${(p) => (p.isOpen ? `auto` : 0)};
|
|
27
31
|
transition: all 0.5s ease-in-out;
|
|
28
32
|
`;
|
|
29
|
-
|
|
30
|
-
const Wrapper = styled.div<{ isOpen: boolean }>`
|
|
31
|
-
margin: ${(p) => `${p.theme.spacing.m} 0 ${p.theme.spacing.m} 0`};
|
|
32
|
-
|
|
33
|
-
&.filled {
|
|
34
|
-
margin: ${(p) => `${p.theme.spacing.xs} 0`};
|
|
35
|
-
background-color: ${(p) => p.theme.colors.uiBackground02};
|
|
36
|
-
border: 1px solid ${(p) => (p.isOpen ? p.theme.color.interactive01 : p.theme.color.uiLine)};
|
|
37
|
-
border-radius: ${(p) => p.theme.radii.s};
|
|
38
|
-
padding: ${(p) => p.theme.spacing.s};
|
|
39
|
-
|
|
40
|
-
${Label} {
|
|
41
|
-
${(p) => (p.isOpen ? p.theme.textStyle.uiL : p.theme.textStyle.fieldContent)};
|
|
42
|
-
text-transform: none;
|
|
43
|
-
letter-spacing: normal;
|
|
44
|
-
color: ${(p) => p.theme.colors.textHighEmphasis};
|
|
45
|
-
border-bottom: none;
|
|
46
|
-
margin-bottom: 0;
|
|
47
|
-
padding-bottom: 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
${Content} {
|
|
51
|
-
padding-top: ${(p) => p.theme.spacing.s};
|
|
52
|
-
display: ${(p) => (p.isOpen ? "block" : "none")};
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
export { Wrapper, Label, Content };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { memo } from "react";
|
|
2
|
-
import
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import { IHeadingField, ISite } from "@ax/types";
|
|
3
3
|
import { FieldsBehavior, TextField, Wysiwyg } from "@ax/components";
|
|
4
4
|
|
|
5
5
|
import * as S from "./style";
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { memo, useState, useEffect } from "react";
|
|
1
|
+
import React, { memo, useState, useEffect } from "react";
|
|
2
2
|
import { Icon } from "@ax/components";
|
|
3
3
|
|
|
4
4
|
import * as S from "./style";
|
|
5
5
|
|
|
6
|
-
const NumberField = (props: INumberFieldProps) => {
|
|
6
|
+
const NumberField = (props: INumberFieldProps): JSX.Element => {
|
|
7
7
|
const { name, value, error, onChange, onBlur, maxValue, minValue, disabled, handleValidation, min, max } = props;
|
|
8
8
|
|
|
9
9
|
const strValue = value || value === 0 ? value.toString() : "";
|
|
10
10
|
const safeMax = typeof max !== "undefined" ? max : maxValue;
|
|
11
11
|
const safeMin = typeof min !== "undefined" ? min : minValue;
|
|
12
12
|
|
|
13
|
-
let validators: Record<string, unknown> = safeMax !== undefined ? { maxValue: safeMax } : {};
|
|
14
|
-
validators = safeMin !== undefined ? { ...validators, minValue: safeMin } : validators;
|
|
15
|
-
|
|
16
13
|
const [inputValue, setInputValue] = useState(strValue);
|
|
17
14
|
|
|
18
15
|
useEffect(() => {
|
|
@@ -20,18 +17,18 @@ const NumberField = (props: INumberFieldProps) => {
|
|
|
20
17
|
}, [strValue]);
|
|
21
18
|
|
|
22
19
|
const setValue = (value: string, eventType: string) => {
|
|
23
|
-
const floatValue = value
|
|
20
|
+
const floatValue = value || value === "0" ? parseFloat(value) : undefined;
|
|
24
21
|
setInputValue(value);
|
|
25
22
|
|
|
26
|
-
eventType === "blur" ? onBlur
|
|
23
|
+
eventType === "blur" ? onBlur && onBlur(floatValue) : onChange(floatValue);
|
|
27
24
|
};
|
|
28
25
|
|
|
29
26
|
const handleClick = (pressedKey: string) => {
|
|
30
27
|
const currentValue = parseFloat(inputValue);
|
|
31
28
|
|
|
32
|
-
let updatedValue =
|
|
33
|
-
const isMin =
|
|
34
|
-
const isMax =
|
|
29
|
+
let updatedValue = currentValue ? currentValue : 0;
|
|
30
|
+
const isMin = updatedValue === safeMin;
|
|
31
|
+
const isMax = updatedValue === safeMax;
|
|
35
32
|
|
|
36
33
|
if (pressedKey === "ArrowUp" && !isMax) {
|
|
37
34
|
updatedValue++;
|
|
@@ -41,17 +38,20 @@ const NumberField = (props: INumberFieldProps) => {
|
|
|
41
38
|
|
|
42
39
|
setInputValue(updatedValue.toString());
|
|
43
40
|
onChange(updatedValue);
|
|
44
|
-
handleValidation
|
|
41
|
+
handleValidation && handleValidation(updatedValue.toString(), validators);
|
|
45
42
|
};
|
|
46
43
|
|
|
44
|
+
let validators: Record<string, unknown> = safeMax ? { maxValue: safeMax } : {};
|
|
45
|
+
validators = safeMin ? { ...validators, minValue: safeMin } : validators;
|
|
46
|
+
|
|
47
47
|
const handleOnBlur = (e: React.FocusEvent<HTMLInputElement>) => {
|
|
48
48
|
setValue(e.target.value, e.type);
|
|
49
|
-
handleValidation
|
|
49
|
+
handleValidation && handleValidation(e.target.value, validators);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
53
53
|
setValue(e.target.value, e.type);
|
|
54
|
-
error && handleValidation
|
|
54
|
+
error && handleValidation && handleValidation(e.target.value, validators);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
const increaseValue = () => handleClick("ArrowUp");
|
|
@@ -72,10 +72,10 @@ const NumberField = (props: INumberFieldProps) => {
|
|
|
72
72
|
data-testid="input"
|
|
73
73
|
/>
|
|
74
74
|
<S.QuantityNav error={error} disabled={disabled}>
|
|
75
|
-
<S.ArrowUp onClick={
|
|
75
|
+
<S.ArrowUp onClick={increaseValue} data-testid="arrow-up">
|
|
76
76
|
<Icon name="UpArrow" />
|
|
77
77
|
</S.ArrowUp>
|
|
78
|
-
<S.ArrowDown onClick={
|
|
78
|
+
<S.ArrowDown onClick={decreaseValue} data-testid="arrow-down">
|
|
79
79
|
<Icon name="DownArrow" />
|
|
80
80
|
</S.ArrowDown>
|
|
81
81
|
</S.QuantityNav>
|
|
@@ -92,6 +92,7 @@ export interface INumberFieldProps {
|
|
|
92
92
|
maxValue?: number; // to deprecate
|
|
93
93
|
min?: number;
|
|
94
94
|
max?: number;
|
|
95
|
+
onClickIcon?: () => void;
|
|
95
96
|
onBlur?: (value: number | null | undefined) => void;
|
|
96
97
|
disabled?: boolean;
|
|
97
98
|
handleValidation?: (value: string, validators: Record<string, unknown>) => void;
|
|
@@ -19,12 +19,11 @@ const Select = (props: ISelectProps): JSX.Element => {
|
|
|
19
19
|
onChange,
|
|
20
20
|
alignRight,
|
|
21
21
|
maxWidth,
|
|
22
|
-
offSet,
|
|
23
22
|
} = props;
|
|
24
23
|
|
|
25
24
|
const className = error ? `react-select-error ${type}` : type;
|
|
26
25
|
const emptyOption = { value: "", label: placeholder || "Empty" };
|
|
27
|
-
const isSearchable = !(type === "inline" || type === "mini"
|
|
26
|
+
const isSearchable = !(type === "inline" || type === "mini");
|
|
28
27
|
|
|
29
28
|
const [hasEmptyOption, setHasEmptyOption] = useState(!mandatory);
|
|
30
29
|
const [inputText, setInputText] = useState<string>("");
|
|
@@ -91,7 +90,6 @@ const Select = (props: ISelectProps): JSX.Element => {
|
|
|
91
90
|
inputValue={inputText}
|
|
92
91
|
components={{ Menu }}
|
|
93
92
|
onKeyDown={handleKeyDown}
|
|
94
|
-
offSet={offSet}
|
|
95
93
|
/>
|
|
96
94
|
</div>
|
|
97
95
|
);
|
|
@@ -111,13 +109,11 @@ export interface ISelectProps {
|
|
|
111
109
|
alignRight?: boolean;
|
|
112
110
|
onChange: (value: string) => void;
|
|
113
111
|
maxWidth?: number;
|
|
114
|
-
offSet?: string;
|
|
115
112
|
}
|
|
116
113
|
|
|
117
114
|
interface IOptionProps {
|
|
118
115
|
value: string;
|
|
119
116
|
label: string;
|
|
120
|
-
isDisabled?: boolean;
|
|
121
117
|
}
|
|
122
118
|
|
|
123
119
|
export default Select;
|
|
@@ -6,7 +6,6 @@ export const StyledSelect = styled(Select)<{
|
|
|
6
6
|
error: boolean | undefined;
|
|
7
7
|
alignRight: boolean | undefined;
|
|
8
8
|
maxWidth?: number;
|
|
9
|
-
offSet?: string;
|
|
10
9
|
}>`
|
|
11
10
|
${(p) => p.theme.textStyle.fieldContent};
|
|
12
11
|
color: ${(p) => p.theme.color.textHighEmphasis};
|
|
@@ -57,25 +56,12 @@ export const StyledSelect = styled(Select)<{
|
|
|
57
56
|
max-width: calc(${(p) => p.theme.spacing.xl} * 6);
|
|
58
57
|
margin-top: 0;
|
|
59
58
|
z-index: 99;
|
|
60
|
-
|
|
61
59
|
.react-select__menu-list {
|
|
62
60
|
border: 1px solid ${(p) => p.theme.color.uiLine};
|
|
63
61
|
border-radius: 4px;
|
|
64
62
|
max-height: calc(${(p) => p.theme.spacing.l} * 3);
|
|
65
63
|
overflow: auto;
|
|
66
64
|
padding: 0;
|
|
67
|
-
|
|
68
|
-
&::-webkit-scrollbar {
|
|
69
|
-
-webkit-appearance: none;
|
|
70
|
-
width: 4px;
|
|
71
|
-
height: 100%;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&::-webkit-scrollbar-thumb {
|
|
75
|
-
border-radius: 4px;
|
|
76
|
-
background-color: ${(p) => p.theme.colors.iconNonActive};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
65
|
.react-select__option {
|
|
80
66
|
background-color: ${(p) => p.theme.color.interactiveBackground};
|
|
81
67
|
min-height: ${(p) => p.theme.spacing.l};
|
|
@@ -214,46 +200,4 @@ export const StyledSelect = styled(Select)<{
|
|
|
214
200
|
}
|
|
215
201
|
}
|
|
216
202
|
}
|
|
217
|
-
|
|
218
|
-
&.round {
|
|
219
|
-
${(p) => p.theme.textStyle.uiXS};
|
|
220
|
-
margin-bottom: 0;
|
|
221
|
-
|
|
222
|
-
.react-select__control {
|
|
223
|
-
height: 24px;
|
|
224
|
-
min-height: 24px;
|
|
225
|
-
border-radius: 10px;
|
|
226
|
-
border: none;
|
|
227
|
-
padding-left: ${(p) => p.theme.spacing.xs};
|
|
228
|
-
|
|
229
|
-
.react-select__value-container {
|
|
230
|
-
padding: 0;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.react-select__indicator {
|
|
234
|
-
padding: 0 4px;
|
|
235
|
-
svg {
|
|
236
|
-
width: ${(p) => p.theme.spacing.s};
|
|
237
|
-
height: ${(p) => p.theme.spacing.s};
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.react-select__menu {
|
|
243
|
-
min-width: 80px;
|
|
244
|
-
width: fit-content;
|
|
245
|
-
left: ${(p) => (p.offSet ? p.offSet : "50%")};
|
|
246
|
-
transform: translateX(-50%);
|
|
247
|
-
margin-top: ${(p) => p.theme.spacing.xxs};
|
|
248
|
-
|
|
249
|
-
.react-select__option {
|
|
250
|
-
${(p) => p.theme.textStyle.uiM};
|
|
251
|
-
padding: ${(p) => `${p.theme.spacing.xs} ${p.theme.spacing.m}`};
|
|
252
|
-
min-height: auto;
|
|
253
|
-
text-align: center;
|
|
254
|
-
white-space: nowrap;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
}
|
|
259
203
|
`;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
|
-
|
|
4
|
-
import type { IRootState } from "@ax/types";
|
|
3
|
+
import { IRootState } from "@ax/types";
|
|
5
4
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
6
5
|
|
|
7
6
|
import * as S from "./style";
|
|
8
7
|
|
|
9
8
|
const SummaryButton = (props: ISummaryButtonProps): JSX.Element => {
|
|
10
|
-
const { autoSummary, getPageSummary, disabled
|
|
9
|
+
const { autoSummary, getPageSummary, disabled } = props;
|
|
11
10
|
|
|
12
11
|
const initialState = {
|
|
13
12
|
isLoading: false,
|
|
@@ -28,15 +27,6 @@ const SummaryButton = (props: ISummaryButtonProps): JSX.Element => {
|
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
29
|
|
|
31
|
-
const descriptionText = description ? (
|
|
32
|
-
description
|
|
33
|
-
) : (
|
|
34
|
-
<>
|
|
35
|
-
You can automatically generate <strong>SEO meta descriptions</strong> and <strong>keywords</strong> quickly with{" "}
|
|
36
|
-
<strong>AI</strong>.
|
|
37
|
-
</>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
30
|
const buttonText = state.isLoading
|
|
41
31
|
? "Processing..."
|
|
42
32
|
: state.isClicked
|
|
@@ -46,8 +36,11 @@ const SummaryButton = (props: ISummaryButtonProps): JSX.Element => {
|
|
|
46
36
|
return (
|
|
47
37
|
<>
|
|
48
38
|
{autoSummary ? (
|
|
49
|
-
<S.Wrapper data-testid="summary-button-wrapper"
|
|
50
|
-
<S.Text>
|
|
39
|
+
<S.Wrapper data-testid="summary-button-wrapper">
|
|
40
|
+
<S.Text>
|
|
41
|
+
You can automatically generate <strong>SEO meta descriptions</strong> and <strong>keywords</strong> quickly
|
|
42
|
+
with <strong>AI</strong>.
|
|
43
|
+
</S.Text>
|
|
51
44
|
<S.ButtonWrapper>
|
|
52
45
|
<S.StyledButton
|
|
53
46
|
type="button"
|
|
@@ -70,9 +63,7 @@ const SummaryButton = (props: ISummaryButtonProps): JSX.Element => {
|
|
|
70
63
|
|
|
71
64
|
export interface ISummaryButtonProps {
|
|
72
65
|
autoSummary: boolean;
|
|
73
|
-
disabled
|
|
74
|
-
description?: React.ReactNode;
|
|
75
|
-
className?: string;
|
|
66
|
+
disabled: boolean;
|
|
76
67
|
getPageSummary: () => Promise<boolean>;
|
|
77
68
|
}
|
|
78
69
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import styled from "styled-components";
|
|
2
3
|
import { Button } from "@ax/components";
|
|
3
4
|
|
|
@@ -20,7 +21,7 @@ const ButtonWrapper = styled.div`
|
|
|
20
21
|
|
|
21
22
|
const StyledButton = styled((props) => <Button {...props} />)`
|
|
22
23
|
width: 100%;
|
|
23
|
-
max-width:
|
|
24
|
+
max-width: 264px;
|
|
24
25
|
`;
|
|
25
26
|
|
|
26
27
|
const ErrorText = styled.div`
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useState, useRef } from "react";
|
|
1
|
+
import React, { useState, useRef } from "react";
|
|
2
2
|
import { Tag } from "@ax/components";
|
|
3
3
|
|
|
4
4
|
import * as S from "./style";
|
|
5
5
|
|
|
6
6
|
const TagsField = (props: IProps): JSX.Element => {
|
|
7
|
-
const { value, onChange, disabled
|
|
7
|
+
const { value, onChange, disabled } = props;
|
|
8
8
|
const valueArray = value && Array.isArray(value) ? value : [];
|
|
9
9
|
const [inputValue, setInputValue] = useState("");
|
|
10
10
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
@@ -33,21 +33,22 @@ const TagsField = (props: IProps): JSX.Element => {
|
|
|
33
33
|
onChange(newValue);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const placeholder = valueArray.length > 0 ? "" : "Type a tag...";
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<S.Wrapper data-testid="tag-field-wrapper" onClick={_handleClick}>
|
|
40
|
-
{valueArray
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
{valueArray &&
|
|
41
|
+
valueArray.map((tag: string, index: number) => {
|
|
42
|
+
const handleDelete = () => deleteTag(index);
|
|
43
|
+
return <Tag key={tag} text={tag} onDeleteAction={disabled ? undefined : handleDelete} />;
|
|
44
|
+
})}
|
|
44
45
|
<S.Input
|
|
45
46
|
data-testid="tag-field-input"
|
|
46
47
|
ref={inputRef}
|
|
47
48
|
type="text"
|
|
48
49
|
value={inputValue}
|
|
49
50
|
onChange={_handleChange}
|
|
50
|
-
placeholder={
|
|
51
|
+
placeholder={placeholder}
|
|
51
52
|
onKeyDown={_handleKeyDown}
|
|
52
53
|
disabled={disabled}
|
|
53
54
|
spellCheck={true}
|