@griddo/ax 12.16.0 → 12.17.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.
- package/README.md +1 -0
- package/config/griddo-config/index.js +3 -2
- package/package.json +7 -4
- package/public/img/logos/logoGriddoDxp.svg +22 -0
- package/public/img/logos/logoGriddoG.svg +10 -0
- package/src/GlobalStore.tsx +32 -25
- package/src/__tests__/GlobalStore.session.test.tsx +98 -0
- package/src/__tests__/api/global.test.ts +64 -0
- package/src/__tests__/api/session.test.ts +311 -0
- package/src/__tests__/api/sessionRenewal.test.ts +705 -0
- package/src/__tests__/api/utils.test.ts +373 -0
- package/src/__tests__/components/Fields/FileField/FileField.test.tsx +33 -6
- package/src/__tests__/components/FieldsBehavior/FieldsBehavior.test.tsx +5 -3
- package/src/__tests__/components/Login/BrandPalette.test.tsx +145 -0
- package/src/__tests__/components/Login/Login.test.tsx +2 -33
- package/src/__tests__/components/Login/LoginCollapsible.test.tsx +271 -0
- package/src/__tests__/components/Login/LoginDropdownCard.test.tsx +311 -0
- package/src/__tests__/components/Login/LoginFooter.test.tsx +128 -0
- package/src/__tests__/components/Login/LoginGriddoId.test.tsx +213 -0
- package/src/__tests__/components/Login/LoginInlineError.test.tsx +116 -0
- package/src/__tests__/components/Login/RecoveryModal/RecoveryModal.test.tsx +3 -4
- package/src/__tests__/components/SsoDenied/SsoDenied.test.tsx +86 -0
- package/src/__tests__/config/webpackAliases.test.ts +18 -0
- package/src/__tests__/containers/App/reducer.griddoId.test.ts +18 -0
- package/src/__tests__/containers/App/session.test.ts +397 -0
- package/src/__tests__/containers/App/signInOut.test.ts +159 -0
- package/src/__tests__/helpers/griddoId.test.ts +56 -0
- package/src/__tests__/hooks/useShouldBeSaved.test.tsx +78 -0
- package/src/__tests__/locales/loginLocale.test.ts +37 -0
- package/src/__tests__/modules/App/Routing/NavMenu.test.tsx +54 -0
- package/src/__tests__/modules/App/Routing/PrivateRoute.test.tsx +64 -0
- package/src/__tests__/modules/App/Routing/Routing.startup.test.tsx +79 -0
- package/src/__tests__/modules/Login/Login.test.tsx +169 -0
- package/src/__tests__/modules/Login/loginError.uc.test.tsx +294 -0
- package/src/__tests__/modules/Login/signInOut.test.tsx +125 -0
- package/src/__tests__/modules/Redirects/RedirectPanel/RedirectPanel.test.tsx +9 -0
- package/src/__tests__/modules/Redirects/Redirects/Redirects.create.test.tsx +19 -0
- package/src/__tests__/modules/Redirects/Redirects/Redirects.edit.test.tsx +19 -0
- package/src/__tests__/modules/Redirects/Redirects/Redirects.filter.test.tsx +19 -0
- package/src/__tests__/modules/SsoDenied/SsoDenied.test.tsx +30 -0
- package/src/__tests__/routes/publicRoutes.test.ts +36 -0
- package/src/api/global.tsx +24 -1
- package/src/api/session.tsx +197 -0
- package/src/api/sessionRenewal.tsx +114 -0
- package/src/api/utils.tsx +22 -12
- package/src/{helpers/categoryColumns.tsx → components/CategoryCell/buildCategoryColumns.tsx} +3 -2
- package/src/components/Circle/index.tsx +1 -1
- package/src/components/Circle/style.tsx +4 -2
- package/src/components/ErrorPage/index.tsx +1 -1
- package/src/components/ErrorPage/style.tsx +11 -9
- package/src/components/ErrorToast/index.tsx +2 -0
- package/src/{helpers/fields.tsx → components/FieldsBehavior/getFieldByPath.tsx} +1 -1
- package/src/components/FieldsBehavior/index.tsx +3 -1
- package/src/components/Login/LoginFooter/index.tsx +16 -0
- package/src/components/Login/LoginFooter/style.tsx +17 -0
- package/src/components/Login/LoginForm/index.tsx +147 -79
- package/src/components/Login/LoginForm/style.tsx +147 -24
- package/src/components/Login/LoginGriddoId/index.tsx +56 -0
- package/src/components/Login/LoginGriddoId/style.tsx +35 -0
- package/src/components/Login/LoginSSO/index.tsx +4 -7
- package/src/components/Login/LoginSSO/style.tsx +10 -26
- package/src/components/Login/LoginSlider/style.tsx +5 -5
- package/src/components/Login/index.tsx +35 -6
- package/src/components/Login/style.tsx +40 -24
- package/src/components/Notification/index.tsx +3 -1
- package/src/components/SsoDenied/index.tsx +46 -0
- package/src/components/SsoDenied/style.tsx +37 -0
- package/src/components/index.tsx +11 -7
- package/src/containers/App/actions.tsx +114 -6
- package/src/containers/App/interfaces.tsx +2 -2
- package/src/containers/App/reducer.tsx +9 -0
- package/src/containers/Users/actions.tsx +28 -24
- package/src/helpers/griddoId.ts +28 -0
- package/src/helpers/index.tsx +4 -5
- package/src/hooks/forms.tsx +8 -5
- package/src/locales/en-US.ts +13 -0
- package/src/locales/es-ES.ts +13 -0
- package/src/locales/index.ts +9 -1
- package/src/modules/App/Routing/NavMenu/index.tsx +4 -4
- package/src/modules/Content/PageItem/index.tsx +6 -8
- package/src/modules/Login/index.tsx +33 -14
- package/src/modules/SsoDenied/index.tsx +9 -0
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +6 -8
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +9 -11
- package/src/modules/Users/UserEdit/index.tsx +9 -2
- package/src/routes/publicRoutes.tsx +3 -0
- package/src/themes/brandPalette.ts +16 -0
- package/public/img/logos/logoSQY.svg +0 -3
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ReactNode, useEffect, useId, useRef, useState } from "react";
|
|
2
2
|
|
|
3
|
+
import { Button, ErrorToast, FieldsBehavior, Icon } from "@ax/components";
|
|
3
4
|
import type { IGlobalSettings } from "@ax/containers/App/reducer";
|
|
4
5
|
import { useModal } from "@ax/hooks";
|
|
5
|
-
import {
|
|
6
|
+
import { getLoginLocale } from "@ax/locales";
|
|
7
|
+
|
|
8
|
+
import LoginFooter from "../LoginFooter";
|
|
6
9
|
import RecoveryModal from "./RecoveryModal";
|
|
7
10
|
|
|
8
11
|
import * as S from "./style";
|
|
@@ -24,9 +27,10 @@ const LoginForm = (props: ILoginFormProps): JSX.Element => {
|
|
|
24
27
|
settings,
|
|
25
28
|
rememberMe,
|
|
26
29
|
handleRememberMe,
|
|
30
|
+
alternative,
|
|
31
|
+
brand,
|
|
27
32
|
} = props;
|
|
28
33
|
|
|
29
|
-
const [viewPass, setViewPass] = useState(false);
|
|
30
34
|
const { isOpen, toggleModal } = useModal();
|
|
31
35
|
|
|
32
36
|
useEffect(() => {
|
|
@@ -36,97 +40,154 @@ const LoginForm = (props: ILoginFormProps): JSX.Element => {
|
|
|
36
40
|
};
|
|
37
41
|
}, [toggleModal]);
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
// Con `alternative` (Griddo ID) el formulario nace plegado; sin ella es el de siempre.
|
|
44
|
+
const [isFormOpen, setIsFormOpen] = useState(false);
|
|
45
|
+
const formPanelId = useId();
|
|
46
|
+
const formPanelRef = useRef<HTMLDivElement>(null);
|
|
47
|
+
const toggleRef = useRef<HTMLButtonElement>(null);
|
|
48
|
+
const focusEmailOnOpen = useRef(false);
|
|
49
|
+
|
|
50
|
+
// El email recibe el foco solo tras desplegar por acción de la persona (no al montar ni al plegar). `preventScroll`:
|
|
51
|
+
// el panel es `overflow: hidden` y, sin él, el foco desplaza su contenido y los campos saltan al abrir.
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (isFormOpen && focusEmailOnOpen.current) {
|
|
54
|
+
focusEmailOnOpen.current = false;
|
|
55
|
+
formPanelRef.current?.querySelector<HTMLInputElement>("[name=email]")?.focus({ preventScroll: true });
|
|
56
|
+
}
|
|
57
|
+
}, [isFormOpen]);
|
|
40
58
|
|
|
41
|
-
const
|
|
59
|
+
const _toggleForm = () => {
|
|
60
|
+
const next = !isFormOpen;
|
|
42
61
|
|
|
43
|
-
|
|
44
|
-
|
|
62
|
+
focusEmailOnOpen.current = next;
|
|
63
|
+
setIsFormOpen(next);
|
|
64
|
+
|
|
65
|
+
// Al plegar, el campo enfocado desaparece: el foco vuelve al botón.
|
|
66
|
+
if (!next) toggleRef.current?.focus();
|
|
67
|
+
};
|
|
45
68
|
|
|
46
69
|
const textName = settings.welcomeText2 ? settings.welcomeText2 : "Griddo";
|
|
47
70
|
const nameLogo =
|
|
48
71
|
textName === "Griddo" ? <img src="/img/logos/logoGriddoExtended@3x.svg" alt="Griddo Logo" /> : textName;
|
|
49
72
|
|
|
73
|
+
const text = getLoginLocale();
|
|
74
|
+
const btnText = isLoggingIn ? text.submitting : text.submit;
|
|
75
|
+
|
|
76
|
+
const form = (
|
|
77
|
+
<S.Form $inDropdown={Boolean(alternative)} onSubmit={(e) => handleSubmit(e, { onLostPassword: toggleModal })}>
|
|
78
|
+
<FieldsBehavior
|
|
79
|
+
fieldType="TextField"
|
|
80
|
+
title="Email"
|
|
81
|
+
autoComplete="email"
|
|
82
|
+
value={email}
|
|
83
|
+
onChange={handleEmail}
|
|
84
|
+
name="email"
|
|
85
|
+
inversed
|
|
86
|
+
placeholder="Type your email"
|
|
87
|
+
/>
|
|
88
|
+
<FieldsBehavior
|
|
89
|
+
fieldType="TextField"
|
|
90
|
+
title="Password"
|
|
91
|
+
inputType="password"
|
|
92
|
+
placeholder="*****"
|
|
93
|
+
value={password}
|
|
94
|
+
onChange={handlePassword}
|
|
95
|
+
autoComplete="current-password"
|
|
96
|
+
name="password"
|
|
97
|
+
inversed
|
|
98
|
+
/>
|
|
99
|
+
<S.Actions $inDropdown={Boolean(alternative)}>
|
|
100
|
+
<FieldsBehavior
|
|
101
|
+
fieldType="UniqueCheck"
|
|
102
|
+
title=""
|
|
103
|
+
value={rememberMe}
|
|
104
|
+
onChange={handleRememberMe}
|
|
105
|
+
options={[{ title: "Remember me" }]}
|
|
106
|
+
name="rememberMe"
|
|
107
|
+
inversed
|
|
108
|
+
/>
|
|
109
|
+
<S.Password $inDropdown={Boolean(alternative)}>
|
|
110
|
+
<button
|
|
111
|
+
type="button"
|
|
112
|
+
onClick={toggleModal}
|
|
113
|
+
onKeyDown={(e) => {
|
|
114
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
toggleModal();
|
|
117
|
+
}
|
|
118
|
+
}}
|
|
119
|
+
tabIndex={0}
|
|
120
|
+
data-testid="forgot-button"
|
|
121
|
+
>
|
|
122
|
+
Lost your password?
|
|
123
|
+
</button>
|
|
124
|
+
</S.Password>
|
|
125
|
+
</S.Actions>
|
|
126
|
+
<Button type="submit" disabled={isLoggingIn}>
|
|
127
|
+
{btnText}
|
|
128
|
+
</Button>
|
|
129
|
+
</S.Form>
|
|
130
|
+
);
|
|
131
|
+
|
|
50
132
|
return (
|
|
51
|
-
<S.Wrapper>
|
|
133
|
+
<S.Wrapper data-testid="login-block" $anchored={Boolean(alternative)}>
|
|
52
134
|
<S.Main>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
name="rememberMe"
|
|
93
|
-
inversed
|
|
94
|
-
/>
|
|
95
|
-
<S.Password>
|
|
96
|
-
<button
|
|
97
|
-
type="button"
|
|
98
|
-
onClick={toggleModal}
|
|
99
|
-
onKeyDown={(e) => {
|
|
100
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
101
|
-
e.preventDefault();
|
|
102
|
-
toggleModal();
|
|
103
|
-
}
|
|
104
|
-
}}
|
|
105
|
-
tabIndex={0}
|
|
106
|
-
data-testid="forgot-button"
|
|
107
|
-
>
|
|
108
|
-
Lost your password?
|
|
109
|
-
</button>
|
|
110
|
-
</S.Password>
|
|
111
|
-
</S.Actions>
|
|
112
|
-
<Button type="submit" disabled={isLoggingIn}>
|
|
113
|
-
{btnText}
|
|
114
|
-
</Button>
|
|
115
|
-
<RecoveryModal isOpen={isOpen} toggleModal={toggleModal} />
|
|
116
|
-
</S.Form>
|
|
135
|
+
{alternative && brand}
|
|
136
|
+
{alternative ? (
|
|
137
|
+
<S.Header>
|
|
138
|
+
<S.Welcome>{text.welcome}</S.Welcome>
|
|
139
|
+
<S.Subtitle>{text.startPublishing}</S.Subtitle>
|
|
140
|
+
</S.Header>
|
|
141
|
+
) : (
|
|
142
|
+
<S.Header>
|
|
143
|
+
<S.Title>
|
|
144
|
+
<div>Welcome to</div>
|
|
145
|
+
<div>{nameLogo}</div>
|
|
146
|
+
</S.Title>
|
|
147
|
+
<S.Subtitle>To start using {textName}, introduce your email and password.</S.Subtitle>
|
|
148
|
+
</S.Header>
|
|
149
|
+
)}
|
|
150
|
+
{alternative}
|
|
151
|
+
{!alternative && <ErrorToast role="alert" />}
|
|
152
|
+
{alternative ? (
|
|
153
|
+
<S.Dropdown data-testid="login-dropdown" $open={isFormOpen}>
|
|
154
|
+
<S.DropdownButton
|
|
155
|
+
type="button"
|
|
156
|
+
ref={toggleRef}
|
|
157
|
+
$open={isFormOpen}
|
|
158
|
+
aria-expanded={isFormOpen}
|
|
159
|
+
aria-controls={formPanelId}
|
|
160
|
+
onClick={_toggleForm}
|
|
161
|
+
>
|
|
162
|
+
{text.emailPasswordToggle}
|
|
163
|
+
<Icon name={isFormOpen ? "up-arrow" : "down-arrow"} size="24" />
|
|
164
|
+
</S.DropdownButton>
|
|
165
|
+
<ErrorToast role="alert" />
|
|
166
|
+
<S.Collapsible id={formPanelId} ref={formPanelRef} $open={isFormOpen} aria-hidden={!isFormOpen}>
|
|
167
|
+
<S.CollapsibleInner>{form}</S.CollapsibleInner>
|
|
168
|
+
</S.Collapsible>
|
|
169
|
+
</S.Dropdown>
|
|
170
|
+
) : (
|
|
171
|
+
form
|
|
172
|
+
)}
|
|
173
|
+
<RecoveryModal isOpen={isOpen} toggleModal={toggleModal} />
|
|
117
174
|
</S.Main>
|
|
118
|
-
<
|
|
119
|
-
Made with care at{" "}
|
|
120
|
-
<a href="https://www.secuoyas.com/" target="_blank" rel="noopener noreferrer">
|
|
121
|
-
<img src="/img/logos/logoSQY.svg" alt="Secuoyas logo" />
|
|
122
|
-
</a>
|
|
123
|
-
</S.Secuoyas>
|
|
175
|
+
<LoginFooter />
|
|
124
176
|
</S.Wrapper>
|
|
125
177
|
);
|
|
126
178
|
};
|
|
127
179
|
|
|
180
|
+
/** Contexto que el formulario entrega al enviar. */
|
|
181
|
+
export interface ILoginSubmitContext {
|
|
182
|
+
onLostPassword: () => void;
|
|
183
|
+
}
|
|
184
|
+
|
|
128
185
|
export interface ILoginFormProps {
|
|
129
|
-
|
|
186
|
+
/**
|
|
187
|
+
* `context.onLostPassword` abre el modal de recuperación: el login lo guarda en el aviso del 403 como `btnAction`
|
|
188
|
+
* para que «Lost your password?» no dependa de `window.handleErrorClick` (que `resetError()` borra al teclear).
|
|
189
|
+
*/
|
|
190
|
+
handleSubmit: (e: React.FormEvent<HTMLFormElement>, context?: ILoginSubmitContext) => void;
|
|
130
191
|
email: string;
|
|
131
192
|
handleEmail: (email: string) => void;
|
|
132
193
|
password: string;
|
|
@@ -135,6 +196,13 @@ export interface ILoginFormProps {
|
|
|
135
196
|
settings: IGlobalSettings;
|
|
136
197
|
rememberMe: boolean;
|
|
137
198
|
handleRememberMe: () => void;
|
|
199
|
+
/**
|
|
200
|
+
* Alternativa de acceso sobre el formulario (SSO de Griddo). Con ella la cabecera es «Welcome / Login to start
|
|
201
|
+
* publishing» y el formulario lleva su propia etiqueta.
|
|
202
|
+
*/
|
|
203
|
+
alternative?: ReactNode;
|
|
204
|
+
/** Logo que abre el bloque anclado (solo con `alternative`): entra en el flujo, sin posición absoluta. */
|
|
205
|
+
brand?: ReactNode;
|
|
138
206
|
}
|
|
139
207
|
|
|
140
208
|
export default LoginForm;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
import { BRAND_PALETTE } from "@ax/themes/brandPalette";
|
|
2
|
+
|
|
1
3
|
import styled from "styled-components";
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
// Con Griddo ID (`$anchored`) el bloque arranca arriba (logo a 64px) y crece hacia abajo, con scroll interno si no
|
|
6
|
+
// cabe; el login de siempre sigue centrado.
|
|
7
|
+
const Wrapper = styled.div<{ $anchored?: boolean }>`
|
|
8
|
+
box-sizing: border-box;
|
|
4
9
|
width: 368px;
|
|
5
10
|
position: relative;
|
|
6
11
|
height: 100%;
|
|
7
12
|
display: flex;
|
|
8
|
-
align-items: center;
|
|
13
|
+
align-items: ${(p) => (p.$anchored ? "flex-start" : "center")};
|
|
14
|
+
padding-top: ${(p) => (p.$anchored ? "64px" : "0")};
|
|
15
|
+
overflow-y: ${(p) => (p.$anchored ? "auto" : "visible")};
|
|
16
|
+
// overflow-y: auto fuerza overflow-x: auto. Al desplegar, CollapsibleInner (margen derecho −25px) sobresale 24px
|
|
17
|
+
// mientras anima el padding de la tarjeta y asomaba un scroll horizontal. Nada de este bloque debe desbordar a los lados.
|
|
18
|
+
overflow-x: ${(p) => (p.$anchored ? "hidden" : "visible")};
|
|
9
19
|
`;
|
|
10
20
|
|
|
11
21
|
const Main = styled.div`
|
|
@@ -37,42 +47,155 @@ const Title = styled.div`
|
|
|
37
47
|
}
|
|
38
48
|
`;
|
|
39
49
|
|
|
40
|
-
const
|
|
50
|
+
const Welcome = styled.h1`
|
|
51
|
+
color: ${(p) => p.theme.color.textHighEmphasisInverse};
|
|
52
|
+
font-size: 24px;
|
|
53
|
+
font-weight: 400;
|
|
54
|
+
line-height: 25px;
|
|
55
|
+
margin-bottom: ${(p) => p.theme.spacing.xs};
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
// Misma duración y curva para el panel y la caja (padding, borde, fondo, radio, alto): si una parte anima y otra no,
|
|
59
|
+
// el despliegue se ve a trompicones y el texto del botón salta de padding.
|
|
60
|
+
const BOX_TRANSITION = "0.3s ease";
|
|
61
|
+
|
|
62
|
+
// Botón-dropdown (Figma 4068:410442 / 4068:456568). Plegado, el contenedor es transparente y sin borde y la «caja» de
|
|
63
|
+
// 48px la lleva el botón; abierto, el contenedor pasa a tarjeta de 12px de radio (cabecera + error + formulario). El
|
|
64
|
+
// texto de la cabecera queda a 24px del borde izquierdo y el icono a 26px del derecho en ambos estados (borde de 1px +
|
|
65
|
+
// 23px de padding a la izquierda, 25px a la derecha); la cabecera abierta queda a 12px del borde superior. Es flex en columna para que el `#error` único (siempre montado) cambie de sitio solo con `order`:
|
|
66
|
+
// plegado encima del botón (hueco fijo), abierto tras la cabecera y sobre Email.
|
|
67
|
+
const Dropdown = styled.div<{ $open: boolean }>`
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
margin-top: 32px; // Figma (Anatomía): botón SSO (bottom y=319) → tarjeta (y=351): 24 + 8
|
|
72
|
+
background-color: ${(p) => (p.$open ? BRAND_PALETTE.navyControl : "transparent")};
|
|
73
|
+
border: ${(p) => (p.$open ? "1px" : "0")} solid ${(p) => (p.$open ? "rgba(219,221,233,.3)" : "transparent")};
|
|
74
|
+
border-radius: ${(p) => (p.$open ? "12px" : "8px")};
|
|
75
|
+
padding: ${(p) => (p.$open ? "11px 25px 28px 23px" : "0")};
|
|
76
|
+
transition:
|
|
77
|
+
padding ${BOX_TRANSITION},
|
|
78
|
+
border-width ${BOX_TRANSITION},
|
|
79
|
+
background-color ${BOX_TRANSITION},
|
|
80
|
+
border-color ${BOX_TRANSITION},
|
|
81
|
+
border-radius ${BOX_TRANSITION};
|
|
82
|
+
|
|
83
|
+
@media (prefers-reduced-motion: reduce) {
|
|
84
|
+
transition: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
> #error {
|
|
88
|
+
position: static;
|
|
89
|
+
order: ${(p) => (p.$open ? 0 : -1)};
|
|
90
|
+
&:not(:empty) {
|
|
91
|
+
margin: ${(p) => (p.$open ? `${p.theme.spacing.s} 0 0` : `0 0 ${p.theme.spacing.xs}`)};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
const DropdownButton = styled.button<{ $open: boolean }>`
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: space-between;
|
|
101
|
+
width: 100%;
|
|
102
|
+
height: ${(p) => (p.$open ? "24px" : "48px")};
|
|
103
|
+
padding: ${(p) => (p.$open ? "0" : "0 25px 0 23px")};
|
|
104
|
+
background-color: ${(p) => (p.$open ? "transparent" : BRAND_PALETTE.navyControl)};
|
|
105
|
+
border: 1px solid ${(p) => (p.$open ? "transparent" : "rgba(219,221,233,.3)")};
|
|
106
|
+
border-width: ${(p) => (p.$open ? "0" : "1px")};
|
|
107
|
+
border-radius: ${(p) => (p.$open ? "0" : "8px")};
|
|
108
|
+
transition:
|
|
109
|
+
padding ${BOX_TRANSITION},
|
|
110
|
+
height ${BOX_TRANSITION},
|
|
111
|
+
background-color ${BOX_TRANSITION},
|
|
112
|
+
border-color ${BOX_TRANSITION},
|
|
113
|
+
border-width ${BOX_TRANSITION},
|
|
114
|
+
border-radius ${BOX_TRANSITION};
|
|
115
|
+
font-family: inherit;
|
|
116
|
+
font-size: 15px;
|
|
117
|
+
line-height: 19px;
|
|
118
|
+
color: ${(p) => p.theme.color.textMediumEmphasisInverse};
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
|
|
121
|
+
svg {
|
|
122
|
+
flex-shrink: 0;
|
|
123
|
+
fill: ${(p) => p.theme.color.textMediumEmphasisInverse};
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
// Plegado suave sin reservar alto: el panel colapsa a 0 (`grid-template-rows`) y `visibility` lo retira del foco y de
|
|
128
|
+
// los lectores cuando acaba la animación.
|
|
129
|
+
const Collapsible = styled.div<{ $open: boolean }>`
|
|
130
|
+
display: grid;
|
|
131
|
+
grid-template-rows: ${(p) => (p.$open ? "1fr" : "0fr")};
|
|
132
|
+
visibility: ${(p) => (p.$open ? "visible" : "hidden")};
|
|
133
|
+
transition:
|
|
134
|
+
grid-template-rows ${BOX_TRANSITION},
|
|
135
|
+
visibility 0s linear ${(p) => (p.$open ? "0s" : "0.3s")};
|
|
136
|
+
|
|
137
|
+
@media (prefers-reduced-motion: reduce) {
|
|
138
|
+
transition: none;
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
|
|
142
|
+
// El margen/padding derecho de 25px (el de la tarjeta) deja sitio a «Lost your password?», que sobresale 9px del
|
|
143
|
+
// formulario, sin que el `overflow: hidden` de la animación lo recorte.
|
|
144
|
+
const CollapsibleInner = styled.div`
|
|
145
|
+
min-height: 0;
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
margin-right: -25px;
|
|
148
|
+
padding-right: 25px;
|
|
149
|
+
`;
|
|
150
|
+
|
|
151
|
+
// Dentro del dropdown el ancho es el de la tarjeta abierta (368 − 2×1px de borde − 23px − 25px de padding) desde el primer
|
|
152
|
+
// frame: así los inputs no se estrechan mientras el padding del contenedor anima (reflow visible al desplegar).
|
|
153
|
+
const Form = styled.form<{ $inDropdown?: boolean }>`
|
|
154
|
+
${(p) => p.$inDropdown && "width: 318px;"}
|
|
41
155
|
display: flex;
|
|
42
156
|
flex-direction: column;
|
|
43
|
-
margin-top: ${(p) => p.theme.spacing.m};
|
|
157
|
+
margin-top: ${(p) => (p.$inDropdown ? "53px" : p.theme.spacing.m)};
|
|
158
|
+
|
|
159
|
+
// Figma (Anatomía, tarjeta abierta): etiqueta → input a 25px y 24px entre el final de un input y la etiqueta siguiente.
|
|
160
|
+
${(p) =>
|
|
161
|
+
p.$inDropdown &&
|
|
162
|
+
`> div[id^="gdd_"] {
|
|
163
|
+
padding-top: 25px;
|
|
164
|
+
margin-bottom: 20px;
|
|
165
|
+
}`}
|
|
44
166
|
`;
|
|
45
167
|
|
|
46
|
-
|
|
168
|
+
// Figma (tarjeta abierta): el enlace baja 2px y sobresale 9px del formulario por la derecha.
|
|
169
|
+
const Password = styled.div<{ $inDropdown?: boolean }>`
|
|
47
170
|
${(p) => p.theme.textStyle.uiS};
|
|
48
171
|
color: ${(p) => p.theme.color.interactiveInverse};
|
|
49
172
|
width: 100%;
|
|
50
173
|
text-align: right;
|
|
174
|
+
${(p) => p.$inDropdown && "position: relative; top: 2px; margin-right: -9px; width: calc(100% + 9px);"}
|
|
51
175
|
|
|
52
176
|
button {
|
|
53
177
|
cursor: pointer;
|
|
54
178
|
}
|
|
55
179
|
`;
|
|
56
180
|
|
|
57
|
-
|
|
181
|
+
// Figma (tarjeta abierta): «Remember me» a 17px del input de contraseña y 33px sobre el botón de login.
|
|
182
|
+
const Actions = styled.div<{ $inDropdown?: boolean }>`
|
|
58
183
|
display: flex;
|
|
184
|
+
${(p) => p.$inDropdown && "margin: -7px 0 9px;"}
|
|
59
185
|
`;
|
|
60
186
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
`;
|
|
77
|
-
|
|
78
|
-
export { Wrapper, Main, Header, Subtitle, Title, Form, Password, Actions, Secuoyas };
|
|
187
|
+
export {
|
|
188
|
+
Actions,
|
|
189
|
+
Collapsible,
|
|
190
|
+
CollapsibleInner,
|
|
191
|
+
Dropdown,
|
|
192
|
+
DropdownButton,
|
|
193
|
+
Form,
|
|
194
|
+
Header,
|
|
195
|
+
Main,
|
|
196
|
+
Password,
|
|
197
|
+
Subtitle,
|
|
198
|
+
Title,
|
|
199
|
+
Welcome,
|
|
200
|
+
Wrapper,
|
|
201
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
import { getLoginLocale } from "@ax/locales";
|
|
4
|
+
|
|
5
|
+
import * as S from "./style";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* «Entrar con Griddo» (`auth.griddo.io`), sobre el formulario de usuario y contraseña. Solo existe junto al login
|
|
9
|
+
* normal: con el SSO de Comillas activo no se muestra.
|
|
10
|
+
*/
|
|
11
|
+
const LoginGriddoId = (props: ILoginGriddoIdProps): JSX.Element => {
|
|
12
|
+
const { handleGriddoId, errorSSO } = props;
|
|
13
|
+
|
|
14
|
+
const text = getLoginLocale();
|
|
15
|
+
const hasNavigated = useRef(false);
|
|
16
|
+
|
|
17
|
+
// Con «Atrás» el navegador puede restaurar esta página de su caché (bfcache) con el estado de antes de navegar:
|
|
18
|
+
// el botón debe volver a funcionar.
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const handlePageShow = (e: PageTransitionEvent) => {
|
|
21
|
+
if (e.persisted) hasNavigated.current = false;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
window.addEventListener("pageshow", handlePageShow);
|
|
25
|
+
|
|
26
|
+
return () => window.removeEventListener("pageshow", handlePageShow);
|
|
27
|
+
}, []);
|
|
28
|
+
|
|
29
|
+
// Un doble clic no debe iniciar dos flujos: la segunda pulsación se ignora.
|
|
30
|
+
const handleClick = () => {
|
|
31
|
+
if (hasNavigated.current) return;
|
|
32
|
+
|
|
33
|
+
hasNavigated.current = true;
|
|
34
|
+
handleGriddoId();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<S.Alternatives>
|
|
39
|
+
{errorSSO && <S.StyledNotification text={errorSSO} type="error" closeButton={false} />}
|
|
40
|
+
<S.FullWidthButton type="button" onClick={handleClick}>
|
|
41
|
+
<S.ContentButton>
|
|
42
|
+
<S.Mark src="/img/logos/logoGriddoG.svg" alt="" />
|
|
43
|
+
<S.TextButton>{text.griddoIdButton}</S.TextButton>
|
|
44
|
+
</S.ContentButton>
|
|
45
|
+
</S.FullWidthButton>
|
|
46
|
+
</S.Alternatives>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
interface ILoginGriddoIdProps {
|
|
51
|
+
handleGriddoId: () => void;
|
|
52
|
+
/** Error a mostrar sobre el botón; omitir si la pantalla que lo contiene ya lo muestra. */
|
|
53
|
+
errorSSO?: string | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default LoginGriddoId;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
import { StyledButton } from "../LoginSSO/style";
|
|
4
|
+
|
|
5
|
+
export { ContentButton, IconButton, StyledNotification, TextButton } from "../LoginSSO/style";
|
|
6
|
+
|
|
7
|
+
const Alternatives = styled.div`
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: ${(p) => p.theme.spacing.s};
|
|
11
|
+
margin-top: 32px; // Figma: «Login to start publishing» → botón SSO. Con el logo a 96px, el botón queda en y=280 (captura del slider)
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
const FullWidthButton = styled(StyledButton)`
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: ${(p) => p.theme.spacing.l};
|
|
17
|
+
border-radius: 8px;
|
|
18
|
+
font-size: 16px;
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
line-height: 16px;
|
|
21
|
+
letter-spacing: 0;
|
|
22
|
+
text-transform: none;
|
|
23
|
+
|
|
24
|
+
&:before {
|
|
25
|
+
border-radius: 8px;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
const Mark = styled.img`
|
|
30
|
+
width: 16px;
|
|
31
|
+
height: 24px;
|
|
32
|
+
margin-right: 12px;
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
export { Alternatives, FullWidthButton, Mark };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ErrorToast, Icon } from "@ax/components";
|
|
2
2
|
import type { IGlobalSettings } from "@ax/containers/App/reducer";
|
|
3
3
|
|
|
4
|
+
import LoginFooter from "../LoginFooter";
|
|
5
|
+
|
|
4
6
|
import * as S from "./style";
|
|
5
7
|
|
|
6
8
|
const LoginSSO = (props: ILoginSSOProps): JSX.Element => {
|
|
@@ -55,12 +57,7 @@ const LoginSSO = (props: ILoginSSOProps): JSX.Element => {
|
|
|
55
57
|
)}
|
|
56
58
|
</S.StartWrapper>
|
|
57
59
|
</S.Main>
|
|
58
|
-
<
|
|
59
|
-
Made with care at{" "}
|
|
60
|
-
<a href="https://www.secuoyas.com/" target="_blank" rel="noopener noreferrer">
|
|
61
|
-
<img src="/img/logos/logoSQY.svg" alt="Secuoyas logo" />
|
|
62
|
-
</a>
|
|
63
|
-
</S.Secuoyas>
|
|
60
|
+
<LoginFooter />
|
|
64
61
|
</S.Wrapper>
|
|
65
62
|
);
|
|
66
63
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { Button, Notification } from "@ax/components";
|
|
4
4
|
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
|
|
5
7
|
const Wrapper = styled.div`
|
|
6
8
|
position: relative;
|
|
7
9
|
height: 100%;
|
|
@@ -62,38 +64,20 @@ const IconButton = styled.div`
|
|
|
62
64
|
|
|
63
65
|
const TextButton = styled.div``;
|
|
64
66
|
|
|
65
|
-
const Secuoyas = styled.div`
|
|
66
|
-
${(p) => p.theme.textStyle.uiXS};
|
|
67
|
-
position: absolute;
|
|
68
|
-
display: flex;
|
|
69
|
-
color: ${(p) => p.theme.color.textMediumEmphasisInverse};
|
|
70
|
-
justify-content: center;
|
|
71
|
-
align-items: center;
|
|
72
|
-
left: 0;
|
|
73
|
-
bottom: ${(p) => p.theme.spacing.m};
|
|
74
|
-
padding-bottom: ${(p) => p.theme.spacing.xs};
|
|
75
|
-
img {
|
|
76
|
-
width: 20px;
|
|
77
|
-
height: 20px;
|
|
78
|
-
margin-left: ${(p) => p.theme.spacing.xs};
|
|
79
|
-
}
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
67
|
const StyledNotification = styled((props) => <Notification {...props} />)`
|
|
83
68
|
margin-bottom: ${(p) => p.theme.spacing.s};
|
|
84
69
|
`;
|
|
85
70
|
|
|
86
71
|
export {
|
|
87
|
-
|
|
88
|
-
|
|
72
|
+
ContentButton,
|
|
73
|
+
IconButton,
|
|
89
74
|
Logo,
|
|
90
|
-
|
|
75
|
+
Main,
|
|
91
76
|
StartWrapper,
|
|
92
|
-
Text,
|
|
93
77
|
StyledButton,
|
|
94
|
-
ContentButton,
|
|
95
|
-
IconButton,
|
|
96
|
-
TextButton,
|
|
97
|
-
Secuoyas,
|
|
98
78
|
StyledNotification,
|
|
79
|
+
Text,
|
|
80
|
+
TextButton,
|
|
81
|
+
Welcome,
|
|
82
|
+
Wrapper,
|
|
99
83
|
};
|
|
@@ -21,7 +21,7 @@ const BannerWrapper = styled.div`
|
|
|
21
21
|
position: relative;
|
|
22
22
|
width: 100%;
|
|
23
23
|
height: 100vh;
|
|
24
|
-
padding-left:
|
|
24
|
+
padding-left: 101px; // Figma: x=101 dentro de la columna derecha
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
27
|
const Title = styled.div`
|
|
@@ -32,7 +32,7 @@ const Title = styled.div`
|
|
|
32
32
|
line-height: 48px;
|
|
33
33
|
letter-spacing: 0px;
|
|
34
34
|
text-align: left;
|
|
35
|
-
padding-top:
|
|
35
|
+
padding-top: 136px;
|
|
36
36
|
width: 450px;
|
|
37
37
|
`;
|
|
38
38
|
|
|
@@ -41,13 +41,13 @@ const Image = styled.div<{ image: string }>`
|
|
|
41
41
|
background-size: 130%;
|
|
42
42
|
width: 100%;
|
|
43
43
|
height: 100%;
|
|
44
|
-
margin-top:
|
|
44
|
+
margin-top: 48px; // Figma (Anatomía): captura en y=280 (título a 136 + 96 de alto + 48)
|
|
45
45
|
`;
|
|
46
46
|
|
|
47
47
|
const Buttons = styled.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
position: absolute;
|
|
50
|
-
left:
|
|
50
|
+
left: 101px;
|
|
51
51
|
top: 64px;
|
|
52
52
|
z-index: 10;
|
|
53
53
|
`;
|
|
@@ -65,4 +65,4 @@ const Arrow = styled.div<{ direction: string }>`
|
|
|
65
65
|
}
|
|
66
66
|
`;
|
|
67
67
|
|
|
68
|
-
export {
|
|
68
|
+
export { Arrow, BannerWrapper, Buttons, Image, Title, Wrapper };
|