@sikka/hawa 0.0.89 → 0.0.91

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -3,7 +3,8 @@ import {
3
3
  HawaTextField,
4
4
  HawaLogoButton,
5
5
  HawaAlert,
6
- HawaButton
6
+ HawaButton,
7
+ HawaPhoneInput
7
8
  } from "../../elements";
8
9
  import { Controller, useForm } from "react-hook-form";
9
10
  import PropTypes from "prop-types";
@@ -51,7 +52,7 @@ export const SignInForm = (props) => {
51
52
  }
52
53
  }}
53
54
  />
54
- ) : (
55
+ ) : props.signInType === "username" ? (
55
56
  <Controller
56
57
  control={control}
57
58
  name="username"
@@ -70,6 +71,13 @@ export const SignInForm = (props) => {
70
71
  required: props.texts.usernameRequired
71
72
  }}
72
73
  />
74
+ ) : (
75
+ <Controller
76
+ control={control}
77
+ name="phone"
78
+ render={({ field }) => <HawaPhoneInput label="Phone number" />}
79
+ rules={{ required: props.texts.passwordRequiredText }}
80
+ />
73
81
  )}
74
82
  <Controller
75
83
  control={control}
@@ -96,7 +104,12 @@ export const SignInForm = (props) => {
96
104
  {props.texts.forgotPasswordText}
97
105
  </div>
98
106
  )}
99
- <HawaButton fullWidth type="submit" text={props.texts.signInText} />{" "}
107
+ <HawaButton
108
+ fullWidth
109
+ isLoading={props.isLoading}
110
+ type="submit"
111
+ text={props.texts.signInText}
112
+ />{" "}
100
113
  {!props.withoutSignUp && (
101
114
  <div className="dark:text-gray-300 font-semibold p-3 text-center text-sm">
102
115
  {props.texts.newUserText}{" "}
@@ -19,7 +19,7 @@ const Option = ({
19
19
  </div>
20
20
  );
21
21
 
22
- export const HawaPhoneInput = ({ preferredCountry }) => {
22
+ export const HawaPhoneInput = ({ preferredCountry, label }) => {
23
23
  const [code, setCode] = useState(preferredCountry ?? "");
24
24
  const [selectedCountry, setSelectedCountry] = useState("+966");
25
25
  const [tel, setTel] = useState("");
@@ -43,65 +43,71 @@ export const HawaPhoneInput = ({ preferredCountry }) => {
43
43
 
44
44
  return (
45
45
  <div
46
- style={{
47
- display: "flex",
48
- flexDirection: "row",
49
- justifyContent: "center",
50
- alignItems: "center",
51
- height: "100%"
52
- }}
46
+ // style={{
47
+ // justifyContent: "center",
48
+ // alignItems: "center",
49
+ // height: "100%"
50
+ // }}
51
+ className="flex flex-col mb-3"
53
52
  >
54
- <Select
55
- styles={{
56
- input: (base) => ({
57
- ...base,
58
- fontSize: "0.875rem",
59
- "input:focus": {
60
- boxShadow: "none"
61
- },
62
- lineHeight: "1.25rem",
63
- padding: "0.37rem"
64
- }),
65
- singleValue: (base) => ({
66
- ...base,
67
- fontSize: "0.875rem",
68
- textAlign: "right"
69
- }),
70
- control: (base) => ({
71
- ...base,
72
- width: 64,
73
- borderRadius: "0.5rem",
74
- borderTopRightRadius: 0,
75
- borderBottomRightRadius: 0
76
- }),
77
- menu: (base) => ({
78
- ...base,
79
- width: 190,
80
- borderRadius: "0.5rem"
81
- })
82
- }}
83
- components={{
84
- Option,
85
- DropdownIndicator: () => null,
86
- IndicatorSeparator: () => null
87
- }}
88
- options={Countries}
89
- isCreatable={false}
90
- isMulti={false}
91
- isSearchable={true}
92
- isClearable={false}
93
- placeholder="+966"
94
- defaultValue={Countries[0]}
95
- onInputChange={() => console.log("changed to")}
96
- onChange={(newValue, action) => {
97
- console.log("test n", newValue);
98
- setSelectedCountry(newValue);
99
- }}
100
- />
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
- />
53
+ {label && (
54
+ <label className="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">
55
+ {label}
56
+ </label>
57
+ )}
58
+ <div className="flex flex-row">
59
+ <Select
60
+ styles={{
61
+ input: (base) => ({
62
+ ...base,
63
+ fontSize: "0.875rem",
64
+ "input:focus": {
65
+ boxShadow: "none"
66
+ },
67
+ lineHeight: "1.25rem",
68
+ padding: "0.37rem"
69
+ }),
70
+ singleValue: (base) => ({
71
+ ...base,
72
+ fontSize: "0.875rem",
73
+ textAlign: "right"
74
+ }),
75
+ control: (base) => ({
76
+ ...base,
77
+ width: 64,
78
+ borderRadius: "0.5rem",
79
+ borderTopRightRadius: 0,
80
+ borderBottomRightRadius: 0
81
+ }),
82
+ menu: (base) => ({
83
+ ...base,
84
+ width: 190,
85
+ borderRadius: "0.5rem"
86
+ })
87
+ }}
88
+ components={{
89
+ Option,
90
+ DropdownIndicator: () => null,
91
+ IndicatorSeparator: () => null
92
+ }}
93
+ options={Countries}
94
+ isCreatable={false}
95
+ isMulti={false}
96
+ isSearchable={true}
97
+ isClearable={false}
98
+ placeholder="+966"
99
+ defaultValue={Countries[0]}
100
+ onInputChange={() => console.log("changed to")}
101
+ onChange={(newValue, action) => {
102
+ console.log("test n", newValue);
103
+ setSelectedCountry(newValue);
104
+ }}
105
+ />
106
+ <input
107
+ type="number"
108
+ 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"
109
+ />
110
+ </div>
105
111
  </div>
106
112
  );
107
113
  };
package/src/styles.css CHANGED
@@ -685,15 +685,15 @@ video {
685
685
  .-mb-px {
686
686
  margin-bottom: -1px;
687
687
  }
688
+ .mb-3 {
689
+ margin-bottom: 0.75rem;
690
+ }
688
691
  .ml-1 {
689
692
  margin-left: 0.25rem;
690
693
  }
691
694
  .mt-2 {
692
695
  margin-top: 0.5rem;
693
696
  }
694
- .mb-3 {
695
- margin-bottom: 0.75rem;
696
- }
697
697
  .mt-5 {
698
698
  margin-top: 1.25rem;
699
699
  }
@@ -7,6 +7,24 @@ module.exports = {
7
7
  plex: ["IBM Plex Sans Arabic"]
8
8
  },
9
9
  extend: {
10
+ transitionProperty: {
11
+ height: "height"
12
+ },
13
+ keyframes: {
14
+ collapse: {
15
+ "0%,100%": { transform: "scaleY(0)" },
16
+ "10%": { transform: "scaleY(0)" },
17
+ "20%": { transform: "scaleY(0)" },
18
+ "30%": { transform: "scaleY(0)" },
19
+ "40%": { transform: "scaleY(0)" },
20
+ "50%": { transform: "scaleY(0)" },
21
+ "60%": { transform: "scaleY(0)" },
22
+ // "100%": { transform: "scaleY(1)" },
23
+ }
24
+ },
25
+ animation: {
26
+ collapsing: "collapse"
27
+ },
10
28
  colors: {
11
29
  primary: {
12
30
  200: "#C4DEFD",