@bloom-housing/ui-components 7.0.6 → 7.0.8-alpha.0

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.
@@ -1,25 +1,31 @@
1
- import React from "react"
2
- import { t, AlertBox, SiteAlert, AlertNotice, ErrorMessage } from "@bloom-housing/ui-components"
3
- import type { UseFormMethods } from "react-hook-form"
4
- import { NetworkStatus } from "./FormSignIn"
1
+ import React from "react";
2
+ import { t, AlertBox, SiteAlert, AlertNotice, ErrorMessage } from "../../..";
3
+ import type { UseFormMethods } from "react-hook-form";
4
+ import { NetworkStatus } from "./FormSignIn";
5
5
 
6
6
  export type FormSignInErrorBoxProps = {
7
- errors: FormSignInErrorBoxControl["errors"]
8
- networkStatus: NetworkStatus
9
- errorMessageId: string
10
- }
7
+ errors: FormSignInErrorBoxControl["errors"];
8
+ networkStatus: NetworkStatus;
9
+ errorMessageId: string;
10
+ };
11
11
 
12
12
  export type FormSignInErrorBoxControl = {
13
- errors: UseFormMethods["errors"]
14
- control: UseFormMethods["control"]
15
- }
13
+ errors: UseFormMethods["errors"];
14
+ control: UseFormMethods["control"];
15
+ };
16
16
 
17
- const FormSignInErrorBox = ({ networkStatus, errors, errorMessageId }: FormSignInErrorBoxProps) => {
17
+ const FormSignInErrorBox = ({
18
+ networkStatus,
19
+ errors,
20
+ errorMessageId,
21
+ }: FormSignInErrorBoxProps) => {
18
22
  return (
19
23
  <div className="border-b">
20
24
  {Object.entries(errors).length > 0 && !networkStatus.content && (
21
25
  <AlertBox type="alert" inverted closeable>
22
- {errors.authentication ? errors.authentication.message : t("errors.errorsToResolve")}
26
+ {errors.authentication
27
+ ? errors.authentication.message
28
+ : t("errors.errorsToResolve")}
23
29
  </AlertBox>
24
30
  )}
25
31
 
@@ -29,7 +35,11 @@ const FormSignInErrorBox = ({ networkStatus, errors, errorMessageId }: FormSignI
29
35
  error={!!networkStatus.content}
30
36
  className="block mt-0 leading-normal text-alert"
31
37
  >
32
- <AlertBox type={"alert"} inverted onClose={() => networkStatus.reset()}>
38
+ <AlertBox
39
+ type={"alert"}
40
+ inverted
41
+ onClose={() => networkStatus.reset()}
42
+ >
33
43
  {networkStatus.content.title}
34
44
  </AlertBox>
35
45
 
@@ -41,7 +51,11 @@ const FormSignInErrorBox = ({ networkStatus, errors, errorMessageId }: FormSignI
41
51
 
42
52
  {networkStatus.type === "success" && (
43
53
  <>
44
- <AlertBox type="success" inverted onClose={() => networkStatus.reset()}>
54
+ <AlertBox
55
+ type="success"
56
+ inverted
57
+ onClose={() => networkStatus.reset()}
58
+ >
45
59
  {networkStatus.content?.title}
46
60
  </AlertBox>
47
61
 
@@ -53,7 +67,7 @@ const FormSignInErrorBox = ({ networkStatus, errors, errorMessageId }: FormSignI
53
67
 
54
68
  <SiteAlert type="notice" dismissable />
55
69
  </div>
56
- )
57
- }
70
+ );
71
+ };
58
72
 
59
- export { FormSignInErrorBox as default, FormSignInErrorBox }
73
+ export { FormSignInErrorBox as default, FormSignInErrorBox };
@@ -1,4 +1,4 @@
1
- import React from "react"
1
+ import React from "react";
2
2
  import {
3
3
  AppearanceStyleType,
4
4
  Button,
@@ -9,8 +9,8 @@ import {
9
9
  t,
10
10
  SiteAlert,
11
11
  FormSignInErrorBox,
12
- } from "@bloom-housing/ui-components"
13
- import { NetworkStatus, FormSignInControl } from "./FormSignIn"
12
+ } from "../../..";
13
+ import { NetworkStatus, FormSignInControl } from "./FormSignIn";
14
14
 
15
15
  export enum RequestType {
16
16
  email = "email",
@@ -18,18 +18,18 @@ export enum RequestType {
18
18
  }
19
19
 
20
20
  export type FormSignInMFACodeProps = {
21
- control: FormSignInControl
22
- onSubmit: (data: FormSignInMFACodeValues) => void
23
- networkError: NetworkStatus
24
- mfaType: RequestType
25
- allowPhoneNumberEdit: boolean
26
- phoneNumber: string
27
- goBackToPhone: () => void
28
- }
21
+ control: FormSignInControl;
22
+ onSubmit: (data: FormSignInMFACodeValues) => void;
23
+ networkError: NetworkStatus;
24
+ mfaType: RequestType;
25
+ allowPhoneNumberEdit: boolean;
26
+ phoneNumber: string;
27
+ goBackToPhone: () => void;
28
+ };
29
29
 
30
30
  export type FormSignInMFACodeValues = {
31
- mfaCode: string
32
- }
31
+ mfaCode: string;
32
+ };
33
33
 
34
34
  const FormSignInMFACode = ({
35
35
  onSubmit,
@@ -41,10 +41,10 @@ const FormSignInMFACode = ({
41
41
  goBackToPhone,
42
42
  }: FormSignInMFACodeProps) => {
43
43
  const onError = () => {
44
- window.scrollTo(0, 0)
45
- }
44
+ window.scrollTo(0, 0);
45
+ };
46
46
 
47
- let note
47
+ let note;
48
48
  if (allowPhoneNumberEdit) {
49
49
  note = (
50
50
  <>
@@ -58,14 +58,16 @@ const FormSignInMFACode = ({
58
58
  {t("nav.signInMFA.editPhoneNumber")}{" "}
59
59
  </Button>
60
60
  </>
61
- )
61
+ );
62
62
  }
63
63
 
64
64
  return (
65
65
  <FormCard>
66
66
  <div className="form-card__lead text-center">
67
67
  <Icon size="2xl" symbol="profile" className="form-card__header-icon" />
68
- <h2 className="form-card__title is-borderless">{t("nav.signInMFA.verifyTitle")}</h2>
68
+ <h2 className="form-card__title is-borderless">
69
+ {t("nav.signInMFA.verifyTitle")}
70
+ </h2>
69
71
  <p className="form-card__sub-title">
70
72
  {mfaType === RequestType.sms
71
73
  ? t("nav.signInMFA.haveSentCodeToPhone")
@@ -80,7 +82,11 @@ const FormSignInMFACode = ({
80
82
 
81
83
  <SiteAlert type="notice" dismissable />
82
84
  <div className="form-card__group pt-0">
83
- <Form id="sign-in-mfa" className="mt-10" onSubmit={handleSubmit(onSubmit, onError)}>
85
+ <Form
86
+ id="sign-in-mfa"
87
+ className="mt-10"
88
+ onSubmit={handleSubmit(onSubmit, onError)}
89
+ >
84
90
  <Field
85
91
  caps={true}
86
92
  name="mfaCode"
@@ -93,14 +99,17 @@ const FormSignInMFACode = ({
93
99
  note={note}
94
100
  />
95
101
  <div className="text-center mt-10">
96
- <Button styleType={AppearanceStyleType.primary} data-test-id="verify-and-sign-in">
102
+ <Button
103
+ styleType={AppearanceStyleType.primary}
104
+ data-test-id="verify-and-sign-in"
105
+ >
97
106
  {t("nav.signInMFA.signIn")}
98
107
  </Button>
99
108
  </div>
100
109
  </Form>
101
110
  </div>
102
111
  </FormCard>
103
- )
104
- }
112
+ );
113
+ };
105
114
 
106
- export { FormSignInMFACode as default, FormSignInMFACode }
115
+ export { FormSignInMFACode as default, FormSignInMFACode };
@@ -1,4 +1,4 @@
1
- import React from "react"
1
+ import React from "react";
2
2
  import {
3
3
  AppearanceStyleType,
4
4
  Button,
@@ -9,24 +9,24 @@ import {
9
9
  t,
10
10
  SiteAlert,
11
11
  FormSignInErrorBox,
12
- } from "@bloom-housing/ui-components"
13
- import type { UseFormMethods } from "react-hook-form"
14
- import { NetworkStatus } from "./FormSignIn"
12
+ } from "../../..";
13
+ import type { UseFormMethods } from "react-hook-form";
14
+ import { NetworkStatus } from "./FormSignIn";
15
15
 
16
16
  export type FormSignInMFAProps = {
17
- control: FormSignInMFAControl
18
- onSubmit: (data: unknown) => void
19
- networkError: NetworkStatus
20
- emailOnClick: () => void
21
- smsOnClick: () => void
22
- }
17
+ control: FormSignInMFAControl;
18
+ onSubmit: (data: unknown) => void;
19
+ networkError: NetworkStatus;
20
+ emailOnClick: () => void;
21
+ smsOnClick: () => void;
22
+ };
23
23
 
24
24
  export type FormSignInMFAControl = {
25
- errors: UseFormMethods["errors"]
26
- handleSubmit: UseFormMethods["handleSubmit"]
27
- register: UseFormMethods["register"]
28
- setValue: UseFormMethods["setValue"]
29
- }
25
+ errors: UseFormMethods["errors"];
26
+ handleSubmit: UseFormMethods["handleSubmit"];
27
+ register: UseFormMethods["register"];
28
+ setValue: UseFormMethods["setValue"];
29
+ };
30
30
 
31
31
  const FormSignInMFAType = ({
32
32
  onSubmit,
@@ -36,8 +36,8 @@ const FormSignInMFAType = ({
36
36
  smsOnClick,
37
37
  }: FormSignInMFAProps) => {
38
38
  const onError = () => {
39
- window.scrollTo(0, 0)
40
- }
39
+ window.scrollTo(0, 0);
40
+ };
41
41
 
42
42
  return (
43
43
  <FormCard>
@@ -58,7 +58,11 @@ const FormSignInMFAType = ({
58
58
 
59
59
  <SiteAlert type="notice" dismissable />
60
60
  <div className="form-card__group pt-0">
61
- <Form id="sign-in-mfa" className="mt-10" onSubmit={handleSubmit(onSubmit, onError)}>
61
+ <Form
62
+ id="sign-in-mfa"
63
+ className="mt-10"
64
+ onSubmit={handleSubmit(onSubmit, onError)}
65
+ >
62
66
  <Field
63
67
  caps={true}
64
68
  name="mfaType"
@@ -92,7 +96,7 @@ const FormSignInMFAType = ({
92
96
  </Form>
93
97
  </div>
94
98
  </FormCard>
95
- )
96
- }
99
+ );
100
+ };
97
101
 
98
- export { FormSignInMFAType as default, FormSignInMFAType }
102
+ export { FormSignInMFAType as default, FormSignInMFAType };
@@ -1,4 +1,4 @@
1
- import React from "react"
1
+ import React from "react";
2
2
  import {
3
3
  AppearanceStyleType,
4
4
  Button,
@@ -8,29 +8,31 @@ import {
8
8
  Icon,
9
9
  MarkdownSection,
10
10
  t,
11
- } from "@bloom-housing/ui-components"
12
- import Markdown from "markdown-to-jsx"
13
- import { useForm } from "react-hook-form"
11
+ } from "../../..";
12
+ import Markdown from "markdown-to-jsx";
13
+ import { useForm } from "react-hook-form";
14
14
 
15
15
  type FormTermsInValues = {
16
- agree: boolean
17
- }
16
+ agree: boolean;
17
+ };
18
18
 
19
19
  export type FormTermsProps = {
20
- onSubmit: () => void
21
- terms?: string
22
- }
20
+ onSubmit: () => void;
21
+ terms?: string;
22
+ };
23
23
 
24
24
  const FormTerms = (props: FormTermsProps) => {
25
25
  // eslint-disable-next-line @typescript-eslint/unbound-method
26
- const { handleSubmit, register, errors } = useForm<FormTermsInValues>()
26
+ const { handleSubmit, register, errors } = useForm<FormTermsInValues>();
27
27
 
28
28
  return (
29
29
  <Form id="terms" className="mt-10" onSubmit={handleSubmit(props.onSubmit)}>
30
30
  <FormCard>
31
31
  <div className="form-card__lead text-center">
32
32
  <Icon size="2xl" symbol="settings" />
33
- <h2 className="form-card__title">{t(`authentication.terms.reviewToc`)}</h2>
33
+ <h2 className="form-card__title">
34
+ {t(`authentication.terms.reviewToc`)}
35
+ </h2>
34
36
  <p className="field-note mt-4 text-center">
35
37
  {t(`authentication.terms.youMustAcceptToc`)}
36
38
  </p>
@@ -38,7 +40,9 @@ const FormTerms = (props: FormTermsProps) => {
38
40
  <div className="overflow-y-auto max-h-96 mt-5 pr-4 text-left">
39
41
  {props.terms && (
40
42
  <MarkdownSection padding={false} fullwidth={true}>
41
- <Markdown options={{ disableParsingRawHTML: false }}>{props.terms}</Markdown>
43
+ <Markdown options={{ disableParsingRawHTML: false }}>
44
+ {props.terms}
45
+ </Markdown>
42
46
  </MarkdownSection>
43
47
  )}
44
48
  </div>
@@ -63,14 +67,17 @@ const FormTerms = (props: FormTermsProps) => {
63
67
 
64
68
  <div className="form-card__pager">
65
69
  <div className="form-card__pager-row primary">
66
- <Button styleType={AppearanceStyleType.primary} data-test-id="form-submit">
70
+ <Button
71
+ styleType={AppearanceStyleType.primary}
72
+ data-test-id="form-submit"
73
+ >
67
74
  {t("t.submit")}
68
75
  </Button>
69
76
  </div>
70
77
  </div>
71
78
  </FormCard>
72
79
  </Form>
73
- )
74
- }
80
+ );
81
+ };
75
82
 
76
- export { FormTerms as default, FormTerms }
83
+ export { FormTerms as default, FormTerms };
@@ -7,21 +7,21 @@ import {
7
7
  Field,
8
8
  emailRegex,
9
9
  AppearanceSizeType,
10
- } from "@bloom-housing/ui-components"
11
- import React, { useEffect, useMemo } from "react"
12
- import { useForm } from "react-hook-form"
10
+ } from "../../..";
11
+ import React, { useEffect, useMemo } from "react";
12
+ import { useForm } from "react-hook-form";
13
13
 
14
14
  export type ResendConfirmationModalProps = {
15
- isOpen: boolean
16
- initialEmailValue: string
17
- onClose: () => void
18
- onSubmit: (email: string) => void
19
- loading: boolean
20
- }
15
+ isOpen: boolean;
16
+ initialEmailValue: string;
17
+ onClose: () => void;
18
+ onSubmit: (email: string) => void;
19
+ loading: boolean;
20
+ };
21
21
 
22
22
  export type ResendConfirmationModalForm = {
23
- onSubmit: (email: string) => void
24
- }
23
+ onSubmit: (email: string) => void;
24
+ };
25
25
 
26
26
  const ResendConfirmationModal = ({
27
27
  isOpen,
@@ -35,23 +35,23 @@ const ResendConfirmationModal = ({
35
35
  defaultValues: useMemo(() => {
36
36
  return {
37
37
  emailResend: initialEmailValue,
38
- }
38
+ };
39
39
  }, [initialEmailValue]),
40
- })
40
+ });
41
41
 
42
42
  useEffect(() => {
43
43
  reset({
44
44
  emailResend: initialEmailValue,
45
- })
46
- }, [initialEmailValue, reset])
45
+ });
46
+ }, [initialEmailValue, reset]);
47
47
 
48
48
  const onFormSubmit = async () => {
49
- const isValid = await trigger()
50
- if (!isValid) return
49
+ const isValid = await trigger();
50
+ if (!isValid) return;
51
51
 
52
- const { emailResend } = getValues()
53
- onSubmit(emailResend)
54
- }
52
+ const { emailResend } = getValues();
53
+ onSubmit(emailResend);
54
+ };
55
55
 
56
56
  return (
57
57
  <Modal
@@ -59,8 +59,8 @@ const ResendConfirmationModal = ({
59
59
  title={t("authentication.signIn.yourAccountIsNotConfirmed")}
60
60
  ariaDescription={t("authentication.createAccount.linkExpired")}
61
61
  onClose={() => {
62
- onClose()
63
- window.scrollTo(0, 0)
62
+ onClose();
63
+ window.scrollTo(0, 0);
64
64
  }}
65
65
  actions={[
66
66
  <Button
@@ -76,8 +76,8 @@ const ResendConfirmationModal = ({
76
76
  type="button"
77
77
  styleType={AppearanceStyleType.alert}
78
78
  onClick={() => {
79
- onClose()
80
- window.scrollTo(0, 0)
79
+ onClose();
80
+ window.scrollTo(0, 0);
81
81
  }}
82
82
  size={AppearanceSizeType.small}
83
83
  >
@@ -100,10 +100,12 @@ const ResendConfirmationModal = ({
100
100
  />
101
101
  </Form>
102
102
 
103
- <p className="pt-4">{t("authentication.createAccount.resendEmailInfo")}</p>
103
+ <p className="pt-4">
104
+ {t("authentication.createAccount.resendEmailInfo")}
105
+ </p>
104
106
  </>
105
107
  </Modal>
106
- )
107
- }
108
+ );
109
+ };
108
110
 
109
- export { ResendConfirmationModal as default, ResendConfirmationModal }
111
+ export { ResendConfirmationModal as default, ResendConfirmationModal };
@@ -1,19 +1,19 @@
1
- import React from "react"
2
- import { Button, t } from "@bloom-housing/ui-components"
1
+ import React from "react";
2
+ import { Button, t } from "../..";
3
3
 
4
4
  type AgPaginationProps = {
5
- totalItems: number
6
- totalPages: number
7
- currentPage: number
8
- itemsPerPage: number
9
- quantityLabel?: string
10
- setCurrentPage: React.Dispatch<React.SetStateAction<number>>
11
- setItemsPerPage: React.Dispatch<React.SetStateAction<number>>
12
- onPageChange?: (page: number) => void
13
- onPerPageChange?: (size: number) => void
14
- }
5
+ totalItems: number;
6
+ totalPages: number;
7
+ currentPage: number;
8
+ itemsPerPage: number;
9
+ quantityLabel?: string;
10
+ setCurrentPage: React.Dispatch<React.SetStateAction<number>>;
11
+ setItemsPerPage: React.Dispatch<React.SetStateAction<number>>;
12
+ onPageChange?: (page: number) => void;
13
+ onPerPageChange?: (size: number) => void;
14
+ };
15
15
 
16
- const AG_PER_PAGE_OPTIONS = [8, 25, 50, 100]
16
+ const AG_PER_PAGE_OPTIONS = [8, 25, 50, 100];
17
17
 
18
18
  const AgPagination = ({
19
19
  totalItems,
@@ -27,19 +27,19 @@ const AgPagination = ({
27
27
  onPerPageChange,
28
28
  }: AgPaginationProps) => {
29
29
  const onNextClick = () => {
30
- setCurrentPage(currentPage + 1)
31
- onPageChange && onPageChange(currentPage)
32
- }
30
+ setCurrentPage(currentPage + 1);
31
+ onPageChange && onPageChange(currentPage);
32
+ };
33
33
 
34
34
  const onPrevClick = () => {
35
- setCurrentPage(currentPage - 1)
36
- onPageChange && onPageChange(currentPage)
37
- }
35
+ setCurrentPage(currentPage - 1);
36
+ onPageChange && onPageChange(currentPage);
37
+ };
38
38
 
39
39
  const onRowLimitChange = (size: string) => {
40
- setItemsPerPage(parseInt(size))
41
- onPerPageChange && onPerPageChange(itemsPerPage)
42
- }
40
+ setItemsPerPage(parseInt(size));
41
+ onPerPageChange && onPerPageChange(itemsPerPage);
42
+ };
43
43
 
44
44
  return (
45
45
  <div className="data-pager flex flex-col md:flex-row">
@@ -58,7 +58,9 @@ const AgPagination = ({
58
58
  <span className="field-label" id="lbTotalPages">
59
59
  {totalItems}
60
60
  </span>
61
- {quantityLabel && <span className="field-label">{quantityLabel}</span>}
61
+ {quantityLabel && (
62
+ <span className="field-label">{quantityLabel}</span>
63
+ )}
62
64
  </div>
63
65
 
64
66
  <div className="flex mt-5 md:mt-0 md:items-center">
@@ -97,12 +99,12 @@ const AgPagination = ({
97
99
  {Array(totalPages)
98
100
  .fill(totalPages)
99
101
  .map((_, i) => {
100
- const value = i + 1
102
+ const value = i + 1;
101
103
  return (
102
104
  <option key={value} value={value}>
103
105
  {value}
104
106
  </option>
105
- )
107
+ );
106
108
  })}
107
109
  </select>
108
110
  </div>
@@ -131,7 +133,7 @@ const AgPagination = ({
131
133
  </Button>
132
134
  </div>
133
135
  </div>
134
- )
135
- }
136
+ );
137
+ };
136
138
 
137
- export { AgPagination as default, AgPagination, AG_PER_PAGE_OPTIONS }
139
+ export { AgPagination as default, AgPagination, AG_PER_PAGE_OPTIONS };
package/tsconfig.json CHANGED
@@ -1,5 +1,4 @@
1
1
  {
2
- "extends": "../tsconfig.json" /* TODO: is this worth connecting? */,
3
2
  "compilerOptions": {
4
3
  "outDir": "build/lib",
5
4
  "module": "esnext",