@sikka/hawa 0.0.64 → 0.0.66
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 +1934 -0
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +7 -15
- package/src/elements/HawaPhoneInput.js +85 -53
- package/src/elements/HawaSelectInput.js +43 -6
- package/src/elements/HawaTextField.js +13 -4
- package/src/elements/index.js +0 -1
- package/src/styles.css +2 -2
- package/src/tailwind.css +19 -5
- package/storybook-static/0.1104ca18.iframe.bundle.js +3 -0
- package/storybook-static/{0.58b40425.iframe.bundle.js.LICENSE.txt → 0.1104ca18.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/0.1104ca18.iframe.bundle.js.map +1 -0
- package/storybook-static/0.cf71f8aa82edef0a7186.manager.bundle.js +2 -0
- package/storybook-static/{10.265ea9add491253ee249.manager.bundle.js.LICENSE.txt → 0.cf71f8aa82edef0a7186.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/1.7e6ec5c45ae5b70c5149.manager.bundle.js +1 -0
- package/storybook-static/1.e3eafd38.iframe.bundle.js +1 -0
- package/storybook-static/2.3841b1a5.iframe.bundle.js +1 -0
- package/storybook-static/5.5b799f3fbf64cec8e51a.manager.bundle.js +2 -0
- package/storybook-static/{12.145180cacdb73a1c41fa.manager.bundle.js.LICENSE.txt → 5.5b799f3fbf64cec8e51a.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/6.6023eba1.iframe.bundle.js +3 -0
- package/storybook-static/{6.0a3ea46a.iframe.bundle.js.LICENSE.txt → 6.6023eba1.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/6.6023eba1.iframe.bundle.js.map +1 -0
- package/storybook-static/6.b34ce31193a7fa1dd965.manager.bundle.js +1 -0
- package/storybook-static/7.632f8551.iframe.bundle.js +1 -0
- package/storybook-static/7.72879af713f755a7aa7e.manager.bundle.js +1 -0
- package/storybook-static/8.9a8f8b69.iframe.bundle.js +1 -0
- package/storybook-static/8.f9b98ef3e089be1a16d6.manager.bundle.js +2 -0
- package/storybook-static/{15.f91ba9c8a1383d676abf.manager.bundle.js.LICENSE.txt → 8.f9b98ef3e089be1a16d6.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/9.1e1335092fade49cc986.manager.bundle.js +1 -0
- package/storybook-static/9.63a5cf7a.iframe.bundle.js +3 -0
- package/storybook-static/{9.6bf309ed.iframe.bundle.js.LICENSE.txt → 9.63a5cf7a.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/9.63a5cf7a.iframe.bundle.js.map +1 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +1 -1
- package/storybook-static/{main.20ee7e8a2af7ee58cc1f.manager.bundle.js → main.4bd27e4e7faa098302d1.manager.bundle.js} +1 -1
- package/storybook-static/main.8587302b.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/storybook-static/{runtime~main.6b765954.iframe.bundle.js → runtime~main.67ec6e92.iframe.bundle.js} +1 -1
- package/storybook-static/runtime~main.a58df7ba92d01c5088d3.manager.bundle.js +1 -0
- package/storybook-static/vendors~main.d13ba71108048897ea4a.manager.bundle.js +2 -0
- package/storybook-static/{vendors~main.bf986892b9b6ed78a230.manager.bundle.js.LICENSE.txt → vendors~main.d13ba71108048897ea4a.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.d5e21618.iframe.bundle.js +3 -0
- package/storybook-static/{vendors~main.e7c4fe25.iframe.bundle.js.LICENSE.txt → vendors~main.d5e21618.iframe.bundle.js.LICENSE.txt} +0 -6
- package/storybook-static/vendors~main.d5e21618.iframe.bundle.js.map +1 -0
- package/countries.json +0 -1
- package/src/elements/HawaPhoneInput2.js +0 -78
- package/storybook-static/0.58b40425.iframe.bundle.js +0 -3
- package/storybook-static/0.58b40425.iframe.bundle.js.map +0 -1
- package/storybook-static/1.8a994862.iframe.bundle.js +0 -1
- package/storybook-static/10.265ea9add491253ee249.manager.bundle.js +0 -2
- package/storybook-static/11.849df77e390cb885446a.manager.bundle.js +0 -1
- package/storybook-static/12.145180cacdb73a1c41fa.manager.bundle.js +0 -2
- package/storybook-static/13.575f17b8db12e674bbfd.manager.bundle.js +0 -1
- package/storybook-static/14.46316235b334885ad26e.manager.bundle.js +0 -1
- package/storybook-static/15.f91ba9c8a1383d676abf.manager.bundle.js +0 -2
- package/storybook-static/16.126410c9b7b02fbc5c26.manager.bundle.js +0 -1
- package/storybook-static/2.427819b2.iframe.bundle.js +0 -1
- package/storybook-static/6.0a3ea46a.iframe.bundle.js +0 -3
- package/storybook-static/6.0a3ea46a.iframe.bundle.js.map +0 -1
- package/storybook-static/7.9cd3bcaf.iframe.bundle.js +0 -1
- package/storybook-static/8.52752021.iframe.bundle.js +0 -1
- package/storybook-static/9.6bf309ed.iframe.bundle.js +0 -3
- package/storybook-static/9.6bf309ed.iframe.bundle.js.map +0 -1
- package/storybook-static/main.d86b3f87.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.84749e9163e4b198514f.manager.bundle.js +0 -1
- package/storybook-static/vendors~main.bf986892b9b6ed78a230.manager.bundle.js +0 -2
- package/storybook-static/vendors~main.e7c4fe25.iframe.bundle.js +0 -3
- package/storybook-static/vendors~main.e7c4fe25.iframe.bundle.js.map +0 -1
|
@@ -1,61 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import Countries from "../../countries";
|
|
3
|
+
import Select from "react-select";
|
|
4
|
+
const Option = ({ cx, children, getStyles, innerRef, ...props }) => (
|
|
5
|
+
<div
|
|
6
|
+
ref={innerRef}
|
|
7
|
+
className="m-2 p-1 px-3 rounded-lg flex flex-row items-center justify-between hover:bg-blue-200"
|
|
8
|
+
>
|
|
9
|
+
<img className="h-8 w-8" src={props.data.image}></img>
|
|
10
|
+
{children}
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
3
13
|
|
|
4
|
-
export default function HawaPhoneInput(
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
export default function HawaPhoneInput({ preferredCountry }) {
|
|
15
|
+
const [code, setCode] = useState(preferredCountry ?? "");
|
|
16
|
+
const [selectedCountry, setSelectedCountry] = useState("+966");
|
|
17
|
+
const [tel, setTel] = useState("");
|
|
18
|
+
const handleChangePhone = (phone) => {
|
|
19
|
+
if (phone.length == 0) {
|
|
20
|
+
setTel("");
|
|
21
|
+
setCode("");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!phone.startsWith("+")) phone = "+".concat(phone);
|
|
25
|
+
if (phone.length >= 5) {
|
|
26
|
+
setTel(phone);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let findDialCode = Countries.find((country) => country.dial_code == phone);
|
|
30
|
+
if (findDialCode != undefined && findDialCode != null) {
|
|
31
|
+
setCode(findDialCode.code);
|
|
32
|
+
}
|
|
33
|
+
setTel(phone);
|
|
34
|
+
};
|
|
19
35
|
|
|
20
36
|
return (
|
|
21
|
-
<div
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
<div
|
|
38
|
+
style={{
|
|
39
|
+
display: "flex",
|
|
40
|
+
flexDirection: "row",
|
|
41
|
+
justifyContent: "center",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
height: "100%"
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<Select
|
|
47
|
+
styles={{
|
|
48
|
+
input: (base) => ({
|
|
49
|
+
...base,
|
|
50
|
+
fontSize: "0.875rem",
|
|
51
|
+
"input:focus": {
|
|
52
|
+
boxShadow: "none"
|
|
53
|
+
},
|
|
54
|
+
lineHeight: "1.25rem",
|
|
55
|
+
padding: "0.37rem"
|
|
56
|
+
}),
|
|
57
|
+
control: (base) => ({
|
|
58
|
+
...base,
|
|
59
|
+
width: 80,
|
|
60
|
+
borderRadius: "0.75rem",
|
|
61
|
+
borderTopRightRadius: 0,
|
|
62
|
+
borderBottomRightRadius: 0
|
|
63
|
+
}),
|
|
64
|
+
menu: (base) => ({
|
|
65
|
+
...base,
|
|
66
|
+
width: 190,
|
|
67
|
+
borderRadius: "0.75rem"
|
|
68
|
+
})
|
|
45
69
|
}}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
70
|
+
components={{
|
|
71
|
+
Option,
|
|
72
|
+
DropdownIndicator: () => null,
|
|
73
|
+
IndicatorSeparator: () => null
|
|
50
74
|
}}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
|
|
75
|
+
options={Countries}
|
|
76
|
+
isCreatable={false}
|
|
77
|
+
isMulti={false}
|
|
78
|
+
isSearchable={true}
|
|
79
|
+
isClearable={true}
|
|
80
|
+
placeholder="+966"
|
|
81
|
+
// value={selectedCountry}
|
|
82
|
+
// inputValue={selectedCountry}
|
|
83
|
+
onChange={(newValue, action) => {
|
|
84
|
+
console.log("test n", newValue);
|
|
85
|
+
setSelectedCountry(newValue);
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
<div>
|
|
89
|
+
<input className="bg-gray-50 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" />
|
|
90
|
+
</div>
|
|
59
91
|
</div>
|
|
60
92
|
);
|
|
61
93
|
}
|
|
@@ -1,28 +1,65 @@
|
|
|
1
1
|
import Select from "react-select";
|
|
2
|
-
import
|
|
2
|
+
import CreatableSelect from "react-select/creatable";
|
|
3
3
|
|
|
4
4
|
export default function HawaSelectInput(props) {
|
|
5
5
|
return (
|
|
6
6
|
<>
|
|
7
7
|
{!props.isCreatable && (
|
|
8
8
|
<Select
|
|
9
|
+
styles={{
|
|
10
|
+
input: (base) => ({
|
|
11
|
+
...base,
|
|
12
|
+
"input:focus": {
|
|
13
|
+
boxShadow: "none"
|
|
14
|
+
}
|
|
15
|
+
}),
|
|
16
|
+
control: (base) => ({
|
|
17
|
+
...base,
|
|
18
|
+
borderRadius: "0.75rem",
|
|
19
|
+
padding: 3
|
|
20
|
+
}),
|
|
21
|
+
menu: (base) => ({
|
|
22
|
+
...base,
|
|
23
|
+
borderRadius: "0.75rem"
|
|
24
|
+
})
|
|
25
|
+
}}
|
|
9
26
|
options={props.options}
|
|
10
27
|
isClearable={props.isClearable}
|
|
11
28
|
isMulti={props.isMulti}
|
|
12
29
|
isSearchable={props.isSearchable}
|
|
13
30
|
onChange={(newValue, action) => props.onChange(newValue, action)}
|
|
31
|
+
components={props.components}
|
|
14
32
|
/>
|
|
15
33
|
)}
|
|
16
34
|
{props.isCreatable && (
|
|
17
|
-
<
|
|
35
|
+
<CreatableSelect
|
|
36
|
+
styles={{
|
|
37
|
+
input: (base) => ({
|
|
38
|
+
...base,
|
|
39
|
+
"input:focus": {
|
|
40
|
+
padding: 20,
|
|
41
|
+
boxShadow: "none"
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
control: (base) => ({
|
|
45
|
+
...base,
|
|
46
|
+
borderRadius: "0.75rem",
|
|
47
|
+
padding: 8
|
|
48
|
+
})
|
|
49
|
+
}}
|
|
18
50
|
options={props.options}
|
|
19
51
|
isClearable={props.isClearable}
|
|
20
52
|
isMulti={props.isMulti}
|
|
21
53
|
isSearchable={props.isSearchable}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
54
|
+
onCreateOption={() => console.log("im changing")}
|
|
55
|
+
onChange={(newValue, action) => {
|
|
56
|
+
console.log("this is onChange", newValue);
|
|
57
|
+
props.onChange(newValue, action);
|
|
58
|
+
}}
|
|
59
|
+
onInputChange={(newValue, action) => {
|
|
60
|
+
console.log("onInputChange====", newValue);
|
|
61
|
+
props.onInputChange(newValue, action);
|
|
62
|
+
}}
|
|
26
63
|
/>
|
|
27
64
|
)}
|
|
28
65
|
</>
|
|
@@ -9,10 +9,19 @@ export const HawaTextField = (props) => {
|
|
|
9
9
|
>
|
|
10
10
|
{props.label}
|
|
11
11
|
</label>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
{props.multiline ? (
|
|
13
|
+
<textarea
|
|
14
|
+
id="message"
|
|
15
|
+
rows="4"
|
|
16
|
+
class="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 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"
|
|
17
|
+
placeholder="Your message..."
|
|
18
|
+
></textarea>
|
|
19
|
+
) : (
|
|
20
|
+
<input
|
|
21
|
+
{...props}
|
|
22
|
+
className="mb-2 bg-gray-50 border 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"
|
|
23
|
+
/>
|
|
24
|
+
)}
|
|
16
25
|
|
|
17
26
|
{props.helperText && (
|
|
18
27
|
<p className="mt-2 text-sm text-red-600 dark:text-red-500">
|
package/src/elements/index.js
CHANGED
|
@@ -20,7 +20,6 @@ export * from "./HawaAccordian";
|
|
|
20
20
|
export * from "./DragDropImages";
|
|
21
21
|
export * from "./DraggableCard";
|
|
22
22
|
export * from "./HawaPhoneInput";
|
|
23
|
-
export * from "./HawaPhoneInput2";
|
|
24
23
|
export * from "./HawaDrawerItem";
|
|
25
24
|
export * from "./HawaTooltip";
|
|
26
25
|
export * from "./HawaTabs";
|
package/src/styles.css
CHANGED
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
cursor: pointer;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
input[type="number"]::-webkit-inner-spin-button,
|
|
56
|
+
/* input[type="number"]::-webkit-inner-spin-button,
|
|
57
57
|
input[type="number"]::-webkit-outer-spin-button {
|
|
58
58
|
-webkit-appearance: none;
|
|
59
|
-
}
|
|
59
|
+
} */
|
|
60
60
|
|
|
61
61
|
.phoneInput {
|
|
62
62
|
padding-top: 10px !important;
|
package/src/tailwind.css
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
@import
|
|
2
|
-
@import
|
|
3
|
-
@import
|
|
1
|
+
@import "tailwindcss/base";
|
|
2
|
+
@import "tailwindcss/components";
|
|
3
|
+
@import "tailwindcss/utilities";
|
|
4
4
|
|
|
5
5
|
body {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
font-family: "IBM Plex Sans Arabic";
|
|
7
|
+
}
|
|
8
|
+
/* <div class="react-select-container">
|
|
9
|
+
<div class="react-select__control">
|
|
10
|
+
<div class="react-select__value-container">...</div>
|
|
11
|
+
<div class="react-select__indicators">...</div>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="react-select__menu">
|
|
14
|
+
<div class="react-select__menu-list">
|
|
15
|
+
<div class="react-select__option">...</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div> */
|
|
19
|
+
.hawa-select-container {
|
|
20
|
+
background-color: red;
|
|
21
|
+
}
|