@native-systems/ui 1.0.5 → 1.0.7
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/dist/index.cjs +77 -65
- package/dist/index.d.ts +12 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +77 -65
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -112,6 +112,7 @@ const ForwardRef$4 = /*#__PURE__*/ React__namespace.forwardRef(EyeIcon);
|
|
|
112
112
|
function InputField({
|
|
113
113
|
id,
|
|
114
114
|
label,
|
|
115
|
+
hideLabel = false,
|
|
115
116
|
register,
|
|
116
117
|
type,
|
|
117
118
|
required,
|
|
@@ -122,12 +123,14 @@ function InputField({
|
|
|
122
123
|
return jsxRuntime.jsxs('div', {
|
|
123
124
|
className: 'flex flex-col space-y-2',
|
|
124
125
|
children: [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
!hideLabel
|
|
127
|
+
? jsxRuntime.jsx('label', {
|
|
128
|
+
htmlFor: id,
|
|
129
|
+
className:
|
|
130
|
+
'block ml-1 text-sm font-medium text-gray-700 dark:text-white',
|
|
131
|
+
children: label,
|
|
132
|
+
})
|
|
133
|
+
: null,
|
|
131
134
|
isPasswordField
|
|
132
135
|
? jsxRuntime.jsxs('div', {
|
|
133
136
|
className: 'relative w-full',
|
|
@@ -138,12 +141,12 @@ function InputField({
|
|
|
138
141
|
type: isPasswordVisible ? 'text' : 'password',
|
|
139
142
|
autoComplete: autoCompleteId,
|
|
140
143
|
placeholder: label,
|
|
141
|
-
className: `w-full block py-3 pr-
|
|
144
|
+
className: `relative w-full block py-3 pr-10 pl-3 text-sm text-font-950 bg-base-0 border rounded-lg border-base-500/15 appearance-none focus:outline-none focus:ring-primary-500 placeholder-font-400 dark:text-font-0 dark:text-font-100 dark:bg-base-950 dark:placeholder-font-600 ${type === 'number' ? 'text-right' : ''}`,
|
|
142
145
|
...register,
|
|
143
146
|
}),
|
|
144
147
|
jsxRuntime.jsx('div', {
|
|
145
148
|
className:
|
|
146
|
-
'absolute top-1/2 right-2
|
|
149
|
+
'size-5 absolute top-1/2 right-2 -translate-y-1/2 text-font-400 transition-colors cursor-pointer hover:text-font-300 dark:text-font-600 dark:hover:text-font-500',
|
|
147
150
|
children: isPasswordVisible
|
|
148
151
|
? jsxRuntime.jsx(ForwardRef$5, {
|
|
149
152
|
onClick: () => {
|
|
@@ -164,17 +167,24 @@ function InputField({
|
|
|
164
167
|
type: type,
|
|
165
168
|
autoComplete: autoCompleteId,
|
|
166
169
|
placeholder: label,
|
|
167
|
-
className: `relative w-full block py-3 pr-10 pl-3 text-
|
|
170
|
+
className: `relative w-full block py-3 pr-10 pl-3 text-sm text-font-950 bg-base-0 border rounded-lg border-base-500/15 appearance-none focus:outline-none focus:ring-primary-500 placeholder-font-400 dark:text-font-0 dark:text-font-100 dark:bg-base-950 dark:placeholder-font-600 ${type === 'number' ? 'text-right' : ''}`,
|
|
168
171
|
...register,
|
|
169
172
|
}),
|
|
170
173
|
],
|
|
171
174
|
});
|
|
172
175
|
}
|
|
173
176
|
|
|
174
|
-
const SigninForm = ({
|
|
177
|
+
const SigninForm = ({
|
|
178
|
+
mapText,
|
|
179
|
+
onSubmit,
|
|
180
|
+
errorMessage,
|
|
181
|
+
hideLabels,
|
|
182
|
+
onForgotPassword,
|
|
183
|
+
}) => {
|
|
175
184
|
const { register, handleSubmit } = reactHookForm.useForm({
|
|
176
185
|
shouldUseNativeValidation: true,
|
|
177
186
|
});
|
|
187
|
+
const [email, setEmail] = React.useState('');
|
|
178
188
|
return jsxRuntime.jsxs('form', {
|
|
179
189
|
onSubmit: handleSubmit(onSubmit),
|
|
180
190
|
className: 'space-y-6',
|
|
@@ -183,38 +193,39 @@ const SigninForm = ({ mapText, onSubmit, errorMessage, onForgotPassword }) => {
|
|
|
183
193
|
id: 'email',
|
|
184
194
|
label: mapText('auth:form.email.label'),
|
|
185
195
|
type: 'text',
|
|
196
|
+
hideLabel: hideLabels,
|
|
186
197
|
required: true,
|
|
187
198
|
autoCompleteId: 'email',
|
|
188
199
|
register: register('email', {
|
|
189
200
|
required: mapText('form.email.validations.required'),
|
|
201
|
+
onChange: (e) => setEmail(e.target.value),
|
|
190
202
|
}),
|
|
191
203
|
}),
|
|
192
|
-
jsxRuntime.jsx(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
required: mapText('form.password.validations.required'),
|
|
202
|
-
}),
|
|
203
|
-
isPasswordField: true,
|
|
204
|
+
jsxRuntime.jsx(InputField, {
|
|
205
|
+
id: 'password',
|
|
206
|
+
label: mapText('auth:form.password.label'),
|
|
207
|
+
type: 'password',
|
|
208
|
+
hideLabel: hideLabels,
|
|
209
|
+
required: true,
|
|
210
|
+
autoCompleteId: 'password',
|
|
211
|
+
register: register('password', {
|
|
212
|
+
required: mapText('form.password.validations.required'),
|
|
204
213
|
}),
|
|
214
|
+
isPasswordField: true,
|
|
205
215
|
}),
|
|
206
216
|
jsxRuntime.jsxs('div', {
|
|
207
217
|
children: [
|
|
208
|
-
jsxRuntime.jsx('
|
|
218
|
+
jsxRuntime.jsx('input', {
|
|
209
219
|
type: 'submit',
|
|
220
|
+
value: mapText('auth:form.submit.text'),
|
|
210
221
|
className:
|
|
211
|
-
'w-full flex justify-center px-4 py-3 text-sm
|
|
212
|
-
children: mapText('auth:form.submit.text'),
|
|
213
|
-
}),
|
|
214
|
-
jsxRuntime.jsx('span', {
|
|
215
|
-
className: 'block mt-2 text-sm font-medium text-red-500',
|
|
216
|
-
children: errorMessage,
|
|
222
|
+
'w-full flex justify-center px-4 py-3 text-sm text-white bg-[length:200%_200%] bg-primary-shimmer border-none border rounded-lg shadow-sm transition-transform animate-shimmerdelayed cursor-pointer hover:scale-105 focus:outline-none focus:ring-1 focus:ring-base-600/20 focus:ring-offset-0 dark:focus:ring-base-500',
|
|
217
223
|
}),
|
|
224
|
+
errorMessage &&
|
|
225
|
+
jsxRuntime.jsx('span', {
|
|
226
|
+
className: 'block mt-2.5 text-sm text-red-600',
|
|
227
|
+
children: errorMessage,
|
|
228
|
+
}),
|
|
218
229
|
],
|
|
219
230
|
}),
|
|
220
231
|
jsxRuntime.jsx('div', {
|
|
@@ -224,9 +235,7 @@ const SigninForm = ({ mapText, onSubmit, errorMessage, onForgotPassword }) => {
|
|
|
224
235
|
children: jsxRuntime.jsx('button', {
|
|
225
236
|
type: 'button',
|
|
226
237
|
onClick: () => {
|
|
227
|
-
if (onForgotPassword)
|
|
228
|
-
onForgotPassword();
|
|
229
|
-
}
|
|
238
|
+
if (onForgotPassword) onForgotPassword(email);
|
|
230
239
|
},
|
|
231
240
|
className:
|
|
232
241
|
'font-medium text-primary transition-colors hover:text-primary-500 dark:text-white',
|
|
@@ -238,42 +247,45 @@ const SigninForm = ({ mapText, onSubmit, errorMessage, onForgotPassword }) => {
|
|
|
238
247
|
});
|
|
239
248
|
};
|
|
240
249
|
|
|
241
|
-
function SigninLayout({
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
+
function SigninLayout({
|
|
251
|
+
mapText,
|
|
252
|
+
onSubmit,
|
|
253
|
+
errorMessage,
|
|
254
|
+
logoSrc,
|
|
255
|
+
hideLabels,
|
|
256
|
+
onForgotPassword,
|
|
257
|
+
}) {
|
|
258
|
+
return jsxRuntime.jsx('div', {
|
|
259
|
+
className:
|
|
260
|
+
'sign-in-layout-container size-full z-10 relative flex justify-end items-center p-5 sm:p-10',
|
|
261
|
+
children: jsxRuntime.jsx('div', {
|
|
262
|
+
className: 'w-full flex flex-row justify-center items-stretch max-w-xl',
|
|
263
|
+
children: jsxRuntime.jsxs('div', {
|
|
250
264
|
className:
|
|
251
|
-
'
|
|
252
|
-
children:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
children: [
|
|
258
|
-
jsxRuntime.jsx('h2', {
|
|
259
|
-
className:
|
|
260
|
-
'mt-6 text-3xl font-extrabold text-gray-900 select-none dark:text-white',
|
|
261
|
-
children: mapText('auth:page.title'),
|
|
262
|
-
}),
|
|
263
|
-
jsxRuntime.jsx('div', {
|
|
264
|
-
className: 'mt-10',
|
|
265
|
-
children: jsxRuntime.jsx(SigninForm, {
|
|
266
|
-
mapText: mapText,
|
|
267
|
-
onSubmit: (values) => onSubmit(values.email, values.password),
|
|
268
|
-
errorMessage: errorMessage,
|
|
269
|
-
onForgotPassword: onForgotPassword,
|
|
270
|
-
}),
|
|
271
|
-
}),
|
|
272
|
-
],
|
|
265
|
+
'sign-in-dialog w-full p-5 bg-base-0/70 rounded-lg sm:p-10 dark:bg-base-950/70',
|
|
266
|
+
children: [
|
|
267
|
+
jsxRuntime.jsx('img', {
|
|
268
|
+
className: 'w-auto h-10 mb-20 object-cover',
|
|
269
|
+
src: logoSrc,
|
|
270
|
+
alt: '',
|
|
273
271
|
}),
|
|
274
|
-
|
|
272
|
+
jsxRuntime.jsx('h2', {
|
|
273
|
+
className: '',
|
|
274
|
+
children: mapText('auth:form.submit.text'),
|
|
275
|
+
}),
|
|
276
|
+
jsxRuntime.jsx('div', {
|
|
277
|
+
className: 'mt-5',
|
|
278
|
+
children: jsxRuntime.jsx(SigninForm, {
|
|
279
|
+
mapText: mapText,
|
|
280
|
+
onSubmit: (values) => onSubmit(values.email, values.password),
|
|
281
|
+
errorMessage: errorMessage,
|
|
282
|
+
hideLabels: hideLabels,
|
|
283
|
+
onForgotPassword: onForgotPassword,
|
|
284
|
+
}),
|
|
285
|
+
}),
|
|
286
|
+
],
|
|
275
287
|
}),
|
|
276
|
-
|
|
288
|
+
}),
|
|
277
289
|
});
|
|
278
290
|
}
|
|
279
291
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ declare module "@native-systems/ui" {
|
|
|
2
2
|
type InputFieldProps = {
|
|
3
3
|
id: string;
|
|
4
4
|
label: string;
|
|
5
|
+
hideLabel?: boolean;
|
|
5
6
|
register: any;
|
|
6
7
|
type: string;
|
|
7
8
|
required: boolean;
|
|
8
9
|
autoCompleteId?: string;
|
|
9
10
|
isPasswordField?: boolean;
|
|
10
11
|
};
|
|
11
|
-
export function InputField({ id, label, register, type, required, autoCompleteId, isPasswordField, }: InputFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export function InputField({ id, label, hideLabel, register, type, required, autoCompleteId, isPasswordField, }: InputFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
declare module "@native-systems/ui" {
|
|
@@ -20,9 +21,10 @@ declare module "@native-systems/ui" {
|
|
|
20
21
|
mapText: (key: string) => string;
|
|
21
22
|
onSubmit: (values: any) => void;
|
|
22
23
|
errorMessage: string | null;
|
|
23
|
-
|
|
24
|
+
hideLabels?: boolean;
|
|
25
|
+
onForgotPassword?: (email: string) => void;
|
|
24
26
|
};
|
|
25
|
-
export const SigninForm: ({ mapText, onSubmit, errorMessage, onForgotPassword }: ISigninFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export const SigninForm: ({ mapText, onSubmit, errorMessage, hideLabels, onForgotPassword }: ISigninFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
declare module "@native-systems/ui" {
|
|
@@ -34,9 +36,11 @@ declare module "@native-systems/ui" {
|
|
|
34
36
|
mapText: (key: string) => string;
|
|
35
37
|
onSubmit: (email: string, password: string) => void;
|
|
36
38
|
errorMessage: string | null;
|
|
37
|
-
|
|
39
|
+
logoSrc?: string;
|
|
40
|
+
hideLabels?: boolean;
|
|
41
|
+
onForgotPassword?: (email: string) => void;
|
|
38
42
|
}
|
|
39
|
-
export function SigninLayout({ mapText, onSubmit, errorMessage, onForgotPassword, }: SigninLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export function SigninLayout({ mapText, onSubmit, errorMessage, logoSrc, hideLabels, onForgotPassword, }: SigninLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
declare module "@native-systems/ui" {
|
|
@@ -147,11 +151,12 @@ declare module "@native-systems/ui" {
|
|
|
147
151
|
SaveButton: typeof Util.SaveButton;
|
|
148
152
|
Textarea: typeof Util.Textarea;
|
|
149
153
|
SigninLayout: typeof UI.SigninLayout;
|
|
150
|
-
SigninForm: ({ mapText, onSubmit, errorMessage, onForgotPassword }: {
|
|
154
|
+
SigninForm: ({ mapText, onSubmit, errorMessage, hideLabels, onForgotPassword }: {
|
|
151
155
|
mapText: (key: string) => string;
|
|
152
156
|
onSubmit: (values: any) => void;
|
|
153
157
|
errorMessage: string | null;
|
|
154
|
-
|
|
158
|
+
hideLabels?: boolean;
|
|
159
|
+
onForgotPassword?: (email: string) => void;
|
|
155
160
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
156
161
|
};
|
|
157
162
|
export default _default;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["src/components/util/views/Input.tsx","src/components/auth/widgets/SigninForm.tsx","src/components/auth/layout/SigninLayout.tsx","src/components/util/layout/MainContentFrame.tsx","src/components/util/widgets/Pagination.tsx","src/components/util/views/CancelButton.tsx","src/components/util/views/ErrorDisplay.tsx","src/components/util/views/HowToCloseText.tsx","src/components/util/views/LoadingSpinner.tsx","src/components/util/views/SaveButton.tsx","src/components/util/views/Textarea.tsx","src/context/TemplateParserContext.tsx","src/index.ts"],"names":[],"mappings":";IAIA,KAAK,eAAe,GAAG;QACrB,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,GAAG,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,OAAO,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IAEF,MAAM,UAAU,UAAU,CAAC,EACzB,EAAE,EACF,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,cAAsB,EACtB,eAAuB,GACxB,EAAE,eAAe,GAAA,OAAA,mBAAA,EAAA,GAAA,CAAA,OAAA,CAuDjB;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["src/components/util/views/Input.tsx","src/components/auth/widgets/SigninForm.tsx","src/components/auth/layout/SigninLayout.tsx","src/components/util/layout/MainContentFrame.tsx","src/components/util/widgets/Pagination.tsx","src/components/util/views/CancelButton.tsx","src/components/util/views/ErrorDisplay.tsx","src/components/util/views/HowToCloseText.tsx","src/components/util/views/LoadingSpinner.tsx","src/components/util/views/SaveButton.tsx","src/components/util/views/Textarea.tsx","src/context/TemplateParserContext.tsx","src/index.ts"],"names":[],"mappings":";IAIA,KAAK,eAAe,GAAG;QACrB,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,QAAQ,EAAE,GAAG,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,OAAO,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IAEF,MAAM,UAAU,UAAU,CAAC,EACzB,EAAE,EACF,KAAK,EACL,SAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,cAAsB,EACtB,eAAuB,GACxB,EAAE,eAAe,GAAA,OAAA,mBAAA,EAAA,GAAA,CAAA,OAAA,CAuDjB;;;;;;;;ICtED,KAAK,gBAAgB,GAAG;QACtB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;QACjC,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,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AAA,OA+CxE,CAAC;IAEF,MAAM,CAAC,MAAM,iBAAiB,EAAA,MAAA,0BAQ7B,CAAC;;;;IC/EF,OAAO,KAAK,EAAE,2BAA0B;IACxC,OAAO,KAAK,IAAI,2BAA0B;IAC1C,OAAO,KAAK,GAAG,2BAAkB;;;;;;;;;;;;;;;;;;;;;;;;;IAEjC,eAAA,QAAA,CAIE","file":"index.d.ts","sourceRoot":".."}
|
package/dist/index.esm.js
CHANGED
|
@@ -89,6 +89,7 @@ const ForwardRef$4 = /*#__PURE__*/ React.forwardRef(EyeIcon);
|
|
|
89
89
|
function InputField({
|
|
90
90
|
id,
|
|
91
91
|
label,
|
|
92
|
+
hideLabel = false,
|
|
92
93
|
register,
|
|
93
94
|
type,
|
|
94
95
|
required,
|
|
@@ -99,12 +100,14 @@ function InputField({
|
|
|
99
100
|
return jsxs('div', {
|
|
100
101
|
className: 'flex flex-col space-y-2',
|
|
101
102
|
children: [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
!hideLabel
|
|
104
|
+
? jsx('label', {
|
|
105
|
+
htmlFor: id,
|
|
106
|
+
className:
|
|
107
|
+
'block ml-1 text-sm font-medium text-gray-700 dark:text-white',
|
|
108
|
+
children: label,
|
|
109
|
+
})
|
|
110
|
+
: null,
|
|
108
111
|
isPasswordField
|
|
109
112
|
? jsxs('div', {
|
|
110
113
|
className: 'relative w-full',
|
|
@@ -115,12 +118,12 @@ function InputField({
|
|
|
115
118
|
type: isPasswordVisible ? 'text' : 'password',
|
|
116
119
|
autoComplete: autoCompleteId,
|
|
117
120
|
placeholder: label,
|
|
118
|
-
className: `w-full block py-3 pr-
|
|
121
|
+
className: `relative w-full block py-3 pr-10 pl-3 text-sm text-font-950 bg-base-0 border rounded-lg border-base-500/15 appearance-none focus:outline-none focus:ring-primary-500 placeholder-font-400 dark:text-font-0 dark:text-font-100 dark:bg-base-950 dark:placeholder-font-600 ${type === 'number' ? 'text-right' : ''}`,
|
|
119
122
|
...register,
|
|
120
123
|
}),
|
|
121
124
|
jsx('div', {
|
|
122
125
|
className:
|
|
123
|
-
'absolute top-1/2 right-2
|
|
126
|
+
'size-5 absolute top-1/2 right-2 -translate-y-1/2 text-font-400 transition-colors cursor-pointer hover:text-font-300 dark:text-font-600 dark:hover:text-font-500',
|
|
124
127
|
children: isPasswordVisible
|
|
125
128
|
? jsx(ForwardRef$5, {
|
|
126
129
|
onClick: () => {
|
|
@@ -141,17 +144,24 @@ function InputField({
|
|
|
141
144
|
type: type,
|
|
142
145
|
autoComplete: autoCompleteId,
|
|
143
146
|
placeholder: label,
|
|
144
|
-
className: `relative w-full block py-3 pr-10 pl-3 text-
|
|
147
|
+
className: `relative w-full block py-3 pr-10 pl-3 text-sm text-font-950 bg-base-0 border rounded-lg border-base-500/15 appearance-none focus:outline-none focus:ring-primary-500 placeholder-font-400 dark:text-font-0 dark:text-font-100 dark:bg-base-950 dark:placeholder-font-600 ${type === 'number' ? 'text-right' : ''}`,
|
|
145
148
|
...register,
|
|
146
149
|
}),
|
|
147
150
|
],
|
|
148
151
|
});
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
const SigninForm = ({
|
|
154
|
+
const SigninForm = ({
|
|
155
|
+
mapText,
|
|
156
|
+
onSubmit,
|
|
157
|
+
errorMessage,
|
|
158
|
+
hideLabels,
|
|
159
|
+
onForgotPassword,
|
|
160
|
+
}) => {
|
|
152
161
|
const { register, handleSubmit } = useForm({
|
|
153
162
|
shouldUseNativeValidation: true,
|
|
154
163
|
});
|
|
164
|
+
const [email, setEmail] = useState('');
|
|
155
165
|
return jsxs('form', {
|
|
156
166
|
onSubmit: handleSubmit(onSubmit),
|
|
157
167
|
className: 'space-y-6',
|
|
@@ -160,38 +170,39 @@ const SigninForm = ({ mapText, onSubmit, errorMessage, onForgotPassword }) => {
|
|
|
160
170
|
id: 'email',
|
|
161
171
|
label: mapText('auth:form.email.label'),
|
|
162
172
|
type: 'text',
|
|
173
|
+
hideLabel: hideLabels,
|
|
163
174
|
required: true,
|
|
164
175
|
autoCompleteId: 'email',
|
|
165
176
|
register: register('email', {
|
|
166
177
|
required: mapText('form.email.validations.required'),
|
|
178
|
+
onChange: (e) => setEmail(e.target.value),
|
|
167
179
|
}),
|
|
168
180
|
}),
|
|
169
|
-
jsx(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
required: mapText('form.password.validations.required'),
|
|
179
|
-
}),
|
|
180
|
-
isPasswordField: true,
|
|
181
|
+
jsx(InputField, {
|
|
182
|
+
id: 'password',
|
|
183
|
+
label: mapText('auth:form.password.label'),
|
|
184
|
+
type: 'password',
|
|
185
|
+
hideLabel: hideLabels,
|
|
186
|
+
required: true,
|
|
187
|
+
autoCompleteId: 'password',
|
|
188
|
+
register: register('password', {
|
|
189
|
+
required: mapText('form.password.validations.required'),
|
|
181
190
|
}),
|
|
191
|
+
isPasswordField: true,
|
|
182
192
|
}),
|
|
183
193
|
jsxs('div', {
|
|
184
194
|
children: [
|
|
185
|
-
jsx('
|
|
195
|
+
jsx('input', {
|
|
186
196
|
type: 'submit',
|
|
197
|
+
value: mapText('auth:form.submit.text'),
|
|
187
198
|
className:
|
|
188
|
-
'w-full flex justify-center px-4 py-3 text-sm
|
|
189
|
-
children: mapText('auth:form.submit.text'),
|
|
190
|
-
}),
|
|
191
|
-
jsx('span', {
|
|
192
|
-
className: 'block mt-2 text-sm font-medium text-red-500',
|
|
193
|
-
children: errorMessage,
|
|
199
|
+
'w-full flex justify-center px-4 py-3 text-sm text-white bg-[length:200%_200%] bg-primary-shimmer border-none border rounded-lg shadow-sm transition-transform animate-shimmerdelayed cursor-pointer hover:scale-105 focus:outline-none focus:ring-1 focus:ring-base-600/20 focus:ring-offset-0 dark:focus:ring-base-500',
|
|
194
200
|
}),
|
|
201
|
+
errorMessage &&
|
|
202
|
+
jsx('span', {
|
|
203
|
+
className: 'block mt-2.5 text-sm text-red-600',
|
|
204
|
+
children: errorMessage,
|
|
205
|
+
}),
|
|
195
206
|
],
|
|
196
207
|
}),
|
|
197
208
|
jsx('div', {
|
|
@@ -201,9 +212,7 @@ const SigninForm = ({ mapText, onSubmit, errorMessage, onForgotPassword }) => {
|
|
|
201
212
|
children: jsx('button', {
|
|
202
213
|
type: 'button',
|
|
203
214
|
onClick: () => {
|
|
204
|
-
if (onForgotPassword)
|
|
205
|
-
onForgotPassword();
|
|
206
|
-
}
|
|
215
|
+
if (onForgotPassword) onForgotPassword(email);
|
|
207
216
|
},
|
|
208
217
|
className:
|
|
209
218
|
'font-medium text-primary transition-colors hover:text-primary-500 dark:text-white',
|
|
@@ -215,42 +224,45 @@ const SigninForm = ({ mapText, onSubmit, errorMessage, onForgotPassword }) => {
|
|
|
215
224
|
});
|
|
216
225
|
};
|
|
217
226
|
|
|
218
|
-
function SigninLayout({
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
+
function SigninLayout({
|
|
228
|
+
mapText,
|
|
229
|
+
onSubmit,
|
|
230
|
+
errorMessage,
|
|
231
|
+
logoSrc,
|
|
232
|
+
hideLabels,
|
|
233
|
+
onForgotPassword,
|
|
234
|
+
}) {
|
|
235
|
+
return jsx('div', {
|
|
236
|
+
className:
|
|
237
|
+
'sign-in-layout-container size-full z-10 relative flex justify-end items-center p-5 sm:p-10',
|
|
238
|
+
children: jsx('div', {
|
|
239
|
+
className: 'w-full flex flex-row justify-center items-stretch max-w-xl',
|
|
240
|
+
children: jsxs('div', {
|
|
227
241
|
className:
|
|
228
|
-
'
|
|
229
|
-
children:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
children: [
|
|
235
|
-
jsx('h2', {
|
|
236
|
-
className:
|
|
237
|
-
'mt-6 text-3xl font-extrabold text-gray-900 select-none dark:text-white',
|
|
238
|
-
children: mapText('auth:page.title'),
|
|
239
|
-
}),
|
|
240
|
-
jsx('div', {
|
|
241
|
-
className: 'mt-10',
|
|
242
|
-
children: jsx(SigninForm, {
|
|
243
|
-
mapText: mapText,
|
|
244
|
-
onSubmit: (values) => onSubmit(values.email, values.password),
|
|
245
|
-
errorMessage: errorMessage,
|
|
246
|
-
onForgotPassword: onForgotPassword,
|
|
247
|
-
}),
|
|
248
|
-
}),
|
|
249
|
-
],
|
|
242
|
+
'sign-in-dialog w-full p-5 bg-base-0/70 rounded-lg sm:p-10 dark:bg-base-950/70',
|
|
243
|
+
children: [
|
|
244
|
+
jsx('img', {
|
|
245
|
+
className: 'w-auto h-10 mb-20 object-cover',
|
|
246
|
+
src: logoSrc,
|
|
247
|
+
alt: '',
|
|
250
248
|
}),
|
|
251
|
-
|
|
249
|
+
jsx('h2', {
|
|
250
|
+
className: '',
|
|
251
|
+
children: mapText('auth:form.submit.text'),
|
|
252
|
+
}),
|
|
253
|
+
jsx('div', {
|
|
254
|
+
className: 'mt-5',
|
|
255
|
+
children: jsx(SigninForm, {
|
|
256
|
+
mapText: mapText,
|
|
257
|
+
onSubmit: (values) => onSubmit(values.email, values.password),
|
|
258
|
+
errorMessage: errorMessage,
|
|
259
|
+
hideLabels: hideLabels,
|
|
260
|
+
onForgotPassword: onForgotPassword,
|
|
261
|
+
}),
|
|
262
|
+
}),
|
|
263
|
+
],
|
|
252
264
|
}),
|
|
253
|
-
|
|
265
|
+
}),
|
|
254
266
|
});
|
|
255
267
|
}
|
|
256
268
|
|