@sikka/hawa 0.0.82 → 0.0.84
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/countries.js +52 -46
- package/dist/styles.css +216 -232
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/blocks/AuthForms/AppLanding.js +62 -0
- package/src/blocks/AuthForms/SignInForm.js +11 -9
- package/src/blocks/AuthForms/SignInPhone.js +1 -2
- package/src/blocks/AuthForms/SignUpForm.js +84 -19
- package/src/elements/Copyrights.js +0 -0
- package/src/elements/HawaButton.js +1 -1
- package/src/elements/HawaMenu.js +59 -0
- package/src/elements/HawaPhoneInput.js +24 -8
- package/src/elements/HawaSelect.js +171 -30
- package/src/elements/index.js +1 -0
- package/src/layout/HawaContainer.js +3 -7
- package/src/styles.css +216 -232
- package/src/tailwind.css +8 -0
- package/tailwind.config.js +15 -2
- package/src/elements/HawaPopMenu.js +0 -97
- package/src/elements/HawaSelectInput.js +0 -67
package/package.json
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
HawaTextField,
|
|
4
|
+
HawaLogoButton,
|
|
5
|
+
HawaAlert,
|
|
6
|
+
HawaButton
|
|
7
|
+
} from "../../elements";
|
|
8
|
+
import { Controller, useForm } from "react-hook-form";
|
|
9
|
+
import PropTypes from "prop-types";
|
|
10
|
+
import { HawaContainer } from "../../layout/HawaContainer";
|
|
11
|
+
|
|
12
|
+
export const AppLanding = (props) => {
|
|
13
|
+
const methods = useForm();
|
|
14
|
+
const {
|
|
15
|
+
formState: { errors },
|
|
16
|
+
handleSubmit,
|
|
17
|
+
control
|
|
18
|
+
} = methods;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<HawaContainer>
|
|
22
|
+
<HawaButton fullWidth text={"Sign In"} />
|
|
23
|
+
<HawaButton fullWidth text={"Sign Up"} />
|
|
24
|
+
<HawaButton fullWidth text={"عربي"} />
|
|
25
|
+
</HawaContainer>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
AppLanding.propTypes = {
|
|
29
|
+
/**
|
|
30
|
+
* An object of all the texts in the blocks
|
|
31
|
+
*/
|
|
32
|
+
texts: PropTypes.shape({
|
|
33
|
+
emailLabel: PropTypes.string,
|
|
34
|
+
emailPlaceholder: PropTypes.string,
|
|
35
|
+
emailRequiredText: PropTypes.string,
|
|
36
|
+
emailInvalidText: PropTypes.string,
|
|
37
|
+
usernameLabel: PropTypes.string,
|
|
38
|
+
usernamePlaceholder: PropTypes.string,
|
|
39
|
+
usernameRequired: PropTypes.string,
|
|
40
|
+
passwordLabel: PropTypes.string,
|
|
41
|
+
passwordPlaceholder: PropTypes.string,
|
|
42
|
+
passwordRequiredText: PropTypes.string,
|
|
43
|
+
forgotPasswordText: PropTypes.string,
|
|
44
|
+
newUserText: PropTypes.string,
|
|
45
|
+
signUpText: PropTypes.string,
|
|
46
|
+
signInText: PropTypes.string,
|
|
47
|
+
googleButtonLabel: PropTypes.string,
|
|
48
|
+
githubButtonLabel: PropTypes.string,
|
|
49
|
+
twitterButtonLabel: PropTypes.string
|
|
50
|
+
}),
|
|
51
|
+
viaGoogle: PropTypes.bool,
|
|
52
|
+
viaGithub: PropTypes.bool,
|
|
53
|
+
viaTwitter: PropTypes.bool,
|
|
54
|
+
handleSignIn: PropTypes.func,
|
|
55
|
+
handleRouteToSignUp: PropTypes.func,
|
|
56
|
+
handleGoogleSignIn: PropTypes.func,
|
|
57
|
+
handleGithubSignIn: PropTypes.func,
|
|
58
|
+
handleTwitterSignIn: PropTypes.func,
|
|
59
|
+
handleForgotPassword: PropTypes.func,
|
|
60
|
+
|
|
61
|
+
withoutSignUp: PropTypes.bool
|
|
62
|
+
};
|
|
@@ -88,19 +88,21 @@ export const SignInForm = (props) => {
|
|
|
88
88
|
)}
|
|
89
89
|
rules={{ required: props.texts.passwordRequiredText }}
|
|
90
90
|
/>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
{!props.withoutResetPassword && (
|
|
92
|
+
<div
|
|
93
|
+
className="dark:text-gray-300 text-xs cursor-pointer w-fit mb-3"
|
|
94
|
+
onClick={props.handleForgotPassword}
|
|
95
|
+
>
|
|
96
|
+
{props.texts.forgotPasswordText}
|
|
97
|
+
</div>
|
|
98
|
+
)}
|
|
97
99
|
<HawaButton fullWidth type="submit" text={props.texts.signInText} />{" "}
|
|
98
100
|
{!props.withoutSignUp && (
|
|
99
|
-
<div className="font-semibold p-3 text-center text-sm">
|
|
101
|
+
<div className="dark:text-gray-300 font-semibold p-3 text-center text-sm">
|
|
100
102
|
{props.texts.newUserText}{" "}
|
|
101
103
|
<span
|
|
102
104
|
onClick={props.handleRouteToSignUp}
|
|
103
|
-
className="text-blue-600 cursor-pointer"
|
|
105
|
+
className="dark:text-blue-400 text-blue-600 cursor-pointer"
|
|
104
106
|
>
|
|
105
107
|
{props.texts.signUpText}
|
|
106
108
|
</span>
|
|
@@ -146,7 +148,7 @@ SignInForm.propTypes = {
|
|
|
146
148
|
emailPlaceholder: PropTypes.string,
|
|
147
149
|
emailRequiredText: PropTypes.string,
|
|
148
150
|
emailInvalidText: PropTypes.string,
|
|
149
|
-
usernameLabel:PropTypes.string,
|
|
151
|
+
usernameLabel: PropTypes.string,
|
|
150
152
|
usernamePlaceholder: PropTypes.string,
|
|
151
153
|
usernameRequired: PropTypes.string,
|
|
152
154
|
passwordLabel: PropTypes.string,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { Controller, useForm } from "react-hook-form";
|
|
3
|
-
import { HawaButton } from "../../elements";
|
|
4
|
-
import HawaPhoneInput from "../../elements/HawaPhoneInput";
|
|
3
|
+
import { HawaButton, HawaPhoneInput } from "../../elements";
|
|
5
4
|
import { HawaContainer } from "../../layout";
|
|
6
5
|
|
|
7
6
|
export const SignInPhone = (props) => {
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
HawaLogoButton,
|
|
5
5
|
HawaAlert,
|
|
6
6
|
HawaButton,
|
|
7
|
-
HawaCheckbox
|
|
7
|
+
HawaCheckbox,
|
|
8
|
+
HawaSelect
|
|
8
9
|
} from "../../elements";
|
|
9
10
|
import PropTypes from "prop-types";
|
|
10
11
|
import { Controller, FormProvider, useForm } from "react-hook-form";
|
|
@@ -48,41 +49,79 @@ export const SignUpForm = (props) => {
|
|
|
48
49
|
required: props.texts.fullNameRequiredText
|
|
49
50
|
}}
|
|
50
51
|
/>
|
|
52
|
+
{props.signUpType === "email" ? (
|
|
53
|
+
<Controller
|
|
54
|
+
control={control}
|
|
55
|
+
name="email"
|
|
56
|
+
render={({ field }) => (
|
|
57
|
+
<HawaTextField
|
|
58
|
+
fullWidth
|
|
59
|
+
type="text"
|
|
60
|
+
value={field.value ?? ""}
|
|
61
|
+
label={props.texts.emailLabel}
|
|
62
|
+
helperText={errors.email?.message}
|
|
63
|
+
placeholder={props.texts.emailPlaceholder}
|
|
64
|
+
{...field}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
rules={{
|
|
68
|
+
required: props.texts.emailRequiredText,
|
|
69
|
+
pattern: {
|
|
70
|
+
value:
|
|
71
|
+
/^(([^<>()[\]\\.,;:\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,}))$/,
|
|
72
|
+
message: props.texts.emailInvalidText
|
|
73
|
+
}
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
) : (
|
|
77
|
+
<Controller
|
|
78
|
+
control={control}
|
|
79
|
+
name="username"
|
|
80
|
+
render={({ field }) => (
|
|
81
|
+
<HawaTextField
|
|
82
|
+
fullWidth
|
|
83
|
+
type="text"
|
|
84
|
+
value={field.value ?? ""}
|
|
85
|
+
label={props.texts.usernameLabel}
|
|
86
|
+
helperText={errors.username?.message}
|
|
87
|
+
placeholder={props.texts.usernamePlaceholder}
|
|
88
|
+
{...field}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
rules={{
|
|
92
|
+
required: props.texts.usernameRequired
|
|
93
|
+
}}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
51
96
|
<Controller
|
|
52
97
|
control={control}
|
|
53
|
-
name="
|
|
98
|
+
name="password"
|
|
54
99
|
render={({ field }) => (
|
|
55
100
|
<HawaTextField
|
|
56
101
|
fullWidth
|
|
57
|
-
type="
|
|
102
|
+
type="password"
|
|
103
|
+
defaultValue={field.value ?? ""}
|
|
58
104
|
value={field.value ?? ""}
|
|
59
|
-
label={props.texts.
|
|
60
|
-
|
|
61
|
-
|
|
105
|
+
label={props.texts.passwordLabel}
|
|
106
|
+
placeholder={props.texts.passwordPlaceholder}
|
|
107
|
+
helperText={errors.password?.message}
|
|
62
108
|
{...field}
|
|
63
109
|
/>
|
|
64
110
|
)}
|
|
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
|
-
}}
|
|
111
|
+
rules={{ required: props.texts.passwordRequiredText }}
|
|
73
112
|
/>
|
|
74
113
|
<Controller
|
|
75
114
|
control={control}
|
|
76
|
-
name="
|
|
115
|
+
name="confirm_password"
|
|
77
116
|
render={({ field }) => (
|
|
78
117
|
<HawaTextField
|
|
79
118
|
fullWidth
|
|
80
119
|
type="password"
|
|
81
120
|
defaultValue={field.value ?? ""}
|
|
82
121
|
value={field.value ?? ""}
|
|
83
|
-
label={props.texts.
|
|
84
|
-
placeholder={props.texts.
|
|
85
|
-
helperText={errors.
|
|
122
|
+
label={props.texts.confirmPasswordLabel}
|
|
123
|
+
placeholder={props.texts.confirmPasswordPlaceholder}
|
|
124
|
+
helperText={errors.confirm_password?.message}
|
|
86
125
|
{...field}
|
|
87
126
|
/>
|
|
88
127
|
)}
|
|
@@ -107,6 +146,24 @@ export const SignUpForm = (props) => {
|
|
|
107
146
|
rules={{ required: props.texts.passwordRequiredText }}
|
|
108
147
|
/>
|
|
109
148
|
)}
|
|
149
|
+
{props.showUserSource && (
|
|
150
|
+
<div className="py-2">
|
|
151
|
+
<HawaSelect
|
|
152
|
+
label="How did you learn about us?"
|
|
153
|
+
isCreatable={false}
|
|
154
|
+
isMulti={false ?? false}
|
|
155
|
+
isSearchable={false}
|
|
156
|
+
isClearable={false ?? false}
|
|
157
|
+
options={[
|
|
158
|
+
{ value: "chocolate", label: "Chocolate" },
|
|
159
|
+
{ value: "strawberry", label: "Strawberry" },
|
|
160
|
+
{ value: "vanilla", label: "Vanilla" }
|
|
161
|
+
]}
|
|
162
|
+
onChange={(e, o) => console.log("chooo", e)}
|
|
163
|
+
onInputChange={(e, o) => console.log("changing", e)}
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
)}
|
|
110
167
|
{props.showTermsOption && (
|
|
111
168
|
<div className="py-2">
|
|
112
169
|
<HawaCheckbox
|
|
@@ -121,7 +178,7 @@ export const SignUpForm = (props) => {
|
|
|
121
178
|
/>
|
|
122
179
|
</div>
|
|
123
180
|
)}
|
|
124
|
-
{props.
|
|
181
|
+
{props.showNewsletterOption && (
|
|
125
182
|
<div className="py-2">
|
|
126
183
|
<HawaCheckbox label="Subscribe to newsletter?" />
|
|
127
184
|
</div>
|
|
@@ -180,10 +237,15 @@ SignUpForm.propTypes = {
|
|
|
180
237
|
emailPlaceholder: PropTypes.string,
|
|
181
238
|
emailRequiredText: PropTypes.string,
|
|
182
239
|
emailInvalidText: PropTypes.string,
|
|
240
|
+
usernameLabel: PropTypes.string,
|
|
241
|
+
usernamePlaceholder: PropTypes.string,
|
|
242
|
+
usernameRequired: PropTypes.string,
|
|
183
243
|
passwordLabel: PropTypes.string,
|
|
184
244
|
passwordPlaceholder: PropTypes.string,
|
|
185
245
|
passwordRequiredText: PropTypes.string,
|
|
186
246
|
passwordTooShortText: PropTypes.string,
|
|
247
|
+
confirmPasswordLabel: PropTypes.string,
|
|
248
|
+
confirmPasswordPlaceholder: PropTypes.string,
|
|
187
249
|
forgotPasswordText: PropTypes.string,
|
|
188
250
|
newUserText: PropTypes.string,
|
|
189
251
|
signUpText: PropTypes.string,
|
|
@@ -196,6 +258,9 @@ SignUpForm.propTypes = {
|
|
|
196
258
|
viaGoogle: PropTypes.bool,
|
|
197
259
|
viaGithub: PropTypes.bool,
|
|
198
260
|
viaTwitter: PropTypes.bool,
|
|
261
|
+
showNewsletterOption: PropTypes.bool,
|
|
262
|
+
showRefCode: PropTypes.bool,
|
|
263
|
+
showTermsOption: PropTypes.bool,
|
|
199
264
|
handleSignUp: PropTypes.func,
|
|
200
265
|
handleRouteToSignIn: PropTypes.func,
|
|
201
266
|
handleGoogleSignUp: PropTypes.func,
|
|
File without changes
|
|
@@ -19,7 +19,7 @@ export const HawaButton = ({
|
|
|
19
19
|
} m-1 px-2.5 py-2.5 text-center text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800`;
|
|
20
20
|
if (props.fullWidth) {
|
|
21
21
|
styles =
|
|
22
|
-
"my-1 w-full flex justify-center text-white bg-
|
|
22
|
+
"my-1 w-full flex justify-center text-white bg-primary-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800";
|
|
23
23
|
}
|
|
24
24
|
if (iconOnly) {
|
|
25
25
|
iconStyle = "flex flex-col justify-center items-center";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
|
|
3
|
+
export const HawaMenu = ({
|
|
4
|
+
popMenuID,
|
|
5
|
+
menuItems,
|
|
6
|
+
withHeader,
|
|
7
|
+
withIcons,
|
|
8
|
+
headerTitle,
|
|
9
|
+
headerSubtitle
|
|
10
|
+
}) => {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
id={popMenuID}
|
|
14
|
+
className="z-10 w-44 bg-white rounded-lg divide-y divide-gray-100 shadow dark:bg-gray-700"
|
|
15
|
+
>
|
|
16
|
+
{withHeader && (
|
|
17
|
+
<div class="py-3 px-4 text-sm text-gray-900 dark:text-white">
|
|
18
|
+
<div>{headerTitle}</div>
|
|
19
|
+
<div class="font-medium truncate">{headerSubtitle}</div>
|
|
20
|
+
</div>
|
|
21
|
+
)}
|
|
22
|
+
{menuItems.map((group) => {
|
|
23
|
+
return (
|
|
24
|
+
<ul className="py-1 text-sm text-gray-700 dark:text-gray-200">
|
|
25
|
+
{group.map((item) => {
|
|
26
|
+
return (
|
|
27
|
+
<li
|
|
28
|
+
onClick={item.action}
|
|
29
|
+
className={
|
|
30
|
+
item.button
|
|
31
|
+
? "bg-primary-500 text-white hover:bg-primary-600 flex flex-row rtl:flex-row-reverse items-center cursor-pointer py-2 px-4 rounded-lg mx-1 hover:bg-gray-100 dark:hover:bg-primary-600 dark:hover:text-white"
|
|
32
|
+
: "flex flex-row rtl:flex-row-reverse items-center cursor-pointer py-2 px-4 rounded-lg mx-1 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
33
|
+
}
|
|
34
|
+
>
|
|
35
|
+
{withIcons && (
|
|
36
|
+
<div className="mr-2 rtl:ml-2">{item.icon}</div>
|
|
37
|
+
)}
|
|
38
|
+
{item.label}
|
|
39
|
+
</li>
|
|
40
|
+
);
|
|
41
|
+
})}
|
|
42
|
+
</ul>
|
|
43
|
+
);
|
|
44
|
+
})}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
HawaMenu.propTypes = {
|
|
50
|
+
anchor: PropTypes.any,
|
|
51
|
+
handleClose: PropTypes.func,
|
|
52
|
+
menuItems: PropTypes.arrayOf(
|
|
53
|
+
PropTypes.shape({
|
|
54
|
+
icon: PropTypes.element,
|
|
55
|
+
label: PropTypes.string,
|
|
56
|
+
action: PropTypes.func
|
|
57
|
+
})
|
|
58
|
+
)
|
|
59
|
+
};
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import Countries from "../../countries";
|
|
3
3
|
import Select from "react-select";
|
|
4
|
-
const Option = ({
|
|
4
|
+
const Option = ({
|
|
5
|
+
cx,
|
|
6
|
+
children,
|
|
7
|
+
getStyles,
|
|
8
|
+
innerProps,
|
|
9
|
+
innerRef,
|
|
10
|
+
...props
|
|
11
|
+
}) => (
|
|
5
12
|
<div
|
|
6
13
|
ref={innerRef}
|
|
7
14
|
className="m-2 p-1 px-3 rounded-lg flex flex-row items-center justify-between hover:bg-blue-200"
|
|
15
|
+
{...innerProps}
|
|
8
16
|
>
|
|
9
17
|
<img className="h-8 w-8" src={props.data.image}></img>
|
|
10
18
|
{children}
|
|
11
19
|
</div>
|
|
12
20
|
);
|
|
13
21
|
|
|
14
|
-
export
|
|
22
|
+
export const HawaPhoneInput = ({ preferredCountry }) => {
|
|
15
23
|
const [code, setCode] = useState(preferredCountry ?? "");
|
|
16
24
|
const [selectedCountry, setSelectedCountry] = useState("+966");
|
|
17
25
|
const [tel, setTel] = useState("");
|
|
@@ -54,9 +62,14 @@ export default function HawaPhoneInput({ preferredCountry }) {
|
|
|
54
62
|
lineHeight: "1.25rem",
|
|
55
63
|
padding: "0.37rem"
|
|
56
64
|
}),
|
|
65
|
+
singleValue: (base) => ({
|
|
66
|
+
...base,
|
|
67
|
+
fontSize: "0.875rem",
|
|
68
|
+
textAlign: "right"
|
|
69
|
+
}),
|
|
57
70
|
control: (base) => ({
|
|
58
71
|
...base,
|
|
59
|
-
width:
|
|
72
|
+
width: 64,
|
|
60
73
|
borderRadius: "0.75rem",
|
|
61
74
|
borderTopRightRadius: 0,
|
|
62
75
|
borderBottomRightRadius: 0
|
|
@@ -76,16 +89,19 @@ export default function HawaPhoneInput({ preferredCountry }) {
|
|
|
76
89
|
isCreatable={false}
|
|
77
90
|
isMulti={false}
|
|
78
91
|
isSearchable={true}
|
|
79
|
-
isClearable={
|
|
92
|
+
isClearable={false}
|
|
80
93
|
placeholder="+966"
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
defaultValue={Countries[0]}
|
|
95
|
+
onInputChange={() => console.log("changed to")}
|
|
83
96
|
onChange={(newValue, action) => {
|
|
84
97
|
console.log("test n", newValue);
|
|
85
98
|
setSelectedCountry(newValue);
|
|
86
99
|
}}
|
|
87
100
|
/>
|
|
88
|
-
<input
|
|
101
|
+
<input
|
|
102
|
+
type="number"
|
|
103
|
+
className="bg-gray-50 appearance-none border rounded-l-none border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 border-l-0"
|
|
104
|
+
/>
|
|
89
105
|
</div>
|
|
90
106
|
);
|
|
91
|
-
}
|
|
107
|
+
};
|
|
@@ -1,36 +1,177 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Select from "react-select";
|
|
2
|
+
import CreatableSelect from "react-select/creatable";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
const Option = ({
|
|
5
|
+
cx,
|
|
6
|
+
children,
|
|
7
|
+
getStyles,
|
|
8
|
+
innerProps,
|
|
9
|
+
innerRef,
|
|
10
|
+
...props
|
|
11
|
+
}) => (
|
|
12
|
+
<div
|
|
13
|
+
ref={innerRef}
|
|
14
|
+
className="m-2 p-1 px-3 rounded-lg flex flex-row items-center justify-between hover:bg-blue-200"
|
|
15
|
+
{...innerProps}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
12
20
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
const Control = ({
|
|
22
|
+
cx,
|
|
23
|
+
children,
|
|
24
|
+
getStyles,
|
|
25
|
+
innerProps,
|
|
26
|
+
innerRef,
|
|
27
|
+
...props
|
|
28
|
+
}) => {
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
ref={innerRef}
|
|
32
|
+
className="mb-2
|
|
33
|
+
flex
|
|
34
|
+
bg-gray-50 border
|
|
35
|
+
border-gray-300
|
|
36
|
+
text-gray-900
|
|
37
|
+
text-sm rounded-lg
|
|
38
|
+
h-11
|
|
39
|
+
focus:ring-blue-500
|
|
40
|
+
focus:border-blue-500
|
|
41
|
+
w-full
|
|
42
|
+
dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
|
43
|
+
{...innerProps}
|
|
44
|
+
// {...props}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
const Menu = ({ cx, children, getStyles, innerProps, innerRef, ...props }) => {
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
className="bg-white rounded-lg absolute w-full"
|
|
54
|
+
ref={innerRef}
|
|
55
|
+
{...innerProps}
|
|
56
|
+
// {...props}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
21
62
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
63
|
+
export const HawaSelect = (props) => {
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
{props.label && (
|
|
67
|
+
<label className="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">
|
|
68
|
+
{props.label}
|
|
69
|
+
</label>
|
|
70
|
+
)}
|
|
71
|
+
{!props.isCreatable && (
|
|
72
|
+
<Select
|
|
73
|
+
styles={
|
|
74
|
+
{
|
|
75
|
+
// input: (base) => ({
|
|
76
|
+
// ...base,
|
|
77
|
+
// "input:focus": {
|
|
78
|
+
// boxShadow: "none"
|
|
79
|
+
// }
|
|
80
|
+
// }),
|
|
81
|
+
// control: (base) => ({
|
|
82
|
+
// ...base,
|
|
83
|
+
// borderRadius: "0.75rem"
|
|
84
|
+
// }),
|
|
85
|
+
// menu: (base) => ({
|
|
86
|
+
// ...base,
|
|
87
|
+
// borderRadius: "0.75rem",
|
|
88
|
+
// padding: 0,
|
|
89
|
+
// display: "flex",
|
|
90
|
+
// justifyContent: "center"
|
|
91
|
+
// }),
|
|
92
|
+
// menuList: (base) => ({
|
|
93
|
+
// ...base,
|
|
94
|
+
// display: "flex",
|
|
95
|
+
// flexDirection: "column",
|
|
96
|
+
// justifyContent: "center",
|
|
97
|
+
// alignItems: "center",
|
|
98
|
+
// width: "100%"
|
|
99
|
+
// }),
|
|
100
|
+
// option: (base) => ({
|
|
101
|
+
// ...base,
|
|
102
|
+
// borderRadius: "0.75rem",
|
|
103
|
+
// margin: 3,
|
|
104
|
+
// width: "98%"
|
|
105
|
+
// }),
|
|
106
|
+
// multiValue: (base) => ({
|
|
107
|
+
// ...base,
|
|
108
|
+
// borderRadius: "0.4rem"
|
|
109
|
+
// })
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
options={props.options}
|
|
113
|
+
isClearable={props.isClearable}
|
|
114
|
+
isMulti={props.isMulti}
|
|
115
|
+
isSearchable={props.isSearchable}
|
|
116
|
+
onChange={(newValue, action) => props.onChange(newValue, action)}
|
|
117
|
+
components={{
|
|
118
|
+
Control,
|
|
119
|
+
Option,
|
|
120
|
+
Menu
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
)}
|
|
124
|
+
{props.isCreatable && (
|
|
125
|
+
<CreatableSelect
|
|
126
|
+
styles={{
|
|
127
|
+
input: (base) => ({
|
|
128
|
+
...base,
|
|
129
|
+
"input:focus": {
|
|
130
|
+
boxShadow: "none"
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
27
133
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
134
|
+
control: (base) => ({
|
|
135
|
+
...base,
|
|
136
|
+
borderRadius: "0.75rem"
|
|
137
|
+
}),
|
|
138
|
+
menu: (base) => ({
|
|
139
|
+
...base,
|
|
140
|
+
borderRadius: "0.75rem",
|
|
141
|
+
padding: 0,
|
|
142
|
+
display: "flex",
|
|
143
|
+
justifyContent: "center"
|
|
144
|
+
}),
|
|
145
|
+
menuList: (base) => ({
|
|
146
|
+
...base,
|
|
147
|
+
display: "flex",
|
|
148
|
+
flexDirection: "column",
|
|
149
|
+
justifyContent: "center",
|
|
150
|
+
alignItems: "center",
|
|
151
|
+
width: "100%"
|
|
152
|
+
}),
|
|
153
|
+
option: (base) => ({
|
|
154
|
+
...base,
|
|
155
|
+
borderRadius: "0.75rem",
|
|
156
|
+
margin: 3,
|
|
157
|
+
width: "98%"
|
|
158
|
+
})
|
|
159
|
+
}}
|
|
160
|
+
options={props.options}
|
|
161
|
+
isClearable={props.isClearable}
|
|
162
|
+
isMulti={props.isMulti}
|
|
163
|
+
isSearchable={props.isSearchable}
|
|
164
|
+
onCreateOption={() => console.log("im changing")}
|
|
165
|
+
onChange={(newValue, action) => {
|
|
166
|
+
console.log("this is onChange", newValue);
|
|
167
|
+
props.onChange(newValue, action);
|
|
168
|
+
}}
|
|
169
|
+
onInputChange={(newValue, action) => {
|
|
170
|
+
console.log("onInputChange====", newValue);
|
|
171
|
+
props.onInputChange(newValue, action);
|
|
172
|
+
}}
|
|
173
|
+
/>
|
|
174
|
+
)}
|
|
175
|
+
</>
|
|
35
176
|
);
|
|
36
177
|
};
|
package/src/elements/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
export const HawaContainer = (props) => {
|
|
4
|
-
let containerStyle =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"w-full max-w-sm flex flex-col divide-y divide-gray-300 bg-blue-300 rounded-xl p-4";
|
|
8
|
-
} else {
|
|
9
|
-
containerStyle = "w-full max-w-sm flex flex-col bg-blue-300 rounded-xl p-4";
|
|
10
|
-
}
|
|
4
|
+
let containerStyle =
|
|
5
|
+
"w-full max-w-sm flex flex-col bg-primary-300 dark:bg-gray-600 rounded-xl p-4";
|
|
6
|
+
|
|
11
7
|
return <div className={containerStyle}>{props.children}</div>;
|
|
12
8
|
};
|