@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.
Files changed (174) hide show
  1. package/dist/styles.css +279 -211
  2. package/es/index.es.js +1 -1
  3. package/lib/index.js +1 -1
  4. package/package.json +18 -6
  5. package/rollup.config.js +14 -2
  6. package/src/blocks/Account/{UserProfileForm.js → UserProfileForm.tsx} +42 -41
  7. package/src/blocks/Account/UserSettingsForm.tsx +28 -0
  8. package/src/blocks/Account/index.ts +2 -0
  9. package/src/blocks/AuthForms/AppLanding.tsx +33 -0
  10. package/src/blocks/AuthForms/CodeConfirmation.tsx +59 -0
  11. package/src/blocks/AuthForms/{NewPasswordForm.js → NewPasswordForm.tsx} +49 -53
  12. package/src/blocks/AuthForms/{ResetPasswordForm.js → ResetPasswordForm.tsx} +35 -38
  13. package/src/blocks/AuthForms/{SignInForm.js → SignInForm.tsx} +73 -65
  14. package/src/blocks/AuthForms/SignInPhone.tsx +68 -0
  15. package/src/blocks/AuthForms/{SignUpForm.js → SignUpForm.tsx} +88 -82
  16. package/src/blocks/AuthForms/index.ts +7 -0
  17. package/src/blocks/Misc/NotFound.tsx +28 -0
  18. package/src/blocks/Misc/index.ts +1 -0
  19. package/src/blocks/Payment/ChargeWalletForm.tsx +70 -0
  20. package/src/blocks/Payment/{CheckoutForm.js → CheckoutForm.tsx} +82 -81
  21. package/src/blocks/Payment/Confirmation.tsx +96 -0
  22. package/src/blocks/Payment/{CreditCardForm.js → CreditCardForm.tsx} +48 -33
  23. package/src/blocks/Payment/PayWithWallet.tsx +29 -0
  24. package/src/blocks/Payment/{SelectPayment.js → SelectPayment.tsx} +33 -29
  25. package/src/blocks/Payment/{index.js → index.ts} +0 -0
  26. package/src/blocks/Pricing/{ComparingPlans.js → ComparingPlans.tsx} +51 -53
  27. package/src/blocks/Pricing/PricingPlans.tsx +72 -0
  28. package/src/blocks/Pricing/{index.js → index.ts} +0 -0
  29. package/src/blocks/{index.js → index.ts} +0 -0
  30. package/{countries.js → src/countries.ts} +245 -245
  31. package/src/elements/{AutoCompleteField.js → AutoCompleteField.tsx} +16 -9
  32. package/src/elements/{DragDropImages.js → DragDropImages.tsx} +78 -53
  33. package/src/elements/DraggableCard.tsx +29 -0
  34. package/src/elements/{HawaAccordian.js → HawaAccordian.tsx} +27 -23
  35. package/src/elements/HawaAdCard.tsx +48 -0
  36. package/src/elements/HawaAlert.tsx +30 -0
  37. package/src/elements/HawaButton.tsx +120 -0
  38. package/src/elements/HawaCheckbox.tsx +37 -0
  39. package/src/elements/HawaChip.tsx +12 -0
  40. package/src/elements/HawaColorPicker.tsx +38 -0
  41. package/src/elements/{HawaCopyrights.js → HawaCopyrights.tsx} +15 -8
  42. package/src/elements/HawaDrawer.tsx +84 -0
  43. package/src/elements/{HawaDrawerItem.js → HawaDrawerItem.tsx} +12 -7
  44. package/src/elements/{HawaItemCard.js → HawaItemCard.tsx} +35 -36
  45. package/src/elements/{HawaLogoButton.js → HawaLogoButton.tsx} +52 -56
  46. package/src/elements/HawaMenu.tsx +75 -0
  47. package/src/elements/{HawaModal.js → HawaModal.tsx} +30 -21
  48. package/src/elements/{HawaPanelTabs.js → HawaPanelTabs.tsx} +27 -27
  49. package/src/elements/HawaPhoneInput.tsx +112 -0
  50. package/src/elements/{HawaPricingCard.js → HawaPricingCard.tsx} +86 -47
  51. package/src/elements/HawaRadio.tsx +34 -0
  52. package/src/elements/HawaRange.tsx +47 -0
  53. package/src/elements/HawaSearchBar.tsx +9 -0
  54. package/src/elements/{HawaSelect.js → HawaSelect.tsx} +74 -31
  55. package/src/elements/HawaSettingsRow.tsx +56 -0
  56. package/src/elements/HawaSnackbar.tsx +73 -0
  57. package/src/elements/HawaSwitch.tsx +25 -0
  58. package/src/elements/{HawaTable.js → HawaTable.tsx} +33 -31
  59. package/src/elements/{HawaTabs.js → HawaTabs.tsx} +17 -12
  60. package/src/elements/HawaTextField.tsx +71 -0
  61. package/src/elements/HawaTooltip.tsx +35 -0
  62. package/src/elements/HawaTypography.tsx +11 -0
  63. package/src/elements/{TabPanel.js → TabPanel.tsx} +10 -5
  64. package/src/elements/{index.js → index.ts} +7 -4
  65. package/src/index.ts +3 -0
  66. package/src/layout/Box.tsx +5 -0
  67. package/src/layout/HawaBottomAppBar.tsx +54 -0
  68. package/src/layout/HawaContainer.tsx +24 -0
  69. package/src/layout/{HawaLayout.js → HawaLayout.tsx} +54 -49
  70. package/src/layout/{index.js → index.ts} +0 -0
  71. package/src/styles.css +279 -211
  72. package/src/{util.js → util.ts} +0 -0
  73. package/storybook-static/229.a3257e00.iframe.bundle.js +1 -0
  74. package/storybook-static/229.d6fb4f8f665962cef844.manager.bundle.js +1 -0
  75. package/storybook-static/295.67c251ec00675ab59b60.manager.bundle.js +1 -0
  76. package/storybook-static/51.786e9bbba427ee454dc0.manager.bundle.js +2 -0
  77. package/storybook-static/{0.1104ca18.iframe.bundle.js.LICENSE.txt → 51.786e9bbba427ee454dc0.manager.bundle.js.LICENSE.txt} +0 -0
  78. package/storybook-static/51.acbbdb95.iframe.bundle.js +2 -0
  79. package/storybook-static/{0.cf71f8aa82edef0a7186.manager.bundle.js.LICENSE.txt → 51.acbbdb95.iframe.bundle.js.LICENSE.txt} +0 -0
  80. package/storybook-static/551.67cd309b0648b0a52636.manager.bundle.js +1 -0
  81. package/storybook-static/551.c82ea8f1.iframe.bundle.js +1 -0
  82. package/storybook-static/701.bcf1e718.iframe.bundle.js +1 -0
  83. package/storybook-static/733.8d2de9f8.iframe.bundle.js +2 -0
  84. package/storybook-static/{vendors~main.a40572d0.iframe.bundle.js.LICENSE.txt → 733.8d2de9f8.iframe.bundle.js.LICENSE.txt} +0 -10
  85. package/storybook-static/767.2f9c96fa3338c8d16078.manager.bundle.js +2 -0
  86. package/storybook-static/{vendors~main.d13ba71108048897ea4a.manager.bundle.js.LICENSE.txt → 767.2f9c96fa3338c8d16078.manager.bundle.js.LICENSE.txt} +0 -10
  87. package/storybook-static/807.14b8bfa7.iframe.bundle.js +2 -0
  88. package/storybook-static/{5.5b799f3fbf64cec8e51a.manager.bundle.js.LICENSE.txt → 807.14b8bfa7.iframe.bundle.js.LICENSE.txt} +0 -0
  89. package/storybook-static/807.4f52b2d047c5e8c5872f.manager.bundle.js +2 -0
  90. package/storybook-static/{6.6023eba1.iframe.bundle.js.LICENSE.txt → 807.4f52b2d047c5e8c5872f.manager.bundle.js.LICENSE.txt} +0 -0
  91. package/storybook-static/897.386c170cbd1467abc7ca.manager.bundle.js +2 -0
  92. package/storybook-static/{8.f9b98ef3e089be1a16d6.manager.bundle.js.LICENSE.txt → 897.386c170cbd1467abc7ca.manager.bundle.js.LICENSE.txt} +0 -0
  93. package/storybook-static/897.d9a35fd0.iframe.bundle.js +2 -0
  94. package/storybook-static/{9.63a5cf7a.iframe.bundle.js.LICENSE.txt → 897.d9a35fd0.iframe.bundle.js.LICENSE.txt} +0 -0
  95. package/storybook-static/935.07c1b6ea.iframe.bundle.js +1 -0
  96. package/storybook-static/935.0b4e9c201c33f3e66e81.manager.bundle.js +1 -0
  97. package/storybook-static/iframe.html +1 -1
  98. package/storybook-static/index.html +1 -1
  99. package/storybook-static/main.051275cac7b0dc69501c.manager.bundle.js +1 -0
  100. package/storybook-static/main.71507dcb.iframe.bundle.js +1 -0
  101. package/storybook-static/project.json +1 -1
  102. package/storybook-static/runtime~main.25eae181fe0f96887a15.manager.bundle.js +1 -0
  103. package/storybook-static/runtime~main.4d0bf318.iframe.bundle.js +1 -0
  104. package/tailwind.config.js +16 -1
  105. package/tsconfig.json +25 -0
  106. package/src/blocks/Account/UserSettingsForm.js +0 -17
  107. package/src/blocks/Account/index.js +0 -2
  108. package/src/blocks/AuthForms/AppLanding.js +0 -40
  109. package/src/blocks/AuthForms/CodeConfirmation.js +0 -78
  110. package/src/blocks/AuthForms/SignInPhone.js +0 -38
  111. package/src/blocks/AuthForms/index.js +0 -7
  112. package/src/blocks/Misc/NotFound.js +0 -32
  113. package/src/blocks/Misc/index.js +0 -1
  114. package/src/blocks/Payment/ChargeWalletForm.js +0 -81
  115. package/src/blocks/Payment/Confirmation.js +0 -104
  116. package/src/blocks/Payment/Form/CForm.js +0 -316
  117. package/src/blocks/Payment/Form/Card.js +0 -242
  118. package/src/blocks/Payment/Form/PaymentMethod.js +0 -118
  119. package/src/blocks/Payment/Gateway/GooglePay.js +0 -251
  120. package/src/blocks/Payment/Gateway/Payfort.js +0 -90
  121. package/src/blocks/Payment/Gateway/Paypal.js +0 -138
  122. package/src/blocks/Payment/Gateway/Wallet.js +0 -148
  123. package/src/blocks/Payment/PayWithWallet.js +0 -20
  124. package/src/blocks/Pricing/PricingPlans.js +0 -88
  125. package/src/elements/DraggableCard.js +0 -24
  126. package/src/elements/HawaAlert.js +0 -41
  127. package/src/elements/HawaButton.js +0 -62
  128. package/src/elements/HawaCheckbox.js +0 -28
  129. package/src/elements/HawaChip.js +0 -9
  130. package/src/elements/HawaColorPicker.js +0 -57
  131. package/src/elements/HawaDrawer.js +0 -68
  132. package/src/elements/HawaMenu.js +0 -71
  133. package/src/elements/HawaPhoneInput.js +0 -106
  134. package/src/elements/HawaRadio.js +0 -31
  135. package/src/elements/HawaRange.js +0 -54
  136. package/src/elements/HawaSearchBar.js +0 -15
  137. package/src/elements/HawaSettingsRow.js +0 -34
  138. package/src/elements/HawaSnackbar.js +0 -44
  139. package/src/elements/HawaSwitch.js +0 -21
  140. package/src/elements/HawaTextField.js +0 -34
  141. package/src/elements/HawaTooltip.js +0 -19
  142. package/src/elements/HawaTypography.js +0 -5
  143. package/src/elements/PinInput.js +0 -141
  144. package/src/elements/SelectedField.js +0 -46
  145. package/src/index.js +0 -3
  146. package/src/layout/Box.js +0 -5
  147. package/src/layout/HawaAppLayout.js +0 -245
  148. package/src/layout/HawaAppLayout2.js +0 -254
  149. package/src/layout/HawaBottomAppBar.js +0 -76
  150. package/src/layout/HawaContainer.js +0 -8
  151. package/storybook-static/0.1104ca18.iframe.bundle.js +0 -3
  152. package/storybook-static/0.1104ca18.iframe.bundle.js.map +0 -1
  153. package/storybook-static/0.cf71f8aa82edef0a7186.manager.bundle.js +0 -2
  154. package/storybook-static/1.7e6ec5c45ae5b70c5149.manager.bundle.js +0 -1
  155. package/storybook-static/1.e3eafd38.iframe.bundle.js +0 -1
  156. package/storybook-static/2.3841b1a5.iframe.bundle.js +0 -1
  157. package/storybook-static/5.5b799f3fbf64cec8e51a.manager.bundle.js +0 -2
  158. package/storybook-static/6.6023eba1.iframe.bundle.js +0 -3
  159. package/storybook-static/6.6023eba1.iframe.bundle.js.map +0 -1
  160. package/storybook-static/6.b34ce31193a7fa1dd965.manager.bundle.js +0 -1
  161. package/storybook-static/7.632f8551.iframe.bundle.js +0 -1
  162. package/storybook-static/7.72879af713f755a7aa7e.manager.bundle.js +0 -1
  163. package/storybook-static/8.9a8f8b69.iframe.bundle.js +0 -1
  164. package/storybook-static/8.f9b98ef3e089be1a16d6.manager.bundle.js +0 -2
  165. package/storybook-static/9.1e1335092fade49cc986.manager.bundle.js +0 -1
  166. package/storybook-static/9.63a5cf7a.iframe.bundle.js +0 -3
  167. package/storybook-static/9.63a5cf7a.iframe.bundle.js.map +0 -1
  168. package/storybook-static/main.4bd27e4e7faa098302d1.manager.bundle.js +0 -1
  169. package/storybook-static/main.ea9904c2.iframe.bundle.js +0 -1
  170. package/storybook-static/runtime~main.67ec6e92.iframe.bundle.js +0 -1
  171. package/storybook-static/runtime~main.a58df7ba92d01c5088d3.manager.bundle.js +0 -1
  172. package/storybook-static/vendors~main.a40572d0.iframe.bundle.js +0 -3
  173. package/storybook-static/vendors~main.a40572d0.iframe.bundle.js.map +0 -1
  174. package/storybook-static/vendors~main.d13ba71108048897ea4a.manager.bundle.js +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.95",
3
+ "version": "0.0.96",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -14,7 +14,7 @@
14
14
  "build-lib": "rollup -c",
15
15
  "build:styles": " node tools/build-styles"
16
16
  },
17
- "author": "SIKKA SOFTWARE",
17
+ "author": "Sikka Software",
18
18
  "license": "MIT",
19
19
  "devDependencies": {
20
20
  "@babel/core": "^7.12.10",
@@ -28,18 +28,25 @@
28
28
  "@storybook/addon-links": "^6.5.8",
29
29
  "@storybook/addon-postcss": "^2.0.0",
30
30
  "@storybook/addons": "^6.5.8",
31
+ "@storybook/builder-webpack5": "^6.5.13",
32
+ "@storybook/manager-webpack5": "^6.5.13",
31
33
  "@storybook/react": "^6.5.8",
32
34
  "@storybook/storybook-deployer": "^2.8.11",
33
35
  "@storybook/theming": "^6.5.8",
36
+ "@types/react": "^18.0.25",
37
+ "@types/react-dom": "^18.0.9",
34
38
  "babel-loader": "^8.2.2",
35
39
  "clsx": "^1.2.1",
36
40
  "crypto-js": "^4.1.1",
37
41
  "emotion-theming": "^11.0.0",
38
42
  "framer-motion": "^4.1.7",
43
+ "html-webpack-plugin": "^5.5.0",
39
44
  "next-scripts": "^0.3.4",
40
45
  "postcss": "^8.4.18",
41
46
  "postcss-cli": "^10.0.0",
42
47
  "postcss-focus-visible": "^7.1.0",
48
+ "prettier": "^2.7.1",
49
+ "prettier-plugin-tailwindcss": "^0.1.13",
43
50
  "qs": "^6.10.3",
44
51
  "react": ">=17.0.1",
45
52
  "react-color": "^2.19.3",
@@ -55,7 +62,10 @@
55
62
  "rollup-plugin-postcss": "^4.0.0",
56
63
  "rollup-plugin-terser": "^7.0.2",
57
64
  "tailwindcss": "^3.2.1",
58
- "tinycolor2": "^1.4.2"
65
+ "tinycolor2": "^1.4.2",
66
+ "tslib": "^2.4.1",
67
+ "typescript": "^4.8.4",
68
+ "webpack": "^5.75.0"
59
69
  },
60
70
  "peerDependencies": {
61
71
  "crypto-js": "^4.1.1",
@@ -75,11 +85,13 @@
75
85
  "@storybook/react/webpack": "^5",
76
86
  "@storybook/core-common/webpack": "^5",
77
87
  "@storybook/core-server/webpack": "^5",
78
- "@storybook/builder-webpack4/webpack": "^5",
79
- "@storybook/manager-webpack4/webpack": "^5"
88
+ "@storybook/builder-webpack5/webpack": "^5",
89
+ "@storybook/manager-webpack5/webpack": "^5"
80
90
  },
81
91
  "dependencies": {
82
92
  "react-dropzone": "^12.0.4",
83
- "react-icons": "^4.6.0"
93
+ "react-icons": "^4.6.0",
94
+ "rollup-plugin-swc": "^0.2.1",
95
+ "rollup-plugin-typescript2": "^0.34.1"
84
96
  }
85
97
  }
package/rollup.config.js CHANGED
@@ -4,10 +4,12 @@ import babel from "rollup-plugin-babel";
4
4
  import external from "rollup-plugin-peer-deps-external";
5
5
  import { terser } from "rollup-plugin-terser";
6
6
  import postcss from "rollup-plugin-postcss";
7
+ import typescript from "rollup-plugin-typescript2";
8
+ import swc from "rollup-plugin-swc";
7
9
 
8
10
  export default [
9
11
  {
10
- input: "src/index.js",
12
+ input: "src/index.ts",
11
13
  output: [
12
14
  { file: "lib/index.js", format: "cjs" },
13
15
  { file: "es/index.es.js", format: "es", exports: "named" }
@@ -22,8 +24,18 @@ export default [
22
24
  ]
23
25
  }),
24
26
  external(),
25
- resolve(),
27
+ resolve({
28
+ extensions: [".tsx", ".ts"]
29
+ }),
30
+ typescript({ tsconfig: "./tsconfig.json" }),
26
31
  terser(),
32
+ swc({
33
+ jsc: {
34
+ parser: {
35
+ syntax: "typescript"
36
+ }
37
+ }
38
+ }),
27
39
  commonjs()
28
40
  ]
29
41
  }
@@ -1,16 +1,24 @@
1
- import React from "react";
2
- import { HawaButton, HawaTextField } from "../../elements";
3
- import { Controller, FormProvider, useForm } from "react-hook-form";
4
- import { HawaContainer } from "../../layout";
1
+ import React from "react"
2
+ import { HawaButton, HawaTextField } from "../../elements"
3
+ import { Controller, FormProvider, useForm } from "react-hook-form"
4
+ import { HawaContainer } from "../../layout"
5
5
 
6
- export const UserProfileForm = (props) => {
7
- const methods = useForm();
8
- const { inputs } = props;
6
+ type UserProfileFormTypes = {
7
+ inputs: any
8
+ texts: any
9
+ handleUpdateProfile: any
10
+ }
11
+
12
+ export const UserProfileForm: React.FunctionComponent<UserProfileFormTypes> = (
13
+ props
14
+ ) => {
15
+ const methods = useForm()
16
+ const { inputs } = props
9
17
  const {
10
18
  formState: { errors },
11
19
  handleSubmit,
12
- control
13
- } = methods;
20
+ control,
21
+ } = methods
14
22
 
15
23
  return (
16
24
  <HawaContainer>
@@ -22,13 +30,13 @@ export const UserProfileForm = (props) => {
22
30
  name="fullName"
23
31
  render={({ field }) => (
24
32
  <HawaTextField
25
- fullWidth
33
+ width="full"
26
34
  type="text"
27
- value={field.value ?? ""}
28
35
  label={props.texts.fullNameLabel}
29
36
  placeholder={props.texts.fullNamePlaceholder}
30
37
  helperText={errors.fullName?.message}
31
38
  {...field}
39
+ value={field.value ?? ""}
32
40
  />
33
41
  )}
34
42
  />
@@ -37,7 +45,7 @@ export const UserProfileForm = (props) => {
37
45
  name="phoneNumber"
38
46
  render={({ field }) => (
39
47
  <HawaTextField
40
- fullWidth
48
+ width="full"
41
49
  type="tel"
42
50
  label="Phone Number"
43
51
  placeholder="+966"
@@ -50,13 +58,13 @@ export const UserProfileForm = (props) => {
50
58
  name="email"
51
59
  render={({ field }) => (
52
60
  <HawaTextField
53
- fullWidth
61
+ width="full"
54
62
  type="text"
55
- value={field.value ?? ""}
56
63
  label={props.texts.emailLabel}
57
64
  helperText={errors.email?.message}
58
65
  placeholder={props.texts.emailPlaceholder}
59
66
  {...field}
67
+ value={field.value ?? ""}
60
68
  />
61
69
  )}
62
70
  rules={{
@@ -64,8 +72,8 @@ export const UserProfileForm = (props) => {
64
72
  pattern: {
65
73
  value:
66
74
  /^(([^<>()[\]\\.,;:\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,}))$/,
67
- message: props.texts.emailInvalidText
68
- }
75
+ message: props.texts.emailInvalidText,
76
+ },
69
77
  }}
70
78
  />
71
79
  <Controller
@@ -73,17 +81,17 @@ export const UserProfileForm = (props) => {
73
81
  name="password"
74
82
  render={({ field }) => (
75
83
  <HawaTextField
76
- fullWidth
84
+ width="full"
77
85
  type="password"
78
- value={field.value ?? ""}
79
86
  label={props.texts.passwordLabel}
80
87
  placeholder={props.texts.passwordPlaceholder}
81
88
  helperText={errors.password?.message}
82
89
  {...field}
90
+ value={field.value ?? ""}
83
91
  />
84
92
  )}
85
93
  rules={{
86
- required: props.texts.passwordRequiredText
94
+ required: props.texts.passwordRequiredText,
87
95
  }}
88
96
  />
89
97
  <Controller
@@ -91,21 +99,21 @@ export const UserProfileForm = (props) => {
91
99
  name="confirmPassword"
92
100
  render={({ field }) => (
93
101
  <HawaTextField
94
- fullWidth
102
+ width="full"
95
103
  type="password"
96
- value={field.value ?? ""}
97
104
  label={props.texts.confirmPasswordLabel}
98
105
  placeholder={props.texts.confirmPasswordPlaceholder}
99
106
  helperText={errors.confirmPassword?.message}
100
107
  {...field}
108
+ value={field.value ?? ""}
101
109
  />
102
110
  )}
103
111
  rules={{
104
- required: props.texts.confirmPasswordRequiredText
112
+ required: props.texts.confirmPasswordRequiredText,
105
113
  }}
106
114
  />
107
115
  {inputs.length > 0 &&
108
- inputs.map((singleInput) => {
116
+ inputs.map((singleInput: any) => {
109
117
  if (singleInput.type === "textArea") {
110
118
  return (
111
119
  <Controller
@@ -113,16 +121,16 @@ export const UserProfileForm = (props) => {
113
121
  name={singleInput.name}
114
122
  render={({ field }) => (
115
123
  <HawaTextField
116
- fullWidth
124
+ width="full"
117
125
  type="text"
118
126
  defaultValue={singleInput.defaultValue ?? null}
119
127
  label={singleInput.label ?? null}
120
128
  placeholder={singleInput.placeHolder ?? null}
121
- rules={singleInput.rules ?? null}
122
129
  />
123
130
  )}
131
+ rules={singleInput.rules ?? null}
124
132
  />
125
- );
133
+ )
126
134
  }
127
135
  return (
128
136
  <Controller
@@ -130,30 +138,23 @@ export const UserProfileForm = (props) => {
130
138
  name={singleInput.name}
131
139
  render={({ field }) => (
132
140
  <HawaTextField
133
- fullWidth
141
+ width="full"
134
142
  type={singleInput.type}
135
143
  defaultValue={singleInput.defaultValue ?? null}
136
144
  label={singleInput.label ?? null}
137
145
  placeholder={singleInput.placeHolder ?? null}
138
- rules={singleInput.rules ?? null}
139
146
  />
140
147
  )}
148
+ rules={singleInput.rules ?? null}
141
149
  />
142
- );
150
+ )
143
151
  })}
144
152
 
145
- <HawaButton
146
- fullWidth
147
- type="submit"
148
- text={props.texts.updateProfile}
149
- />
153
+ <HawaButton color="primary" width="full" type="submit">
154
+ {props.texts.updateProfile}
155
+ </HawaButton>
150
156
  </form>
151
157
  </FormProvider>
152
158
  </HawaContainer>
153
- );
154
- };
155
-
156
- // texts: PropTypes.shape({
157
- // emailLabel: PropTypes.string,
158
-
159
- // }),
159
+ )
160
+ }
@@ -0,0 +1,28 @@
1
+ import React from "react"
2
+ import { HawaButton } from "../../elements"
3
+ import { HawaContainer } from "../../layout"
4
+
5
+ type UserSettingsFormTypes = {
6
+ children: any
7
+ handleSaveSettings: any
8
+ saveSettingsText: string
9
+ }
10
+
11
+ export const UserSettingsForm: React.FunctionComponent<
12
+ UserSettingsFormTypes
13
+ > = (props) => {
14
+ return (
15
+ <HawaContainer>
16
+ {" "}
17
+ {props.children}
18
+ <HawaButton
19
+ color="primary"
20
+ type="submit"
21
+ width="full"
22
+ onClick={props.handleSaveSettings}
23
+ >
24
+ {props.saveSettingsText}
25
+ </HawaButton>
26
+ </HawaContainer>
27
+ )
28
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./UserProfileForm";
2
+ export * from "./UserSettingsForm";
@@ -0,0 +1,33 @@
1
+ import React from "react"
2
+ import { HawaButton } from "../../elements"
3
+ import { HawaContainer } from "../../layout/HawaContainer"
4
+
5
+ type AppLandingTypes = {
6
+ handleSignIn: any
7
+ handleSignUp: any
8
+ handleLanguage: any
9
+ texts: {
10
+ signIn: string
11
+ signUp: string
12
+ lang: string
13
+ }
14
+ }
15
+ export const AppLanding: React.FunctionComponent<AppLandingTypes> = (props) => {
16
+ return (
17
+ <HawaContainer>
18
+ {props.handleSignIn && (
19
+ <HawaButton color="primary" width="full" onClick={props.handleSignIn}>
20
+ {props.texts.signIn}
21
+ </HawaButton>
22
+ )}
23
+ {props.handleSignUp && (
24
+ <HawaButton color="primary" width="full" onClick={props.handleSignUp}>
25
+ {props.texts.signUp}
26
+ </HawaButton>
27
+ )}
28
+ <HawaButton color="primary" width="full" onClick={props.handleLanguage}>
29
+ {props.texts.lang}
30
+ </HawaButton>
31
+ </HawaContainer>
32
+ )
33
+ }
@@ -0,0 +1,59 @@
1
+ import React from "react"
2
+ import { HawaTextField, HawaAlert, HawaButton } from "../../elements"
3
+ import { Controller, useForm } from "react-hook-form"
4
+ import { HawaContainer } from "../../layout"
5
+
6
+ type CodeConfirmationTypes = {
7
+ showError: any
8
+ errorTitle: any
9
+ errorText: any
10
+ texts: any
11
+ handleSignIn: any
12
+ }
13
+ export const CodeConfirmation: React.FunctionComponent<
14
+ CodeConfirmationTypes
15
+ > = (props) => {
16
+ const methods = useForm()
17
+ const {
18
+ formState: { errors },
19
+ handleSubmit,
20
+ control,
21
+ } = methods
22
+
23
+ return (
24
+ <HawaContainer>
25
+ {" "}
26
+ {props.showError && (
27
+ <HawaAlert
28
+ title={props.errorTitle}
29
+ text={props.errorText}
30
+ severity="error"
31
+ />
32
+ )}
33
+ <form onSubmit={handleSubmit(props.handleSignIn)}>
34
+ <Controller
35
+ control={control}
36
+ name="code"
37
+ render={({ field }) => (
38
+ <HawaTextField
39
+ width="full"
40
+ type="number"
41
+ label={props.texts.codeLabel}
42
+ helperText={errors.email?.message}
43
+ placeholder={props.texts.codePlaceholder}
44
+ {...field}
45
+ value={field.value ?? ""}
46
+ />
47
+ )}
48
+ rules={{
49
+ required: props.texts.codeRequiredText,
50
+ }}
51
+ />
52
+
53
+ <HawaButton color="primary" type="submit" width="full">
54
+ {props.texts.confirmText}
55
+ </HawaButton>
56
+ </form>
57
+ </HawaContainer>
58
+ )
59
+ }
@@ -1,26 +1,49 @@
1
- import React, { useState } from "react";
2
- import { HawaTextField, HawaAlert, HawaButton } from "../../elements";
3
- import { Controller, FormProvider, useForm } from "react-hook-form";
4
- import PropTypes from "prop-types";
5
- import { HawaContainer } from "../../layout";
1
+ import React, { useState } from "react"
2
+ import { HawaTextField, HawaAlert, HawaButton } from "../../elements"
3
+ import { Controller, FormProvider, useForm } from "react-hook-form"
4
+ import { HawaContainer } from "../../layout"
6
5
 
7
- export const NewPasswordForm = (props) => {
8
- const [matchError, setMatchError] = useState(false);
9
- const methods = useForm();
6
+ type NewPasswordTypes = {
7
+ handleNewPassword: any
8
+ passwordChanged: any
9
+ errorText: any
10
+ texts: {
11
+ emailLabel: string
12
+ emailPlaceholder: string
13
+ emailRequiredText: string
14
+ passwordPlaceholder: string
15
+ updatePassword: string
16
+ passwordRequiredText: string
17
+ passwordLabel: string
18
+ confirmPasswordPlaceholder: string
19
+ confirmPasswordLabel: string
20
+ confirmPasswordRequiredText: string
21
+ passwordMatchError: string
22
+ forgotPasswordText: string
23
+ passwordChanged: string
24
+ }
25
+ handleSignIn: any
26
+ }
27
+
28
+ export const NewPasswordForm: React.FunctionComponent<NewPasswordTypes> = (
29
+ props
30
+ ) => {
31
+ const [matchError, setMatchError] = useState(false)
32
+ const methods = useForm()
10
33
  const {
11
34
  formState: { errors },
12
35
  handleSubmit,
13
- control
14
- } = methods;
36
+ control,
37
+ } = methods
15
38
 
16
- const handleSubmission = (e) => {
17
- console.log("handling subb", e);
39
+ const handleSubmission = (e: any) => {
40
+ console.log("handling subb", e)
18
41
  if (e.password === e.confirmPassword) {
19
- props.handleNewPassword();
42
+ props.handleNewPassword()
20
43
  } else {
21
- setMatchError(true);
44
+ setMatchError(true)
22
45
  }
23
- };
46
+ }
24
47
 
25
48
  return (
26
49
  <HawaContainer>
@@ -38,17 +61,17 @@ export const NewPasswordForm = (props) => {
38
61
  name="password"
39
62
  render={({ field }) => (
40
63
  <HawaTextField
41
- fullWidth
64
+ width="full"
42
65
  type="password"
43
- value={field.value ?? ""}
44
66
  label={props.texts.passwordLabel}
45
67
  placeholder={props.texts.passwordPlaceholder}
46
68
  helperText={errors.password?.message}
47
69
  {...field}
70
+ value={field.value ?? ""}
48
71
  />
49
72
  )}
50
73
  rules={{
51
- required: props.texts.passwordRequiredText
74
+ required: props.texts.passwordRequiredText,
52
75
  }}
53
76
  />
54
77
  <Controller
@@ -56,53 +79,26 @@ export const NewPasswordForm = (props) => {
56
79
  name="confirmPassword"
57
80
  render={({ field }) => (
58
81
  <HawaTextField
59
- fullWidth
82
+ width="full"
60
83
  type="password"
61
- value={field.value ?? ""}
62
84
  label={props.texts.confirmPasswordLabel}
63
85
  placeholder={props.texts.confirmPasswordPlaceholder}
64
86
  helperText={errors.confirmPassword?.message}
65
87
  {...field}
88
+ value={field.value ?? ""}
66
89
  />
67
90
  )}
68
91
  rules={{
69
- required: props.texts.confirmPasswordRequiredText
92
+ required: props.texts.confirmPasswordRequiredText,
70
93
  }}
71
94
  />
72
95
 
73
- <HawaButton
74
- type="submit"
75
- fullWidth
76
- text={props.texts.updatePassword}
77
- />
96
+ <HawaButton color="primary" type="submit" width="full">
97
+ {props.texts.updatePassword}
98
+ </HawaButton>
78
99
  </form>
79
100
  </FormProvider>
80
101
  )}
81
102
  </HawaContainer>
82
- );
83
- };
84
- NewPasswordForm.propTypes = {
85
- /**
86
- * An object of all the texts in the blocks
87
- */
88
- texts: PropTypes.shape({
89
- emailLabel: PropTypes.string,
90
- emailPlaceholder: PropTypes.string,
91
- emailRequiredText: PropTypes.string,
92
- passwordPlaceholder: PropTypes.string,
93
- updatePassword: PropTypes.string,
94
- passwordRequiredText: PropTypes.string,
95
- passwordLabel: PropTypes.string,
96
- confirmPasswordPlaceholder: PropTypes.string,
97
- confirmPasswordLabel: PropTypes.string,
98
- confirmPasswordRequiredText: PropTypes.string,
99
- passwordMatchError: PropTypes.string,
100
- forgotPasswordText: PropTypes.string,
101
- passwordChanged: PropTypes.string
102
- }),
103
- /**
104
- * A boolean to replace the form with a success message
105
- */
106
- passwordChanged: PropTypes.bool,
107
- handleNewPassword: PropTypes.func
108
- };
103
+ )
104
+ }
@@ -1,17 +1,34 @@
1
- import React from "react";
2
- import { Controller, useForm } from "react-hook-form";
3
- import { HawaButton, HawaTextField } from "../../elements";
4
- import PropTypes from "prop-types";
5
- import { HawaContainer } from "../../layout";
1
+ import React from "react"
2
+ import { Controller, useForm } from "react-hook-form"
3
+ import { HawaButton, HawaTextField } from "../../elements"
4
+ import { HawaContainer } from "../../layout"
6
5
 
7
- export const ResetPasswordForm = (props) => {
8
- const methods = useForm();
6
+ type ResetPasswordType = {
7
+ handleResetPassword: any
8
+ passwordChanged: any
9
+ errorText: any
10
+ sent: any
11
+ handleSignIn: any
12
+ texts: {
13
+ emailLabel: string
14
+ emailPlaceholder: string
15
+ emailRequiredText: string
16
+ emailInvalidText: string
17
+ emailSentText: string
18
+ resetPassword: string
19
+ }
20
+ }
21
+
22
+ export const ResetPasswordForm: React.FunctionComponent<ResetPasswordType> = (
23
+ props
24
+ ) => {
25
+ const methods = useForm()
9
26
  const {
10
27
  formState: { errors },
11
28
  handleSubmit,
12
29
  register,
13
- control
14
- } = methods;
30
+ control,
31
+ } = methods
15
32
  return (
16
33
  <HawaContainer>
17
34
  {" "}
@@ -22,13 +39,13 @@ export const ResetPasswordForm = (props) => {
22
39
  name="email"
23
40
  render={({ field }) => (
24
41
  <HawaTextField
25
- fullWidth
42
+ width="full"
26
43
  type="text"
27
- value={field.value ?? ""}
28
44
  label={props.texts.emailLabel}
29
45
  helperText={errors.email?.message}
30
46
  placeholder={props.texts.emailPlaceholder}
31
47
  {...field}
48
+ value={field.value ?? ""}
32
49
  />
33
50
  )}
34
51
  rules={{
@@ -36,37 +53,17 @@ export const ResetPasswordForm = (props) => {
36
53
  pattern: {
37
54
  value:
38
55
  /^(([^<>()[\]\\.,;:\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,}))$/,
39
- message: props.texts.emailInvalidText
40
- }
56
+ message: props.texts.emailInvalidText,
57
+ },
41
58
  }}
42
59
  />
43
- <HawaButton
44
- fullWidth
45
- type="submit"
46
- text={props.texts.resetPassword}
47
- />{" "}
60
+ <HawaButton color="primary" width="full" type="submit">
61
+ {props.texts.resetPassword}
62
+ </HawaButton>
48
63
  </form>
49
64
  ) : (
50
65
  <div className="text-center">{props.texts.emailSentText}</div>
51
66
  )}
52
67
  </HawaContainer>
53
- );
54
- };
55
- ResetPasswordForm.propTypes = {
56
- /**
57
- * An object of all the texts in the blocks
58
- */
59
- texts: PropTypes.shape({
60
- emailLabel: PropTypes.string,
61
- emailPlaceholder: PropTypes.string,
62
- emailRequiredText: PropTypes.string,
63
- emailInvalidText: PropTypes.string,
64
- emailSentText: PropTypes.string,
65
- resetPassword: PropTypes.string
66
- }),
67
- /**
68
- * a boolean to replace the form with a success message
69
- */
70
- sent: PropTypes.bool,
71
- handleResetPassword: PropTypes.func
72
- };
68
+ )
69
+ }