@sikka/hawa 0.0.95 → 0.0.96
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 +279 -211
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +18 -6
- package/rollup.config.js +14 -2
- package/src/blocks/Account/{UserProfileForm.js → UserProfileForm.tsx} +42 -41
- package/src/blocks/Account/UserSettingsForm.tsx +28 -0
- package/src/blocks/Account/index.ts +2 -0
- package/src/blocks/AuthForms/AppLanding.tsx +33 -0
- package/src/blocks/AuthForms/CodeConfirmation.tsx +59 -0
- package/src/blocks/AuthForms/{NewPasswordForm.js → NewPasswordForm.tsx} +49 -53
- package/src/blocks/AuthForms/{ResetPasswordForm.js → ResetPasswordForm.tsx} +35 -38
- package/src/blocks/AuthForms/{SignInForm.js → SignInForm.tsx} +73 -65
- package/src/blocks/AuthForms/SignInPhone.tsx +68 -0
- package/src/blocks/AuthForms/{SignUpForm.js → SignUpForm.tsx} +88 -82
- package/src/blocks/AuthForms/index.ts +7 -0
- package/src/blocks/Misc/NotFound.tsx +28 -0
- package/src/blocks/Misc/index.ts +1 -0
- package/src/blocks/Payment/ChargeWalletForm.tsx +70 -0
- package/src/blocks/Payment/{CheckoutForm.js → CheckoutForm.tsx} +82 -81
- package/src/blocks/Payment/Confirmation.tsx +96 -0
- package/src/blocks/Payment/{CreditCardForm.js → CreditCardForm.tsx} +48 -33
- package/src/blocks/Payment/PayWithWallet.tsx +29 -0
- package/src/blocks/Payment/{SelectPayment.js → SelectPayment.tsx} +33 -29
- package/src/blocks/Payment/{index.js → index.ts} +0 -0
- package/src/blocks/Pricing/{ComparingPlans.js → ComparingPlans.tsx} +51 -53
- package/src/blocks/Pricing/PricingPlans.tsx +72 -0
- package/src/blocks/Pricing/{index.js → index.ts} +0 -0
- package/src/blocks/{index.js → index.ts} +0 -0
- package/{countries.js → src/countries.ts} +245 -245
- package/src/elements/{AutoCompleteField.js → AutoCompleteField.tsx} +16 -9
- package/src/elements/{DragDropImages.js → DragDropImages.tsx} +78 -53
- package/src/elements/DraggableCard.tsx +29 -0
- package/src/elements/{HawaAccordian.js → HawaAccordian.tsx} +27 -23
- package/src/elements/HawaAdCard.tsx +48 -0
- package/src/elements/HawaAlert.tsx +30 -0
- package/src/elements/HawaButton.tsx +120 -0
- package/src/elements/HawaCheckbox.tsx +37 -0
- package/src/elements/HawaChip.tsx +12 -0
- package/src/elements/HawaColorPicker.tsx +38 -0
- package/src/elements/{HawaCopyrights.js → HawaCopyrights.tsx} +15 -8
- package/src/elements/HawaDrawer.tsx +84 -0
- package/src/elements/{HawaDrawerItem.js → HawaDrawerItem.tsx} +12 -7
- package/src/elements/{HawaItemCard.js → HawaItemCard.tsx} +35 -36
- package/src/elements/{HawaLogoButton.js → HawaLogoButton.tsx} +52 -56
- package/src/elements/HawaMenu.tsx +75 -0
- package/src/elements/{HawaModal.js → HawaModal.tsx} +30 -21
- package/src/elements/{HawaPanelTabs.js → HawaPanelTabs.tsx} +27 -27
- package/src/elements/HawaPhoneInput.tsx +112 -0
- package/src/elements/{HawaPricingCard.js → HawaPricingCard.tsx} +86 -47
- package/src/elements/HawaRadio.tsx +34 -0
- package/src/elements/HawaRange.tsx +47 -0
- package/src/elements/HawaSearchBar.tsx +9 -0
- package/src/elements/{HawaSelect.js → HawaSelect.tsx} +74 -31
- package/src/elements/HawaSettingsRow.tsx +56 -0
- package/src/elements/HawaSnackbar.tsx +73 -0
- package/src/elements/HawaSwitch.tsx +25 -0
- package/src/elements/{HawaTable.js → HawaTable.tsx} +33 -31
- package/src/elements/{HawaTabs.js → HawaTabs.tsx} +17 -12
- package/src/elements/HawaTextField.tsx +71 -0
- package/src/elements/HawaTooltip.tsx +35 -0
- package/src/elements/HawaTypography.tsx +11 -0
- package/src/elements/{TabPanel.js → TabPanel.tsx} +10 -5
- package/src/elements/{index.js → index.ts} +7 -4
- package/src/index.ts +3 -0
- package/src/layout/Box.tsx +5 -0
- package/src/layout/HawaBottomAppBar.tsx +54 -0
- package/src/layout/HawaContainer.tsx +24 -0
- package/src/layout/{HawaLayout.js → HawaLayout.tsx} +54 -49
- package/src/layout/{index.js → index.ts} +0 -0
- package/src/styles.css +279 -211
- package/src/{util.js → util.ts} +0 -0
- package/storybook-static/229.a3257e00.iframe.bundle.js +1 -0
- package/storybook-static/229.d6fb4f8f665962cef844.manager.bundle.js +1 -0
- package/storybook-static/295.67c251ec00675ab59b60.manager.bundle.js +1 -0
- package/storybook-static/51.786e9bbba427ee454dc0.manager.bundle.js +2 -0
- package/storybook-static/{0.1104ca18.iframe.bundle.js.LICENSE.txt → 51.786e9bbba427ee454dc0.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/51.acbbdb95.iframe.bundle.js +2 -0
- package/storybook-static/{0.cf71f8aa82edef0a7186.manager.bundle.js.LICENSE.txt → 51.acbbdb95.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/551.67cd309b0648b0a52636.manager.bundle.js +1 -0
- package/storybook-static/551.c82ea8f1.iframe.bundle.js +1 -0
- package/storybook-static/701.bcf1e718.iframe.bundle.js +1 -0
- package/storybook-static/733.8d2de9f8.iframe.bundle.js +2 -0
- package/storybook-static/{vendors~main.a40572d0.iframe.bundle.js.LICENSE.txt → 733.8d2de9f8.iframe.bundle.js.LICENSE.txt} +0 -10
- package/storybook-static/767.2f9c96fa3338c8d16078.manager.bundle.js +2 -0
- package/storybook-static/{vendors~main.d13ba71108048897ea4a.manager.bundle.js.LICENSE.txt → 767.2f9c96fa3338c8d16078.manager.bundle.js.LICENSE.txt} +0 -10
- package/storybook-static/807.14b8bfa7.iframe.bundle.js +2 -0
- package/storybook-static/{5.5b799f3fbf64cec8e51a.manager.bundle.js.LICENSE.txt → 807.14b8bfa7.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/807.4f52b2d047c5e8c5872f.manager.bundle.js +2 -0
- package/storybook-static/{6.6023eba1.iframe.bundle.js.LICENSE.txt → 807.4f52b2d047c5e8c5872f.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/897.386c170cbd1467abc7ca.manager.bundle.js +2 -0
- package/storybook-static/{8.f9b98ef3e089be1a16d6.manager.bundle.js.LICENSE.txt → 897.386c170cbd1467abc7ca.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/897.d9a35fd0.iframe.bundle.js +2 -0
- package/storybook-static/{9.63a5cf7a.iframe.bundle.js.LICENSE.txt → 897.d9a35fd0.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/935.07c1b6ea.iframe.bundle.js +1 -0
- package/storybook-static/935.0b4e9c201c33f3e66e81.manager.bundle.js +1 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +1 -1
- package/storybook-static/main.051275cac7b0dc69501c.manager.bundle.js +1 -0
- package/storybook-static/main.71507dcb.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/storybook-static/runtime~main.25eae181fe0f96887a15.manager.bundle.js +1 -0
- package/storybook-static/runtime~main.4d0bf318.iframe.bundle.js +1 -0
- package/tailwind.config.js +16 -1
- package/tsconfig.json +25 -0
- package/src/blocks/Account/UserSettingsForm.js +0 -17
- package/src/blocks/Account/index.js +0 -2
- package/src/blocks/AuthForms/AppLanding.js +0 -40
- package/src/blocks/AuthForms/CodeConfirmation.js +0 -78
- package/src/blocks/AuthForms/SignInPhone.js +0 -38
- package/src/blocks/AuthForms/index.js +0 -7
- package/src/blocks/Misc/NotFound.js +0 -32
- package/src/blocks/Misc/index.js +0 -1
- package/src/blocks/Payment/ChargeWalletForm.js +0 -81
- package/src/blocks/Payment/Confirmation.js +0 -104
- package/src/blocks/Payment/Form/CForm.js +0 -316
- package/src/blocks/Payment/Form/Card.js +0 -242
- package/src/blocks/Payment/Form/PaymentMethod.js +0 -118
- package/src/blocks/Payment/Gateway/GooglePay.js +0 -251
- package/src/blocks/Payment/Gateway/Payfort.js +0 -90
- package/src/blocks/Payment/Gateway/Paypal.js +0 -138
- package/src/blocks/Payment/Gateway/Wallet.js +0 -148
- package/src/blocks/Payment/PayWithWallet.js +0 -20
- package/src/blocks/Pricing/PricingPlans.js +0 -88
- package/src/elements/DraggableCard.js +0 -24
- package/src/elements/HawaAlert.js +0 -41
- package/src/elements/HawaButton.js +0 -62
- package/src/elements/HawaCheckbox.js +0 -28
- package/src/elements/HawaChip.js +0 -9
- package/src/elements/HawaColorPicker.js +0 -57
- package/src/elements/HawaDrawer.js +0 -68
- package/src/elements/HawaMenu.js +0 -71
- package/src/elements/HawaPhoneInput.js +0 -106
- package/src/elements/HawaRadio.js +0 -31
- package/src/elements/HawaRange.js +0 -54
- package/src/elements/HawaSearchBar.js +0 -15
- package/src/elements/HawaSettingsRow.js +0 -34
- package/src/elements/HawaSnackbar.js +0 -44
- package/src/elements/HawaSwitch.js +0 -21
- package/src/elements/HawaTextField.js +0 -34
- package/src/elements/HawaTooltip.js +0 -19
- package/src/elements/HawaTypography.js +0 -5
- package/src/elements/PinInput.js +0 -141
- package/src/elements/SelectedField.js +0 -46
- package/src/index.js +0 -3
- package/src/layout/Box.js +0 -5
- package/src/layout/HawaAppLayout.js +0 -245
- package/src/layout/HawaAppLayout2.js +0 -254
- package/src/layout/HawaBottomAppBar.js +0 -76
- package/src/layout/HawaContainer.js +0 -8
- package/storybook-static/0.1104ca18.iframe.bundle.js +0 -3
- package/storybook-static/0.1104ca18.iframe.bundle.js.map +0 -1
- package/storybook-static/0.cf71f8aa82edef0a7186.manager.bundle.js +0 -2
- package/storybook-static/1.7e6ec5c45ae5b70c5149.manager.bundle.js +0 -1
- package/storybook-static/1.e3eafd38.iframe.bundle.js +0 -1
- package/storybook-static/2.3841b1a5.iframe.bundle.js +0 -1
- package/storybook-static/5.5b799f3fbf64cec8e51a.manager.bundle.js +0 -2
- package/storybook-static/6.6023eba1.iframe.bundle.js +0 -3
- package/storybook-static/6.6023eba1.iframe.bundle.js.map +0 -1
- package/storybook-static/6.b34ce31193a7fa1dd965.manager.bundle.js +0 -1
- package/storybook-static/7.632f8551.iframe.bundle.js +0 -1
- package/storybook-static/7.72879af713f755a7aa7e.manager.bundle.js +0 -1
- package/storybook-static/8.9a8f8b69.iframe.bundle.js +0 -1
- package/storybook-static/8.f9b98ef3e089be1a16d6.manager.bundle.js +0 -2
- package/storybook-static/9.1e1335092fade49cc986.manager.bundle.js +0 -1
- package/storybook-static/9.63a5cf7a.iframe.bundle.js +0 -3
- package/storybook-static/9.63a5cf7a.iframe.bundle.js.map +0 -1
- package/storybook-static/main.4bd27e4e7faa098302d1.manager.bundle.js +0 -1
- package/storybook-static/main.ea9904c2.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.67ec6e92.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.a58df7ba92d01c5088d3.manager.bundle.js +0 -1
- package/storybook-static/vendors~main.a40572d0.iframe.bundle.js +0 -3
- package/storybook-static/vendors~main.a40572d0.iframe.bundle.js.map +0 -1
- package/storybook-static/vendors~main.d13ba71108048897ea4a.manager.bundle.js +0 -2
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { HawaTypography } from "./HawaTypography";
|
|
4
|
-
import { HawaTextField } from "./HawaTextField";
|
|
5
|
-
import { HawaSwitch } from "./HawaSwitch";
|
|
6
|
-
import { HawaColorPicker } from "./HawaColorPicker";
|
|
7
|
-
import { HawaRange } from "./HawaRange";
|
|
8
|
-
import { HawaCheckbox } from "./HawaCheckbox";
|
|
9
|
-
import { HawaTabs } from "./HawaTabs";
|
|
10
|
-
|
|
11
|
-
export const HawaSettingsRow = (props) => {
|
|
12
|
-
return (
|
|
13
|
-
<div className="flex flex-row bg-white justify-between align-middle items-center p-2 rounded-xl my-2 h-14">
|
|
14
|
-
<HawaTypography>{props.settingsLabel}</HawaTypography>
|
|
15
|
-
{props.settingsType === "checkbox" && <HawaCheckbox {...props} />}
|
|
16
|
-
{props.settingsType === "text" && <HawaTextField {...props} />}
|
|
17
|
-
{props.settingsType === "boolean" && <HawaSwitch {...props} />}
|
|
18
|
-
{props.settingsType === "range" && <HawaRange {...props} />}
|
|
19
|
-
{props.settingsType === "color" && <HawaColorPicker {...props} />}
|
|
20
|
-
{props.settingsType === "radio" && <HawaTabs {...props} />}
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
HawaSettingsRow.propTypes = {
|
|
26
|
-
settingsLabel: PropTypes.string,
|
|
27
|
-
settingsType: PropTypes.oneOf([
|
|
28
|
-
"checkbox",
|
|
29
|
-
"text",
|
|
30
|
-
"radio",
|
|
31
|
-
"boolean",
|
|
32
|
-
"color"
|
|
33
|
-
])
|
|
34
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export const HawaSnackbar = (props) => {
|
|
4
|
-
|
|
5
|
-
let severities = {
|
|
6
|
-
info: "bottom-4 fixed flex items-center p-4 w-full max-w-xs text-blue-700 bg-blue-100 rounded-lg shadow dark:text-gray-400 dark:bg-gray-800",
|
|
7
|
-
warning:
|
|
8
|
-
"bottom-4 fixed flex items-center p-4 w-full max-w-xs text-yellow-700 bg-yellow-100 rounded-lg shadow dark:text-gray-400 dark:bg-gray-800",
|
|
9
|
-
error:
|
|
10
|
-
"bottom-4 fixed flex items-center p-4 w-full max-w-xs text-red-700 bg-red-100 rounded-lg shadow dark:text-gray-400 dark:bg-gray-800",
|
|
11
|
-
success:
|
|
12
|
-
"bottom-4 fixed flex items-center p-4 w-full max-w-xs text-green-700 bg-green-100 rounded-lg shadow dark:text-gray-400 dark:bg-gray-800",
|
|
13
|
-
none: "bottom-4 fixed flex items-center p-4 w-full max-w-xs text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800"
|
|
14
|
-
};
|
|
15
|
-
return (
|
|
16
|
-
<div id="toast-default" role="alert" className={severities[props.severity]}>
|
|
17
|
-
<div>
|
|
18
|
-
<div className="ml-3 text-sm font-bold">{props.title}</div>
|
|
19
|
-
<div className="ml-3 text-sm font-normal">{props.text}</div>
|
|
20
|
-
</div>
|
|
21
|
-
<button
|
|
22
|
-
type="button"
|
|
23
|
-
className="ml-auto -mx-1.5 -my-1.5 text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700"
|
|
24
|
-
data-dismiss-target="#toast-default"
|
|
25
|
-
aria-label="Close"
|
|
26
|
-
>
|
|
27
|
-
<span className="sr-only">Close</span>
|
|
28
|
-
<svg
|
|
29
|
-
aria-hidden="true"
|
|
30
|
-
className="w-5 h-5"
|
|
31
|
-
fill="currentColor"
|
|
32
|
-
viewBox="0 0 20 20"
|
|
33
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
34
|
-
>
|
|
35
|
-
<path
|
|
36
|
-
fill-rule="evenodd"
|
|
37
|
-
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
38
|
-
clip-rule="evenodd"
|
|
39
|
-
></path>
|
|
40
|
-
</svg>
|
|
41
|
-
</button>
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export const HawaSwitch = (props) => {
|
|
4
|
-
return (
|
|
5
|
-
<label
|
|
6
|
-
htmlFor="default-toggle"
|
|
7
|
-
className="inline-flex relative items-center cursor-pointer"
|
|
8
|
-
>
|
|
9
|
-
<input
|
|
10
|
-
type="checkbox"
|
|
11
|
-
value=""
|
|
12
|
-
id="default-toggle"
|
|
13
|
-
className="sr-only peer"
|
|
14
|
-
/>
|
|
15
|
-
<div className="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"></div>
|
|
16
|
-
<span className="ml-3 text-sm font-medium text-gray-900 dark:text-gray-300">
|
|
17
|
-
{props.text}
|
|
18
|
-
</span>
|
|
19
|
-
</label>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export const HawaTextField = (props) => {
|
|
4
|
-
return (
|
|
5
|
-
<div className="mb-3">
|
|
6
|
-
<label
|
|
7
|
-
htmlFor="first_name"
|
|
8
|
-
className="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
|
|
9
|
-
>
|
|
10
|
-
{props.label}
|
|
11
|
-
</label>
|
|
12
|
-
{props.multiline ? (
|
|
13
|
-
<textarea
|
|
14
|
-
id="message"
|
|
15
|
-
rows="4"
|
|
16
|
-
className="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
|
-
)}
|
|
25
|
-
|
|
26
|
-
{props.helperText && (
|
|
27
|
-
<p className="mx-2 mt-1 text-xs text-red-600 dark:text-red-500">
|
|
28
|
-
{/* <span className="font-medium">Oh, snapp!</span> */}
|
|
29
|
-
{props.helperText}
|
|
30
|
-
</p>
|
|
31
|
-
)}
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export const HawaTooltip = (props) => {
|
|
4
|
-
return (
|
|
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>
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
};
|
package/src/elements/PinInput.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
export const HawaPinInput = ({
|
|
4
|
-
children,
|
|
5
|
-
type,
|
|
6
|
-
defaultValue,
|
|
7
|
-
onChange,
|
|
8
|
-
onComplete,
|
|
9
|
-
...props
|
|
10
|
-
}) => {
|
|
11
|
-
const [value, setValue] = useState(
|
|
12
|
-
defaultValue ? defaultValue.split("") : []
|
|
13
|
-
);
|
|
14
|
-
const [pinLength, setPinLength] = useState(0);
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
let length = 0;
|
|
18
|
-
React.Children.map(children, (child) => {
|
|
19
|
-
if (
|
|
20
|
-
React.isValidElement(child) &&
|
|
21
|
-
child.type?.displayName &&
|
|
22
|
-
child.type?.displayName === "HawaPinInputField"
|
|
23
|
-
) {
|
|
24
|
-
length++;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
setPinLength(length);
|
|
28
|
-
}, []);
|
|
29
|
-
|
|
30
|
-
const childrenWithProps = React.Children.map(children, (child, index) => {
|
|
31
|
-
if (React.isValidElement(child)) {
|
|
32
|
-
if (
|
|
33
|
-
child.type?.displayName &&
|
|
34
|
-
child.type?.displayName === "HawaPinInputField" &&
|
|
35
|
-
defaultValue &&
|
|
36
|
-
defaultValue[index]
|
|
37
|
-
) {
|
|
38
|
-
return React.cloneElement(child, {
|
|
39
|
-
type,
|
|
40
|
-
defaultValue: defaultValue[index],
|
|
41
|
-
index: index,
|
|
42
|
-
setValue: setValue,
|
|
43
|
-
value: value,
|
|
44
|
-
onChangeAction: (currentValue) => onChange(currentValue),
|
|
45
|
-
onCompleteAction: (finalValue) => onComplete(finalValue),
|
|
46
|
-
pinLength: pinLength
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return React.cloneElement(child, {
|
|
50
|
-
type,
|
|
51
|
-
setValue: setValue,
|
|
52
|
-
value: value,
|
|
53
|
-
index: index,
|
|
54
|
-
onChangeAction: (currentValue) => onChange(currentValue),
|
|
55
|
-
onCompleteAction: (finalValue) => onComplete(finalValue),
|
|
56
|
-
pinLength: pinLength
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return child;
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
if (value.length === pinLength) {
|
|
64
|
-
onComplete(value);
|
|
65
|
-
}
|
|
66
|
-
}, [value]);
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<div style={props.inForm && { width: "100%" }}>
|
|
70
|
-
<div style={{ width: props.fullWidth ? "100%" : "fit-content" }}>
|
|
71
|
-
<div
|
|
72
|
-
style={{
|
|
73
|
-
display: "flex",
|
|
74
|
-
flexDirection: "row",
|
|
75
|
-
justifyContent: "space-between",
|
|
76
|
-
alignItems: "center"
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
{props.label && (
|
|
80
|
-
<label
|
|
81
|
-
htmlFor="first_name"
|
|
82
|
-
className="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
|
|
83
|
-
>
|
|
84
|
-
{props.label}
|
|
85
|
-
</label>
|
|
86
|
-
)}
|
|
87
|
-
|
|
88
|
-
{props.helperText && (
|
|
89
|
-
<div
|
|
90
|
-
style={{ marginBottom: !props.label && 10 }}
|
|
91
|
-
variant="validation"
|
|
92
|
-
>
|
|
93
|
-
{props.helperText}
|
|
94
|
-
</div>
|
|
95
|
-
)}
|
|
96
|
-
</div>
|
|
97
|
-
<div>{childrenWithProps}</div>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export const HawaPinInputField = (props) => {
|
|
104
|
-
return (
|
|
105
|
-
<input
|
|
106
|
-
className="w-12 rounded-lg mx-2"
|
|
107
|
-
type={props.type && props.type == "alphanumeric" ? "text" : "number"}
|
|
108
|
-
id={"pinInput" + props.index}
|
|
109
|
-
defaultValue={props.defaultValue || ""}
|
|
110
|
-
variant="pin"
|
|
111
|
-
onKeyDown={(e) => {
|
|
112
|
-
if (e.key === "Backspace") {
|
|
113
|
-
let i = document.getElementById("pinInput" + (props.index - 1));
|
|
114
|
-
if (e) {
|
|
115
|
-
i.focus();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}}
|
|
119
|
-
disableUnderline
|
|
120
|
-
inputProps={{ maxLength: 1 }}
|
|
121
|
-
onChange={(e) => {
|
|
122
|
-
let newValue = props.value;
|
|
123
|
-
newValue[props.index] = e.target.value;
|
|
124
|
-
props.setValue(newValue);
|
|
125
|
-
props.onChangeAction(newValue.toString().replaceAll(",", ""));
|
|
126
|
-
if (
|
|
127
|
-
parseInt(e.target.attributes["maxlength"].value) >= 1 &&
|
|
128
|
-
e.target.value != ""
|
|
129
|
-
) {
|
|
130
|
-
let i = document.getElementById("pinInput" + (props.index + 1));
|
|
131
|
-
if (i != null) {
|
|
132
|
-
i.focus();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (props.value.length === props.pinLength) {
|
|
136
|
-
props.onCompleteAction(props.value.toString().replaceAll(",", ""));
|
|
137
|
-
}
|
|
138
|
-
}}
|
|
139
|
-
/>
|
|
140
|
-
);
|
|
141
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// import React from "react";
|
|
2
|
-
// import { Controller, useFormContext } from "react-hook-form";
|
|
3
|
-
// import FormHelperText from "@mui/material/FormHelperText";
|
|
4
|
-
// import FormControl from "@mui/material/FormControl";
|
|
5
|
-
// import MenuItem from "@mui/material/MenuItem";
|
|
6
|
-
// import Select from "@mui/material/Select";
|
|
7
|
-
|
|
8
|
-
// const MuiSelect = (props) => {
|
|
9
|
-
// const { name, options, required, error } = props;
|
|
10
|
-
// let isError = false;
|
|
11
|
-
// let errorMessage = "";
|
|
12
|
-
// if (error && error.hasOwnProperty(name)) {
|
|
13
|
-
// isError = true;
|
|
14
|
-
// errorMessage = error[name].message;
|
|
15
|
-
// }
|
|
16
|
-
|
|
17
|
-
// return (
|
|
18
|
-
// <FormControl fullWidth={true} error={isError}>
|
|
19
|
-
// {label} {required ? <span className="req-label">*</span> : null}
|
|
20
|
-
// <Select id={name} {...props}>
|
|
21
|
-
// <MenuItem value="">
|
|
22
|
-
// <em>None</em>
|
|
23
|
-
// </MenuItem>
|
|
24
|
-
// {options.map((item) => (
|
|
25
|
-
// <MenuItem key={item.id} value={item.id}>
|
|
26
|
-
// {item.label}
|
|
27
|
-
// </MenuItem>
|
|
28
|
-
// ))}
|
|
29
|
-
// </Select>
|
|
30
|
-
// <FormHelperText>{errorMessage}</FormHelperText>
|
|
31
|
-
// </FormControl>
|
|
32
|
-
// );
|
|
33
|
-
// };
|
|
34
|
-
|
|
35
|
-
// export const SelectField = (props) => {
|
|
36
|
-
// const { control } = useFormContext();
|
|
37
|
-
// return (
|
|
38
|
-
// <React.Fragment>
|
|
39
|
-
// <Controller
|
|
40
|
-
// control={control}
|
|
41
|
-
// render={(field) => <MuiSelect {...props} {...field} />}
|
|
42
|
-
// {...props}
|
|
43
|
-
// />
|
|
44
|
-
// </React.Fragment>
|
|
45
|
-
// );
|
|
46
|
-
// };
|
package/src/index.js
DELETED
package/src/layout/Box.js
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
// import * as React from "react";
|
|
2
|
-
// import { styled, useTheme } from "@mui/material/styles";
|
|
3
|
-
// import Box from "@mui/material/Box";
|
|
4
|
-
// import Drawer from "@mui/material/Drawer";
|
|
5
|
-
// import CssBaseline from "@mui/material/CssBaseline";
|
|
6
|
-
// import MuiAppBar from "@mui/material/AppBar";
|
|
7
|
-
// import Toolbar from "@mui/material/Toolbar";
|
|
8
|
-
// import List from "@mui/material/List";
|
|
9
|
-
// import Typography from "@mui/material/Typography";
|
|
10
|
-
// import Divider from "@mui/material/Divider";
|
|
11
|
-
// import IconButton from "@mui/material/IconButton";
|
|
12
|
-
// import MenuIcon from "@mui/icons-material/Menu";
|
|
13
|
-
// import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
14
|
-
// import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
15
|
-
// import ListItem from "@mui/material/ListItem";
|
|
16
|
-
// import ListItemIcon from "@mui/material/ListItemIcon";
|
|
17
|
-
// import ListItemText from "@mui/material/ListItemText";
|
|
18
|
-
// import InboxIcon from "@mui/icons-material/MoveToInbox";
|
|
19
|
-
// import MailIcon from "@mui/icons-material/Mail";
|
|
20
|
-
|
|
21
|
-
// const drawerWidth = 240;
|
|
22
|
-
|
|
23
|
-
// const Main = styled("main", { shouldForwardProp: (prop) => prop !== "open" })(
|
|
24
|
-
// ({ theme, open, direction }) => ({
|
|
25
|
-
// flexGrow: 1,
|
|
26
|
-
// padding: theme.spacing(3),
|
|
27
|
-
// transition: theme.transitions.create("margin", {
|
|
28
|
-
// easing: theme.transitions.easing.sharp,
|
|
29
|
-
// duration: theme.transitions.duration.leavingScreen
|
|
30
|
-
// }),
|
|
31
|
-
// marginLeft: direction === "rtl" ? 0 : `-${drawerWidth}px`,
|
|
32
|
-
// marginRight: direction === "rtl" ? `-${drawerWidth}px` : 0,
|
|
33
|
-
// ...(open && {
|
|
34
|
-
// transition: theme.transitions.create("margin", {
|
|
35
|
-
// easing: theme.transitions.easing.easeOut,
|
|
36
|
-
// duration: theme.transitions.duration.enteringScreen
|
|
37
|
-
// }),
|
|
38
|
-
// marginLeft: direction === "ltr" && 0,
|
|
39
|
-
// marginRight: direction === "rtl" && 0
|
|
40
|
-
// })
|
|
41
|
-
// })
|
|
42
|
-
// );
|
|
43
|
-
|
|
44
|
-
// const AppBar = styled(MuiAppBar, {
|
|
45
|
-
// shouldForwardProp: (prop) => prop !== "open"
|
|
46
|
-
// })(({ theme, open, direction }) => ({
|
|
47
|
-
// transition: theme.transitions.create(["margin", "width"], {
|
|
48
|
-
// easing: theme.transitions.easing.sharp,
|
|
49
|
-
// duration: theme.transitions.duration.leavingScreen
|
|
50
|
-
// }),
|
|
51
|
-
// ...(open && {
|
|
52
|
-
// width: `calc(100% - ${drawerWidth}px)`,
|
|
53
|
-
// marginLeft: direction === "rtl" ? 0 : `${drawerWidth}px`,
|
|
54
|
-
// marginRight: direction === "rtl" ? `${drawerWidth}px` : 0,
|
|
55
|
-
// // marginLeft: `${drawerWidth}px`,
|
|
56
|
-
// transition: theme.transitions.create(["margin", "width"], {
|
|
57
|
-
// easing: theme.transitions.easing.easeOut,
|
|
58
|
-
// duration: theme.transitions.duration.enteringScreen
|
|
59
|
-
// })
|
|
60
|
-
// })
|
|
61
|
-
// }));
|
|
62
|
-
|
|
63
|
-
// const DrawerHeader = styled("div")(({ theme }) => ({
|
|
64
|
-
// display: "flex",
|
|
65
|
-
// alignItems: "center",
|
|
66
|
-
// padding: theme.spacing(0, 1),
|
|
67
|
-
// // necessary for content to be below app bar
|
|
68
|
-
// ...theme.mixins.toolbar,
|
|
69
|
-
// justifyContent: "flex-end"
|
|
70
|
-
// }));
|
|
71
|
-
|
|
72
|
-
// export const HawaAppLayout = (props) => {
|
|
73
|
-
// const theme = useTheme();
|
|
74
|
-
// const [open, setOpen] = React.useState(false);
|
|
75
|
-
// const isArabic = props.lang === "ar";
|
|
76
|
-
// const handleDrawerOpen = () => {
|
|
77
|
-
// setOpen(true);
|
|
78
|
-
// };
|
|
79
|
-
|
|
80
|
-
// const handleDrawerClose = () => {
|
|
81
|
-
// setOpen(false);
|
|
82
|
-
// };
|
|
83
|
-
|
|
84
|
-
// return (
|
|
85
|
-
// <Box sx={{ display: "flex" }}>
|
|
86
|
-
// <CssBaseline />
|
|
87
|
-
// <AppBar
|
|
88
|
-
// position="fixed"
|
|
89
|
-
// open={open}
|
|
90
|
-
// direction={isArabic ? "rtl" : "ltr"}
|
|
91
|
-
// style={{
|
|
92
|
-
// alignItems: isArabic ? "flex-end" : "flex-start",
|
|
93
|
-
// justifyContent: "center"
|
|
94
|
-
// }}
|
|
95
|
-
// >
|
|
96
|
-
// <Toolbar>
|
|
97
|
-
// {isArabic ? (
|
|
98
|
-
// <>
|
|
99
|
-
// <Typography variant="h6" noWrap component="div">
|
|
100
|
-
// Persistent drawer
|
|
101
|
-
// </Typography>
|
|
102
|
-
// <IconButton
|
|
103
|
-
// color="inherit"
|
|
104
|
-
// aria-label="open drawer"
|
|
105
|
-
// onClick={handleDrawerOpen}
|
|
106
|
-
// edge={isArabic ? "end" : "start"}
|
|
107
|
-
// sx={{ mr: 2, ...(open && { display: "none" }) }}
|
|
108
|
-
// >
|
|
109
|
-
// <MenuIcon />
|
|
110
|
-
// </IconButton>
|
|
111
|
-
// </>
|
|
112
|
-
// ) : (
|
|
113
|
-
// <>
|
|
114
|
-
// <IconButton
|
|
115
|
-
// color="inherit"
|
|
116
|
-
// aria-label="open drawer"
|
|
117
|
-
// onClick={handleDrawerOpen}
|
|
118
|
-
// edge={isArabic ? "end" : "start"}
|
|
119
|
-
// sx={{
|
|
120
|
-
// marginRight: isArabic ? 0 : 2,
|
|
121
|
-
// marginLeft: isArabic ? 2 : 0,
|
|
122
|
-
// ...(open && { display: "none" })
|
|
123
|
-
// }}
|
|
124
|
-
// >
|
|
125
|
-
// <MenuIcon />
|
|
126
|
-
// </IconButton>
|
|
127
|
-
// <Typography variant="h6" noWrap component="div">
|
|
128
|
-
// Persistent drawer
|
|
129
|
-
// </Typography>
|
|
130
|
-
// </>
|
|
131
|
-
// )}
|
|
132
|
-
// </Toolbar>
|
|
133
|
-
// </AppBar>
|
|
134
|
-
// {!isArabic ? (
|
|
135
|
-
// <>
|
|
136
|
-
// <Drawer
|
|
137
|
-
// sx={{
|
|
138
|
-
// width: drawerWidth,
|
|
139
|
-
// flexShrink: 0,
|
|
140
|
-
// "& .MuiDrawer-paper": {
|
|
141
|
-
// width: drawerWidth,
|
|
142
|
-
// boxSizing: "border-box"
|
|
143
|
-
// }
|
|
144
|
-
// }}
|
|
145
|
-
// variant="persistent"
|
|
146
|
-
// anchor={isArabic ? "right" : "left"}
|
|
147
|
-
// open={open}
|
|
148
|
-
// >
|
|
149
|
-
// <DrawerHeader>
|
|
150
|
-
// <IconButton onClick={handleDrawerClose}>
|
|
151
|
-
// {theme.direction === "ltr" ? (
|
|
152
|
-
// <ChevronLeftIcon />
|
|
153
|
-
// ) : (
|
|
154
|
-
// <ChevronRightIcon />
|
|
155
|
-
// )}
|
|
156
|
-
// </IconButton>
|
|
157
|
-
// </DrawerHeader>
|
|
158
|
-
// <Divider />
|
|
159
|
-
// <List>
|
|
160
|
-
// {["Inbox", "Starred", "Send email", "Drafts"].map(
|
|
161
|
-
// (text, index) => (
|
|
162
|
-
// <ListItem button key={text}>
|
|
163
|
-
// <ListItemIcon>
|
|
164
|
-
// {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
|
165
|
-
// </ListItemIcon>
|
|
166
|
-
// <ListItemText primary={text} />
|
|
167
|
-
// </ListItem>
|
|
168
|
-
// )
|
|
169
|
-
// )}
|
|
170
|
-
// </List>
|
|
171
|
-
// <Divider />
|
|
172
|
-
// <List>
|
|
173
|
-
// {["All mail", "Trash", "Spam"].map((text, index) => (
|
|
174
|
-
// <ListItem button key={text}>
|
|
175
|
-
// <ListItemIcon>
|
|
176
|
-
// {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
|
177
|
-
// </ListItemIcon>
|
|
178
|
-
// <ListItemText primary={text} />
|
|
179
|
-
// </ListItem>
|
|
180
|
-
// ))}
|
|
181
|
-
// </List>
|
|
182
|
-
// </Drawer>
|
|
183
|
-
// <Main open={open} direction={isArabic ? "rtl" : "ltr"}>
|
|
184
|
-
// <DrawerHeader />
|
|
185
|
-
// {props.children}
|
|
186
|
-
// </Main>
|
|
187
|
-
// </>
|
|
188
|
-
// ) : (
|
|
189
|
-
// <>
|
|
190
|
-
// <Main open={open} direction={isArabic ? "rtl" : "ltr"}>
|
|
191
|
-
// <DrawerHeader />
|
|
192
|
-
// {props.children}
|
|
193
|
-
// </Main>
|
|
194
|
-
// <Drawer
|
|
195
|
-
// sx={{
|
|
196
|
-
// width: drawerWidth,
|
|
197
|
-
// flexShrink: 0,
|
|
198
|
-
// "& .MuiDrawer-paper": {
|
|
199
|
-
// width: drawerWidth,
|
|
200
|
-
// boxSizing: "border-box"
|
|
201
|
-
// }
|
|
202
|
-
// }}
|
|
203
|
-
// variant="persistent"
|
|
204
|
-
// anchor={isArabic ? "right" : "left"}
|
|
205
|
-
// open={open}
|
|
206
|
-
// >
|
|
207
|
-
// <DrawerHeader>
|
|
208
|
-
// <IconButton onClick={handleDrawerClose}>
|
|
209
|
-
// {theme.direction === "ltr" ? (
|
|
210
|
-
// <ChevronLeftIcon />
|
|
211
|
-
// ) : (
|
|
212
|
-
// <ChevronRightIcon />
|
|
213
|
-
// )}
|
|
214
|
-
// </IconButton>
|
|
215
|
-
// </DrawerHeader>
|
|
216
|
-
// <Divider />
|
|
217
|
-
// <List>
|
|
218
|
-
// {["Inbox", "Starred", "Send email", "Drafts"].map(
|
|
219
|
-
// (text, index) => (
|
|
220
|
-
// <ListItem button key={text}>
|
|
221
|
-
// <ListItemIcon>
|
|
222
|
-
// {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
|
223
|
-
// </ListItemIcon>
|
|
224
|
-
// <ListItemText primary={text} />
|
|
225
|
-
// </ListItem>
|
|
226
|
-
// )
|
|
227
|
-
// )}
|
|
228
|
-
// </List>
|
|
229
|
-
// <Divider />
|
|
230
|
-
// <List>
|
|
231
|
-
// {["All mail", "Trash", "Spam"].map((text, index) => (
|
|
232
|
-
// <ListItem button key={text}>
|
|
233
|
-
// <ListItemIcon>
|
|
234
|
-
// {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
|
235
|
-
// </ListItemIcon>
|
|
236
|
-
// <ListItemText primary={text} />
|
|
237
|
-
// </ListItem>
|
|
238
|
-
// ))}
|
|
239
|
-
// </List>
|
|
240
|
-
// </Drawer>
|
|
241
|
-
// </>
|
|
242
|
-
// )}
|
|
243
|
-
// </Box>
|
|
244
|
-
// );
|
|
245
|
-
// };
|