@clicoh/orion-library 1.2.0-beta.15 → 1.2.0-beta.17

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.
@@ -1,5 +1,21 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { type SetupMfaAccessibilityLabels } from './SetupMfa';
3
+ /** Copy of the form. Each one falls back to the original Spanish text. */
4
+ export type LoginFormLabels = {
5
+ username?: string;
6
+ password?: string;
7
+ code?: string;
8
+ submit?: string;
9
+ back?: string;
10
+ };
11
+ /** What `renderSubmit` receives to draw its own submit button. */
12
+ export type LoginFormSubmitState = {
13
+ /** `true` while `login` runs. */
14
+ pending: boolean;
15
+ /** `labels.submit`, or its default. */
16
+ label: string;
17
+ };
18
+ export type LoginFormErrorStyle = 'text' | 'message';
3
19
  type LoginFormProps = {
4
20
  login: (formData: FormData) => Promise<string | undefined>;
5
21
  callback?: () => void;
@@ -12,21 +28,68 @@ type LoginFormProps = {
12
28
  getOtpDigitAriaLabel?: (digit: number) => string;
13
29
  loadingLabel?: string;
14
30
  setupMfaAccessibilityLabels?: SetupMfaAccessibilityLabels;
31
+ title?: ReactNode;
32
+ description?: ReactNode;
33
+ labels?: LoginFormLabels;
34
+ forgotPassword?: ReactNode;
35
+ footer?: ReactNode;
36
+ renderSubmit?: (state: LoginFormSubmitState) => ReactNode;
37
+ errorStyle?: LoginFormErrorStyle;
38
+ toastErrors?: boolean;
39
+ showSpinner?: boolean;
15
40
  };
16
41
  /**
17
- * LoginForm component for rendering a login form with email and password inputs.
42
+ * LoginForm component for rendering a login form with email and password
43
+ * inputs, the verification code step and the MFA setup wizard.
44
+ *
45
+ * Every prop after `setupMfaAccessibilityLabels` is optional and keeps the
46
+ * original look when left out.
18
47
  *
19
48
  * @component
20
49
  * @example
21
50
  * // Example usage of LoginForm component
22
51
  * <LoginForm login={yourLoginFunction} callback={yourCallbackFunction} />
23
52
  *
53
+ * @example
54
+ * // Own copy, a recovery link, the error above the button and a custom submit
55
+ * <LoginForm
56
+ * login={yourLoginFunction}
57
+ * title="Welcome back"
58
+ * description="Sign in with your account."
59
+ * labels={{ username: 'Email', password: 'Password', submit: 'Sign in' }}
60
+ * forgotPassword={<a href="/recover">Forgot your password?</a>}
61
+ * footer={<Paragraph size="body-2">No access? Ask your admin.</Paragraph>}
62
+ * errorStyle="message"
63
+ * toastErrors={false}
64
+ * showSpinner={false}
65
+ * renderSubmit={({ pending, label }) => (
66
+ * <Button type="submit" disabled={pending} className="w-full">{label}</Button>
67
+ * )}
68
+ * />
69
+ *
24
70
  * @param {Object} props - The properties of the LoginForm component.
25
- * @param {Function} props.login - The function to handle the login process.
71
+ * @param {Function} props.login - The function to handle the login process. Resolves with a QR image to start the MFA setup, or with nothing when done; rejects with the message to show.
26
72
  * @param {Function} [props.callback] - Optional callback function to be called after a successful login.
73
+ * @param {boolean} [props.needCode=false] - Shows the verification code step instead of the credentials.
74
+ * @param {number} [props.lengthCode=6] - Digits of the verification code.
75
+ * @param {Function} [props.setupMfa] - Receives the two codes of the MFA setup wizard.
76
+ * @param {string} [props.showPasswordAriaLabel] - Accessible name of the button that shows the password.
77
+ * @param {string} [props.hidePasswordAriaLabel] - Accessible name of the button that hides the password.
78
+ * @param {Function} [props.getOtpDigitAriaLabel] - Accessible name of each code digit.
79
+ * @param {string} [props.loadingLabel] - Accessible name of the spinner.
80
+ * @param {SetupMfaAccessibilityLabels} [props.setupMfaAccessibilityLabels] - Accessible names of the MFA setup wizard.
81
+ * @param {ReactNode} [props.title='Bienvenido!'] - Heading above the form.
82
+ * @param {ReactNode} [props.description] - Text under the heading.
83
+ * @param {LoginFormLabels} [props.labels] - Field, code and button copy.
84
+ * @param {ReactNode} [props.forgotPassword] - Content above the submit button on the credentials step, such as a password recovery link.
85
+ * @param {ReactNode} [props.footer] - Content under the form, on the credentials and code steps.
86
+ * @param {Function} [props.renderSubmit] - Draws the submit button instead of the default one. It must render a `type="submit"` button.
87
+ * @param {'text' | 'message'} [props.errorStyle='text'] - `text` shows the error as red text under the buttons; `message` as an error `InlineMessage` above the submit button.
88
+ * @param {boolean} [props.toastErrors=true] - Also shows each error in a toast.
89
+ * @param {boolean} [props.showSpinner=true] - Shows a spinner under the form while `login` runs. Turn it off when `renderSubmit` already shows the wait.
27
90
  *
28
91
  * @returns {ReactNode} The rendered LoginForm component.
29
92
  */
30
- export declare function LoginForm({ login, callback, needCode, lengthCode, setupMfa, showPasswordAriaLabel, hidePasswordAriaLabel, getOtpDigitAriaLabel, loadingLabel, setupMfaAccessibilityLabels, }: LoginFormProps): ReactNode;
93
+ export declare function LoginForm({ login, callback, needCode, lengthCode, setupMfa, showPasswordAriaLabel, hidePasswordAriaLabel, getOtpDigitAriaLabel, loadingLabel, setupMfaAccessibilityLabels, title, description, labels, forgotPassword, footer, renderSubmit, errorStyle, toastErrors, showSpinner, }: LoginFormProps): ReactNode;
31
94
  export {};
32
95
  //# sourceMappingURL=LoginForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LoginForm.d.ts","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/LoginForm.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAoB,SAAS,EAAuB,MAAM,OAAO,CAAC;AAWzE,OAAO,EAAY,KAAK,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAExE,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC3D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IACzE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B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{ useEffect, useState } from 'react';
4
4
  import { FiArrowRight } from 'react-icons/fi';
5
5
  import { Button, Heading, Input, OtpInput, Paragraph, showToast, Spinner, } from '../../01-atoms';
6
+ import { InlineMessage } from '../../02-molecules';
6
7
  import { SetupMfa } from './SetupMfa';
8
+ const DEFAULT_LABELS = {
9
+ username: 'Usuario',
10
+ password: 'Contraseña',
11
+ code: 'Codigo de Verificación',
12
+ submit: 'Iniciar sesión',
13
+ back: 'Volver',
14
+ };
7
15
  /**
8
- * LoginForm component for rendering a login form with email and password inputs.
16
+ * LoginForm component for rendering a login form with email and password
17
+ * inputs, the verification code step and the MFA setup wizard.
18
+ *
19
+ * Every prop after `setupMfaAccessibilityLabels` is optional and keeps the
20
+ * original look when left out.
9
21
  *
10
22
  * @component
11
23
  * @example
12
24
  * // Example usage of LoginForm component
13
25
  * <LoginForm login={yourLoginFunction} callback={yourCallbackFunction} />
14
26
  *
27
+ * @example
28
+ * // Own copy, a recovery link, the error above the button and a custom submit
29
+ * <LoginForm
30
+ * login={yourLoginFunction}
31
+ * title="Welcome back"
32
+ * description="Sign in with your account."
33
+ * labels={{ username: 'Email', password: 'Password', submit: 'Sign in' }}
34
+ * forgotPassword={<a href="/recover">Forgot your password?</a>}
35
+ * footer={<Paragraph size="body-2">No access? Ask your admin.</Paragraph>}
36
+ * errorStyle="message"
37
+ * toastErrors={false}
38
+ * showSpinner={false}
39
+ * renderSubmit={({ pending, label }) => (
40
+ * <Button type="submit" disabled={pending} className="w-full">{label}</Button>
41
+ * )}
42
+ * />
43
+ *
15
44
  * @param {Object} props - The properties of the LoginForm component.
16
- * @param {Function} props.login - The function to handle the login process.
45
+ * @param {Function} props.login - The function to handle the login process. Resolves with a QR image to start the MFA setup, or with nothing when done; rejects with the message to show.
17
46
  * @param {Function} [props.callback] - Optional callback function to be called after a successful login.
47
+ * @param {boolean} [props.needCode=false] - Shows the verification code step instead of the credentials.
48
+ * @param {number} [props.lengthCode=6] - Digits of the verification code.
49
+ * @param {Function} [props.setupMfa] - Receives the two codes of the MFA setup wizard.
50
+ * @param {string} [props.showPasswordAriaLabel] - Accessible name of the button that shows the password.
51
+ * @param {string} [props.hidePasswordAriaLabel] - Accessible name of the button that hides the password.
52
+ * @param {Function} [props.getOtpDigitAriaLabel] - Accessible name of each code digit.
53
+ * @param {string} [props.loadingLabel] - Accessible name of the spinner.
54
+ * @param {SetupMfaAccessibilityLabels} [props.setupMfaAccessibilityLabels] - Accessible names of the MFA setup wizard.
55
+ * @param {ReactNode} [props.title='Bienvenido!'] - Heading above the form.
56
+ * @param {ReactNode} [props.description] - Text under the heading.
57
+ * @param {LoginFormLabels} [props.labels] - Field, code and button copy.
58
+ * @param {ReactNode} [props.forgotPassword] - Content above the submit button on the credentials step, such as a password recovery link.
59
+ * @param {ReactNode} [props.footer] - Content under the form, on the credentials and code steps.
60
+ * @param {Function} [props.renderSubmit] - Draws the submit button instead of the default one. It must render a `type="submit"` button.
61
+ * @param {'text' | 'message'} [props.errorStyle='text'] - `text` shows the error as red text under the buttons; `message` as an error `InlineMessage` above the submit button.
62
+ * @param {boolean} [props.toastErrors=true] - Also shows each error in a toast.
63
+ * @param {boolean} [props.showSpinner=true] - Shows a spinner under the form while `login` runs. Turn it off when `renderSubmit` already shows the wait.
18
64
  *
19
65
  * @returns {ReactNode} The rendered LoginForm component.
20
66
  */
21
- export function LoginForm({ login, callback, needCode = false, lengthCode = 6, setupMfa, showPasswordAriaLabel, hidePasswordAriaLabel, getOtpDigitAriaLabel, loadingLabel, setupMfaAccessibilityLabels, }) {
67
+ export function LoginForm({ login, callback, needCode = false, lengthCode = 6, setupMfa, showPasswordAriaLabel, hidePasswordAriaLabel, getOtpDigitAriaLabel, loadingLabel, setupMfaAccessibilityLabels, title = 'Bienvenido!', description, labels, forgotPassword, footer, renderSubmit, errorStyle = 'text', toastErrors = true, showSpinner = true, }) {
22
68
  const [errorMessage, setErrorMessage] = useState();
23
69
  const [otpCode, setOtpCode] = useState('');
24
70
  const [isPending, setIsPending] = useState(false);
25
71
  const [qr, setQr] = useState();
26
72
  const [showLogin, setShowLogin] = useState(!needCode);
73
+ const copy = { ...DEFAULT_LABELS, ...labels };
27
74
  useEffect(() => {
28
75
  setShowLogin(!needCode);
29
76
  }, [needCode]);
30
77
  const handlerSubmit = (event) => {
31
78
  event.preventDefault();
32
79
  setIsPending(true);
80
+ setErrorMessage(undefined);
33
81
  const formData = new FormData(event.currentTarget);
34
82
  if (needCode && otpCode) {
35
83
  formData.append('otpCode', otpCode);
@@ -41,7 +89,8 @@ export function LoginForm({ login, callback, needCode = false, lengthCode = 6, s
41
89
  .catch((error) => {
42
90
  const message = error instanceof Error ? error.message : String(error);
43
91
  setErrorMessage(message);
44
- showToast(message, 'error');
92
+ if (toastErrors)
93
+ showToast(message, 'error');
45
94
  })
46
95
  .finally(() => {
47
96
  setIsPending(false);
@@ -55,19 +104,30 @@ export function LoginForm({ login, callback, needCode = false, lengthCode = 6, s
55
104
  const handleSetupMfa = (firstCode, secondCode) => {
56
105
  return setupMfa?.(firstCode, secondCode);
57
106
  };
107
+ const submit = renderSubmit?.({
108
+ pending: isPending,
109
+ label: copy.submit,
110
+ }) ?? (<Button type="submit" iconR={<FiArrowRight />} aria-disabled={isPending} disabled={isPending} className="w-full">
111
+ {copy.submit}
112
+ </Button>);
58
113
  return (<>
59
114
  {!qr && (<>
60
- <Heading level="h4">Bienvenido!</Heading>
115
+ <div className="flex flex-col items-center gap-2 text-center">
116
+ <Heading level="h4">{title}</Heading>
117
+ {!!description && (<Paragraph className="text-gray-1 dark:text-gray-2 text-pretty">
118
+ {description}
119
+ </Paragraph>)}
120
+ </div>
61
121
  <form onSubmit={handlerSubmit} aria-busy={isPending} className="flex w-72 flex-col items-center gap-4">
62
122
  {!!showLogin && (<>
63
- <Input label="Usuario" input={{
123
+ <Input label={copy.username} input={{
64
124
  type: 'email',
65
125
  name: 'username',
66
126
  required: true,
67
127
  autoComplete: 'email',
68
128
  disabled: isPending,
69
129
  }}/>
70
- <Input label="Contraseña" showPasswordAriaLabel={showPasswordAriaLabel} hidePasswordAriaLabel={hidePasswordAriaLabel} input={{
130
+ <Input label={copy.password} showPasswordAriaLabel={showPasswordAriaLabel} hidePasswordAriaLabel={hidePasswordAriaLabel} input={{
71
131
  type: 'password',
72
132
  name: 'password',
73
133
  required: true,
@@ -76,21 +136,25 @@ export function LoginForm({ login, callback, needCode = false, lengthCode = 6, s
76
136
  }}/>
77
137
  </>)}
78
138
 
79
- {!showLogin && (<OtpInput label="Codigo de Verificación" length={lengthCode} handleSubmit={(otp) => setOtpCode(otp)} getDigitAriaLabel={getOtpDigitAriaLabel}/>)}
139
+ {!showLogin && (<OtpInput label={copy.code} length={lengthCode} handleSubmit={(otp) => setOtpCode(otp)} getDigitAriaLabel={getOtpDigitAriaLabel}/>)}
140
+
141
+ {errorStyle === 'message' && !!errorMessage && (<InlineMessage modifier="error" className="w-full">
142
+ {errorMessage}
143
+ </InlineMessage>)}
144
+ {!!showLogin && forgotPassword}
80
145
 
81
- <Button type="submit" iconR={<FiArrowRight />} aria-disabled={isPending} disabled={isPending} className="w-full">
82
- Iniciar sesión
83
- </Button>
146
+ {submit}
84
147
  {!showLogin && (<Button className="w-56" type="button" onClick={onCancel}>
85
- Volver
148
+ {copy.back}
86
149
  </Button>)}
87
- {!!errorMessage && (<Paragraph role="alert" className="text-error dark:text-error-1 text-center" size="chips">
150
+ {errorStyle === 'text' && !!errorMessage && (<Paragraph role="alert" className="text-error dark:text-error-1 text-center" size="chips">
88
151
  {errorMessage}
89
152
  </Paragraph>)}
90
- <div className={clsx('self-center', !isPending && 'invisible opacity-0')}>
91
- <Spinner label={loadingLabel}/>
92
- </div>
153
+ {showSpinner && (<div className={clsx('self-center', !isPending && 'invisible opacity-0')}>
154
+ <Spinner label={loadingLabel}/>
155
+ </div>)}
93
156
  </form>
157
+ {footer}
94
158
  </>)}
95
159
  {!!qr && (<SetupMfa lengthCode={lengthCode} onCancel={onCancel} qrImage={qr} setupMfa={handleSetupMfa} accessibilityLabels={setupMfaAccessibilityLabels}/>)}
96
160
  </>);
@@ -1 +1 @@
1
- {"version":3,"file":"LoginForm.jsx","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/LoginForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAA+B,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,GACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAoC,MAAM,YAAY,CAAC;AAgBxE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,UAAU,GAAG,CAAC,EACd,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,2BAA2B,GACZ;IACf,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,EAAU,CAAC;IAC3D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAS,EAAE,CAAC,CAAC;IACnD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAC3D,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,QAAQ,EAAsB,CAAC;IACnD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAU,CAAC,QAAQ,CAAC,CAAC;IAE/D,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,aAAa,GAAsC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,EAAE,MAAM,CACR;YAAA,CAAC,CAAC,SAAS,IAAI,CACb,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CACvD;;cACF,EAAE,MAAM,CAAC,CACV,CACD;YAAA,CAAC,CAAC,CAAC,YAAY,IAAI,CACjB,CAAC,SAAS,CACR,IAAI,CAAC,OAAO,CACZ,SAAS,CAAC,0CAA0C,CACpD,IAAI,CAAC,OAAO,CAEZ;gBAAA,CAAC,YAAY,CACf;cAAA,EAAE,SAAS,CAAC,CACb,CACD;YAAA,CAAC,GAAG,CACF,SAAS,CAAC,CAAC,IAAI,CACb,aAAa,EACb,CAAC,SAAS,IAAI,qBAAqB,CACpC,CAAC,CAEF;cAAA,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAC/B;YAAA,EAAE,GAAG,CACP;UAAA,EAAE,IAAI,CACR;QAAA,GAAG,CACJ,CACD;MAAA,CAAC,CAAC,CAAC,EAAE,IAAI,CACP,CAAC,QAAQ,CACP,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,OAAO,CAAC,CAAC,EAAE,CAAC,CACZ,QAAQ,CAAC,CAAC,cAAc,CAAC,CACzB,mBAAmB,CAAC,CAAC,2BAA2B,CAAC,EACjD,CACH,CACH;IAAA,GAAG,CACJ,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"LoginForm.jsx","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/LoginForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAA+B,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,Q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,CAAC,OAAO,CACZ,SAAS,CAAC,0CAA0C,CACpD,IAAI,CAAC,OAAO,CAEZ;gBAAA,CAAC,YAAY,CACf;cAAA,EAAE,SAAS,CAAC,CACb,CACD;YAAA,CAAC,WAAW,IAAI,CACd,CAAC,GAAG,CACF,SAAS,CAAC,CAAC,IAAI,CACb,aAAa,EACb,CAAC,SAAS,IAAI,qBAAqB,CACpC,CAAC,CAEF;gBAAA,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAC/B;cAAA,EAAE,GAAG,CAAC,CACP,CACH;UAAA,EAAE,IAAI,CACN;UAAA,CAAC,MAAM,CACT;QAAA,GAAG,CACJ,CACD;MAAA,CAAC,CAAC,CAAC,EAAE,IAAI,CACP,CAAC,QAAQ,CACP,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,OAAO,CAAC,CAAC,EAAE,CAAC,CACZ,QAAQ,CAAC,CAAC,cAAc,CAAC,CACzB,mBAAmB,CAAC,CAAC,2BAA2B,CAAC,EACjD,CACH,CACH;IAAA,GAAG,CACJ,CAAC;AACJ,CAAC"}
@@ -1,27 +1,45 @@
1
- import type { ReactNode } from 'react';
1
+ import type { CSSProperties, ReactNode } from 'react';
2
2
  import { StaticImageData } from 'next/dist/shared/lib/get-img-props';
3
3
  type LoginTemplateProps = {
4
4
  children: ReactNode;
5
5
  loginImg?: StaticImageData;
6
6
  logoAriaLabel?: string;
7
7
  logo?: ReactNode;
8
+ aside?: ReactNode;
9
+ imagePosition?: CSSProperties['objectPosition'];
8
10
  };
9
11
  /**
10
- * LoginTemplate component for rendering the login page layout.
12
+ * LoginTemplate component for rendering the login page layout: an image on
13
+ * the left and the content on the right. On small screens only the content
14
+ * shows.
11
15
  *
12
16
  * @component
13
17
  * @example
14
18
  * // Example usage of LoginTemplate component
15
19
  * <LoginTemplate>
16
- * <LoginForm handlerLogin={yourHandlerLoginFunction} />
20
+ * <LoginForm login={yourLoginFunction} />
21
+ * </LoginTemplate>
22
+ *
23
+ * @example
24
+ * // A tagline over the image, keeping the left part of the image in view
25
+ * <LoginTemplate
26
+ * loginImg={productImage}
27
+ * imagePosition="30% 50%"
28
+ * aside={<Heading level="h4">Your tagline</Heading>}
29
+ * >
30
+ * <LoginForm login={yourLoginFunction} />
17
31
  * </LoginTemplate>
18
32
  *
19
33
  * @param {Object} props - The properties of the LoginTemplate component.
20
34
  * @param {ReactNode} props.children - The content to be rendered inside the login template.
35
+ * @param {StaticImageData} [props.loginImg] - Image on the left. Defaults to the clicOH one.
36
+ * @param {string} [props.logoAriaLabel] - Accessible name of the default clicOH logo.
21
37
  * @param {ReactNode} [props.logo=<Logo />] - Brand mark above the content. Replaces the clicOH logo, so `logoAriaLabel` no longer applies.
38
+ * @param {ReactNode} [props.aside] - Content over the bottom of the image, on a dark gradient so white text reads. White by default; hidden with the image on small screens.
39
+ * @param {string} [props.imagePosition] - CSS `object-position` of the image: the part that stays in view when it is cropped. Defaults to the center.
22
40
  *
23
41
  * @returns {ReactNode} The rendered LoginTemplate component.
24
42
  */
25
- export declare function LoginTemplate(props: LoginTemplateProps): ReactNode;
43
+ export declare function LoginTemplate({ children, loginImg, logoAriaLabel, logo, aside, imagePosition, }: LoginTemplateProps): ReactNode;
26
44
  export {};
27
45
  //# sourceMappingURL=LoginTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LoginTemplate.d.ts","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/LoginTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAyBlE"}
1
+ {"version":3,"file":"LoginTemplate.d.ts","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/LoginTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAItD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,aAAa,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,KAAK,EACL,aAAa,GACd,EAAE,kBAAkB,GAAG,SAAS,CA6BhC"}
@@ -3,30 +3,49 @@ import LoginImg from '../../../../assets/images/login-clicoh.jpg';
3
3
  import { Logo } from '../../01-atoms';
4
4
  import { dataUrl } from './dataUrl';
5
5
  /**
6
- * LoginTemplate component for rendering the login page layout.
6
+ * LoginTemplate component for rendering the login page layout: an image on
7
+ * the left and the content on the right. On small screens only the content
8
+ * shows.
7
9
  *
8
10
  * @component
9
11
  * @example
10
12
  * // Example usage of LoginTemplate component
11
13
  * <LoginTemplate>
12
- * <LoginForm handlerLogin={yourHandlerLoginFunction} />
14
+ * <LoginForm login={yourLoginFunction} />
15
+ * </LoginTemplate>
16
+ *
17
+ * @example
18
+ * // A tagline over the image, keeping the left part of the image in view
19
+ * <LoginTemplate
20
+ * loginImg={productImage}
21
+ * imagePosition="30% 50%"
22
+ * aside={<Heading level="h4">Your tagline</Heading>}
23
+ * >
24
+ * <LoginForm login={yourLoginFunction} />
13
25
  * </LoginTemplate>
14
26
  *
15
27
  * @param {Object} props - The properties of the LoginTemplate component.
16
28
  * @param {ReactNode} props.children - The content to be rendered inside the login template.
29
+ * @param {StaticImageData} [props.loginImg] - Image on the left. Defaults to the clicOH one.
30
+ * @param {string} [props.logoAriaLabel] - Accessible name of the default clicOH logo.
17
31
  * @param {ReactNode} [props.logo=<Logo />] - Brand mark above the content. Replaces the clicOH logo, so `logoAriaLabel` no longer applies.
32
+ * @param {ReactNode} [props.aside] - Content over the bottom of the image, on a dark gradient so white text reads. White by default; hidden with the image on small screens.
33
+ * @param {string} [props.imagePosition] - CSS `object-position` of the image: the part that stays in view when it is cropped. Defaults to the center.
18
34
  *
19
35
  * @returns {ReactNode} The rendered LoginTemplate component.
20
36
  */
21
- export function LoginTemplate(props) {
37
+ export function LoginTemplate({ children, loginImg, logoAriaLabel, logo, aside, imagePosition, }) {
22
38
  return (<div className="flex">
23
- <div className="relative min-h-svh flex-1 bg-black">
24
- <Image src={props.loginImg || LoginImg} alt="" aria-hidden="true" sizes="(max-width: 2247px) 100vw, 2247px" fill={true} className="object-cover" placeholder="blur" blurDataURL={dataUrl}/>
39
+ <div className="relative min-h-svh flex-1 overflow-hidden bg-black">
40
+ <Image src={loginImg || LoginImg} alt="" aria-hidden="true" sizes="(max-width: 2247px) 100vw, 2247px" fill={true} className="object-cover" style={imagePosition ? { objectPosition: imagePosition } : undefined} placeholder="blur" blurDataURL={dataUrl}/>
41
+ {!!aside && (<div className="absolute inset-x-0 bottom-0 flex flex-col gap-3 bg-linear-to-t from-black/90 via-black/70 to-transparent px-10 pt-32 pb-8 text-white">
42
+ {aside}
43
+ </div>)}
25
44
  </div>
26
45
  <main className="flex min-h-svh w-[460px] items-center justify-center bg-white text-black dark:bg-black dark:text-white">
27
46
  <div className="flex flex-col items-center justify-center gap-4">
28
- {props.logo ?? (<Logo width={94} height={40} aria-label={props.logoAriaLabel}/>)}
29
- {props.children}
47
+ {logo ?? <Logo width={94} height={40} aria-label={logoAriaLabel}/>}
48
+ {children}
30
49
  </div>
31
50
  </main>
32
51
  </div>);
@@ -1 +1 @@
1
- {"version":3,"file":"LoginTemplate.jsx","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/LoginTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,QAAQ,MAAM,4CAA4C,CAAC;AAClE,OAAO,EAAW,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,CACL,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CACnB;MAAA,CAAC,GAAG,CAAC,SAAS,CAAC,oCAAoC,CACjD;QAAA,CAAC,KAAK,CACJ,GAAG,CAAC,CAAE,KAAK,CAAC,QAA4B,IAAI,QAAQ,CAAC,CACrD,GAAG,CAAC,EAAE,CACN,WAAW,CAAC,MAAM,CAClB,KAAK,CAAC,mCAAmC,CACzC,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,SAAS,CAAC,cAAc,CACxB,WAAW,CAAC,MAAM,CAClB,WAAW,CAAC,CAAC,OAAO,CAAC,EAEzB;MAAA,EAAE,GAAG,CACL;MAAA,CAAC,IAAI,CAAC,SAAS,CAAC,wGAAwG,CACtH;QAAA,CAAC,GAAG,CAAC,SAAS,CAAC,iDAAiD,CAC9D;UAAA,CAAC,KAAK,CAAC,IAAI,IAAI,CACb,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,EAAG,CACjE,CACD;UAAA,CAAC,KAAK,CAAC,QAAQ,CACjB;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"LoginTemplate.jsx","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/LoginTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,QAAQ,MAAM,4CAA4C,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,KAAK,EACL,aAAa,GACM;IACnB,OAAO,CACL,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CACnB;MAAA,CAAC,GAAG,CAAC,SAAS,CAAC,oDAAoD,CACjE;QAAA,CAAC,KAAK,CACJ,GAAG,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAC1B,GAAG,CAAC,EAAE,CACN,WAAW,CAAC,MAAM,CAClB,KAAK,CAAC,mCAAmC,CACzC,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,SAAS,CAAC,cAAc,CACxB,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CACrE,WAAW,CAAC,MAAM,CAClB,WAAW,CAAC,CAAC,OAAO,CAAC,EAEvB;QAAA,CAAC,CAAC,CAAC,KAAK,IAAI,CACV,CAAC,GAAG,CAAC,SAAS,CAAC,sIAAsI,CACnJ;YAAA,CAAC,KAAK,CACR;UAAA,EAAE,GAAG,CAAC,CACP,CACH;MAAA,EAAE,GAAG,CACL;MAAA,CAAC,IAAI,CAAC,SAAS,CAAC,wGAAwG,CACtH;QAAA,CAAC,GAAG,CAAC,SAAS,CAAC,iDAAiD,CAC9D;UAAA,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC,EAAG,CACnE;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { LoginTemplate } from './LoginTemplate';
2
2
  export { LoginForm } from './LoginForm';
3
+ export type { LoginFormErrorStyle, LoginFormLabels, LoginFormSubmitState, } from './LoginForm';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,oBAAoB,GACrB,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@clicoh/orion-library",
3
- "version": "1.2.0-beta.15",
3
+ "version": "1.2.0-beta.17",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "@floating-ui/react": "0.26.19",
7
7
  "clsx": "2.1.1",
8
8
  "leaflet": "^1.9.4",
9
- "next": "16.2.6",
9
+ "next": "16.3.8",
10
10
  "react": "19.2.6",
11
11
  "react-dom": "19.2.6",
12
12
  "react-icons": "5.2.1",
@@ -29,7 +29,7 @@
29
29
  "@types/react-dom": "19.2.3",
30
30
  "@types/tailwindcss": "3.1.0",
31
31
  "eslint": "8",
32
- "eslint-config-next": "16.2.6",
32
+ "eslint-config-next": "16.3.8",
33
33
  "eslint-config-prettier": "9.1.0",
34
34
  "eslint-plugin-prettier": "5.1.3",
35
35
  "eslint-plugin-storybook": "0.6.15",