@sikka/hawa 0.0.79 → 0.0.81
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/styles.css +0 -3
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/blocks/AuthForms/SignUpForm.js +116 -75
- package/src/elements/HawaCheckbox.js +1 -1
- package/src/elements/HawaRange.js +3 -2
- package/src/elements/HawaTabs.js +1 -1
- package/src/elements/HawaTooltip.js +12 -7
- package/src/styles.css +0 -3
package/package.json
CHANGED
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
HawaTextField,
|
|
4
4
|
HawaLogoButton,
|
|
5
5
|
HawaAlert,
|
|
6
|
-
HawaButton
|
|
6
|
+
HawaButton,
|
|
7
|
+
HawaCheckbox
|
|
7
8
|
} from "../../elements";
|
|
8
9
|
import PropTypes from "prop-types";
|
|
9
10
|
import { Controller, FormProvider, useForm } from "react-hook-form";
|
|
@@ -19,84 +20,124 @@ export const SignUpForm = (props) => {
|
|
|
19
20
|
|
|
20
21
|
return (
|
|
21
22
|
<HawaContainer withDividers>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
)}
|
|
29
|
-
<FormProvider {...methods}>
|
|
30
|
-
<form onSubmit={handleSubmit(props.handleSignUp)}>
|
|
31
|
-
<Controller
|
|
32
|
-
control={control}
|
|
33
|
-
name="fullName"
|
|
34
|
-
render={({ field }) => (
|
|
35
|
-
<HawaTextField
|
|
36
|
-
fullWidth
|
|
37
|
-
type="text"
|
|
38
|
-
value={field.value ?? ""}
|
|
39
|
-
label={props.texts.fullNameLabel}
|
|
40
|
-
placeholder={props.texts.fullNamePlaceholder}
|
|
41
|
-
helperText={errors.fullName?.message}
|
|
42
|
-
{...field}
|
|
43
|
-
/>
|
|
44
|
-
)}
|
|
45
|
-
rules={{
|
|
46
|
-
required: props.texts.fullNameRequiredText
|
|
47
|
-
}}
|
|
23
|
+
<div>
|
|
24
|
+
{props.showError && (
|
|
25
|
+
<HawaAlert
|
|
26
|
+
title={props.errorTitle}
|
|
27
|
+
text={props.errorText}
|
|
28
|
+
severity="error"
|
|
48
29
|
/>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
30
|
+
)}
|
|
31
|
+
<FormProvider {...methods}>
|
|
32
|
+
<form onSubmit={handleSubmit(props.handleSignUp)}>
|
|
33
|
+
<Controller
|
|
34
|
+
control={control}
|
|
35
|
+
name="fullName"
|
|
36
|
+
render={({ field }) => (
|
|
37
|
+
<HawaTextField
|
|
38
|
+
fullWidth
|
|
39
|
+
type="text"
|
|
40
|
+
value={field.value ?? ""}
|
|
41
|
+
label={props.texts.fullNameLabel}
|
|
42
|
+
placeholder={props.texts.fullNamePlaceholder}
|
|
43
|
+
helperText={errors.fullName?.message}
|
|
44
|
+
{...field}
|
|
45
|
+
/>
|
|
46
|
+
)}
|
|
47
|
+
rules={{
|
|
48
|
+
required: props.texts.fullNameRequiredText
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
<Controller
|
|
52
|
+
control={control}
|
|
53
|
+
name="email"
|
|
54
|
+
render={({ field }) => (
|
|
55
|
+
<HawaTextField
|
|
56
|
+
fullWidth
|
|
57
|
+
type="text"
|
|
58
|
+
value={field.value ?? ""}
|
|
59
|
+
label={props.texts.emailLabel}
|
|
60
|
+
helperText={errors.email?.message}
|
|
61
|
+
placeholder={props.texts.emailPlaceholder}
|
|
62
|
+
{...field}
|
|
63
|
+
/>
|
|
64
|
+
)}
|
|
65
|
+
rules={{
|
|
66
|
+
required: props.texts.emailRequiredText,
|
|
67
|
+
pattern: {
|
|
68
|
+
value:
|
|
69
|
+
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
70
|
+
message: props.texts.emailInvalidText
|
|
71
|
+
}
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
<Controller
|
|
75
|
+
control={control}
|
|
76
|
+
name="password"
|
|
77
|
+
render={({ field }) => (
|
|
78
|
+
<HawaTextField
|
|
79
|
+
fullWidth
|
|
80
|
+
type="password"
|
|
81
|
+
defaultValue={field.value ?? ""}
|
|
82
|
+
value={field.value ?? ""}
|
|
83
|
+
label={props.texts.passwordLabel}
|
|
84
|
+
placeholder={props.texts.passwordPlaceholder}
|
|
85
|
+
helperText={errors.password?.message}
|
|
86
|
+
{...field}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
89
|
+
rules={{ required: props.texts.passwordRequiredText }}
|
|
90
|
+
/>
|
|
91
|
+
{props.showRefCode && (
|
|
92
|
+
<Controller
|
|
93
|
+
control={control}
|
|
94
|
+
name="password"
|
|
95
|
+
render={({ field }) => (
|
|
96
|
+
<HawaTextField
|
|
97
|
+
fullWidth
|
|
98
|
+
type="text"
|
|
99
|
+
defaultValue={field.value ?? ""}
|
|
100
|
+
value={field.value ?? ""}
|
|
101
|
+
label={"Ref Code"}
|
|
102
|
+
placeholder={props.texts.passwordPlaceholder}
|
|
103
|
+
helperText={errors.password?.message}
|
|
104
|
+
{...field}
|
|
105
|
+
/>
|
|
106
|
+
)}
|
|
107
|
+
rules={{ required: props.texts.passwordRequiredText }}
|
|
61
108
|
/>
|
|
62
109
|
)}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<HawaTextField
|
|
77
|
-
fullWidth
|
|
78
|
-
type="password"
|
|
79
|
-
defaultValue={field.value ?? ""}
|
|
80
|
-
value={field.value ?? ""}
|
|
81
|
-
label={props.texts.passwordLabel}
|
|
82
|
-
placeholder={props.texts.passwordPlaceholder}
|
|
83
|
-
helperText={errors.password?.message}
|
|
84
|
-
{...field}
|
|
85
|
-
/>
|
|
110
|
+
{props.showTermsOption && (
|
|
111
|
+
<div className="py-2">
|
|
112
|
+
<HawaCheckbox
|
|
113
|
+
label={
|
|
114
|
+
<span>
|
|
115
|
+
I accept the{" "}
|
|
116
|
+
<a className="cursor-pointer text-blue-800">
|
|
117
|
+
terms and conditions
|
|
118
|
+
</a>
|
|
119
|
+
</span>
|
|
120
|
+
}
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
86
123
|
)}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
124
|
+
{props.showNewletterOption && (
|
|
125
|
+
<div className="py-2">
|
|
126
|
+
<HawaCheckbox label="Subscribe to newsletter?" />
|
|
127
|
+
</div>
|
|
128
|
+
)}
|
|
129
|
+
<HawaButton fullWidth type="submit" text={props.texts.signUpText} />{" "}
|
|
130
|
+
</form>
|
|
131
|
+
</FormProvider>
|
|
132
|
+
<div className="font-semibold p-3 text-center text-sm">
|
|
133
|
+
{props.texts.existingUserText}{" "}
|
|
134
|
+
<span
|
|
135
|
+
onClick={props.handleRouteToSignIn}
|
|
136
|
+
className="text-blue-600 cursor-pointer"
|
|
137
|
+
>
|
|
138
|
+
{props.texts.signInText}
|
|
139
|
+
</span>
|
|
140
|
+
</div>
|
|
100
141
|
</div>
|
|
101
142
|
{props.viaGithub || props.viaGoogle || props.viaTwitter ? (
|
|
102
143
|
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
@@ -6,7 +6,7 @@ export const HawaRange = (props) => {
|
|
|
6
6
|
<div>
|
|
7
7
|
{props.label && (
|
|
8
8
|
<label
|
|
9
|
-
|
|
9
|
+
htmlFor="default-range"
|
|
10
10
|
className="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
|
|
11
11
|
>
|
|
12
12
|
{props.label}
|
|
@@ -17,7 +17,8 @@ export const HawaRange = (props) => {
|
|
|
17
17
|
<input
|
|
18
18
|
id="default-range"
|
|
19
19
|
type="range"
|
|
20
|
-
value=
|
|
20
|
+
value={props.value}
|
|
21
|
+
onChange={props.handleChange}
|
|
21
22
|
className="w-fit h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
|
|
22
23
|
/>
|
|
23
24
|
<div className="ml-2">{props.endElement}</div>{" "}
|
package/src/elements/HawaTabs.js
CHANGED
|
@@ -11,7 +11,7 @@ export const HawaTabs = (props) => {
|
|
|
11
11
|
<div>
|
|
12
12
|
<ul className="bg-gray-100 w-fit rounded-lg flex flex-wrap text-sm font-medium text-center text-gray-500 dark:text-gray-400">
|
|
13
13
|
{props.options.map((opt) => (
|
|
14
|
-
<li
|
|
14
|
+
<li >
|
|
15
15
|
<button
|
|
16
16
|
aria-current="page"
|
|
17
17
|
onClick={() => {
|
|
@@ -2,13 +2,18 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
export const HawaTooltip = (props) => {
|
|
4
4
|
return (
|
|
5
|
-
<div
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
<div>
|
|
6
|
+
<div
|
|
7
|
+
id={props.tooltipID}
|
|
8
|
+
role="tooltip"
|
|
9
|
+
// className="inline-block absolute py-2 px-3"
|
|
10
|
+
className="inline-block opacity-0 absolute z-10 py-2 px-3 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm transition-opacity duration-300 tooltip dark:bg-gray-700"
|
|
11
|
+
>
|
|
12
|
+
{props.content}
|
|
13
|
+
<div className="tooltip-arrow" data-popper-arrow></div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div onMouseEnter={() => console.log("hovering")}>{props.children}</div>
|
|
12
17
|
</div>
|
|
13
18
|
);
|
|
14
19
|
};
|