@bloom-housing/ui-components 7.0.7 → 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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.0.8-alpha.0 (2022-12-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * bloom main uic contents ([951d4c7](https://github.com/bloom-housing/ui-components/commit/951d4c78b8a7f82837b12b4983fd0b6e693a9b0d))
12
+ * lerna setup ([1cedf21](https://github.com/bloom-housing/ui-components/commit/1cedf2143199d2d4616c338ed02256a416e9dd68))
13
+ * updated paths + functional storybook ([d2448bc](https://github.com/bloom-housing/ui-components/commit/d2448bc6613d955460df44f50c4a461cba8f09d4))
14
+
15
+
16
+
17
+
18
+
6
19
  ## [7.0.7](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@7.0.6...@bloom-housing/ui-components@7.0.7) (2022-12-08)
7
20
 
8
21
  **Note:** Version bump only for package @bloom-housing/ui-components
package/lerna.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "version": "independent",
3
+ "npmClient": "yarn",
4
+ "useWorkspaces": true,
5
+ "command": {
6
+ "publish": {
7
+ "conventionalCommits": true,
8
+ "message": "chore(release): publish"
9
+ },
10
+ "version": {
11
+ "conventionalCommits": true,
12
+ "message": "chore(release): version"
13
+ }
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "7.0.7",
3
+ "version": "7.0.8-alpha.0",
4
4
  "author": "Sean Albert <sean.albert@exygy.com>",
5
5
  "description": "Shared user interface components for Bloom affordable housing system",
6
- "homepage": "https://github.com/bloom-housing/bloom/tree/master/shared/ui-components",
6
+ "workspaces": {
7
+ "packages": [
8
+ "."
9
+ ]
10
+ },
11
+ "homepage": "https://github.com/bloom-housing/ui-components",
7
12
  "main": "index.js",
8
13
  "license": "Apache-2.0",
9
14
  "private": false,
@@ -17,7 +22,9 @@
17
22
  "test": "jest -w 1",
18
23
  "test:coverage": "jest -w 1 --coverage --watchAll=false",
19
24
  "prettier": "prettier --write \"**/*.tsx\"",
20
- "test:a11y": "build-storybook -o ./storybook-static && jest storyshot --testRegex=storyshots.spec.ts"
25
+ "test:a11y": "build-storybook -o ./storybook-static && jest storyshot --testRegex=storyshots.spec.ts",
26
+ "version": "lerna version --no-commit-hooks --conventional-graduate --include-merged-tags --force-git-tag",
27
+ "publish":"lerna publish from-package --yes --include-merged-tags --no-verify-access"
21
28
  },
22
29
  "devDependencies": {
23
30
  "@babel/core": "^7.15.5",
@@ -54,6 +61,7 @@
54
61
  "dotenv": "^8.2.0",
55
62
  "identity-obj-proxy": "^3.0.0",
56
63
  "jest": "^26.5.3",
64
+ "lerna": "6.1.0",
57
65
  "mockdate": "^3.0.2",
58
66
  "postcss": "^8.3.6",
59
67
  "postcss-loader": "^4.3",
@@ -102,6 +110,7 @@
102
110
  "react-dom": "^17.0.2",
103
111
  "react-dropzone": "^11.3.2",
104
112
  "react-focus-lock": "^2.5.2",
113
+ "react-hook-form": "7.40.0",
105
114
  "react-map-gl": "^6.1.16",
106
115
  "react-media": "^1.10.0",
107
116
  "react-remove-scroll": "2.5.4",
@@ -112,5 +121,5 @@
112
121
  "ts-jest": "^26.4.1",
113
122
  "typesafe-actions": "^5.1.0"
114
123
  },
115
- "gitHead": "c138267026cf00b0c6ada2a0e95cdef5062f3977"
124
+ "gitHead": "ef00e4db1a1bd4608525685ab81632ff4ba970cf"
116
125
  }
@@ -0,0 +1,11 @@
1
+ import { t } from "../..";
2
+ import dayjs from "dayjs";
3
+
4
+ function formatDateTime(date: Date, showTime?: boolean) {
5
+ return (
6
+ dayjs(date).format("MMMM D, YYYY") +
7
+ (showTime ? ` ${t("t.at")} ` + dayjs(date).format("h:mmA") : "")
8
+ );
9
+ }
10
+
11
+ export { formatDateTime as default, formatDateTime };
@@ -1,5 +1,5 @@
1
- import React from "react"
2
- import { UseFormMethods } from "react-hook-form"
1
+ import React from "react";
2
+ import { UseFormMethods } from "react-hook-form";
3
3
  import {
4
4
  t,
5
5
  GridSection,
@@ -8,17 +8,17 @@ import {
8
8
  Field,
9
9
  Select,
10
10
  resolveObject,
11
- } from "@bloom-housing/ui-components"
11
+ } from "../..";
12
12
 
13
13
  type FormAddressProps = {
14
- subtitle: string
15
- dataKey: string
16
- enableMailCheckbox?: boolean
17
- register: UseFormMethods["register"]
18
- errors?: UseFormMethods["errors"]
19
- required?: boolean
20
- stateKeys: string[]
21
- }
14
+ subtitle: string;
15
+ dataKey: string;
16
+ enableMailCheckbox?: boolean;
17
+ register: UseFormMethods["register"];
18
+ errors?: UseFormMethods["errors"];
19
+ required?: boolean;
20
+ stateKeys: string[];
21
+ };
22
22
 
23
23
  export const FormAddress = ({
24
24
  subtitle,
@@ -121,5 +121,5 @@ export const FormAddress = ({
121
121
  )}
122
122
  </GridSection>
123
123
  </>
124
- )
125
- }
124
+ );
125
+ };
@@ -1,30 +1,30 @@
1
- import React, { useMemo, useContext } from "react"
2
- import { PageHeader, TabNav, TabNavItem, AppearanceSizeType } from "@bloom-housing/ui-components"
3
- import { NavigationContext } from "../config/NavigationContext"
4
- import "./NavigationHeader.scss"
1
+ import React, { useMemo, useContext } from "react";
2
+ import { PageHeader, TabNav, TabNavItem, AppearanceSizeType } from "../..";
3
+ import { NavigationContext } from "../config/NavigationContext";
4
+ import "./NavigationHeader.scss";
5
5
 
6
6
  type NavigationHeaderProps = {
7
- className?: string
8
- title: React.ReactNode
9
- listingId?: string
10
- tabs?: NavigationHeaderTabs
11
- breadcrumbs?: React.ReactNode
12
- children?: React.ReactChild
13
- }
7
+ className?: string;
8
+ title: React.ReactNode;
9
+ listingId?: string;
10
+ tabs?: NavigationHeaderTabs;
11
+ breadcrumbs?: React.ReactNode;
12
+ children?: React.ReactChild;
13
+ };
14
14
 
15
15
  type NavigationHeaderTabs = {
16
- show?: boolean
17
- flagsQty?: number
18
- listingLabel: string
19
- applicationsLabel: string
20
- }
16
+ show?: boolean;
17
+ flagsQty?: number;
18
+ listingLabel: string;
19
+ applicationsLabel: string;
20
+ };
21
21
 
22
22
  type NavigationHeaderTabsElement = {
23
- label: string
24
- path: string
25
- activePaths: string[]
26
- content: React.ReactNode | undefined
27
- }
23
+ label: string;
24
+ path: string;
25
+ activePaths: string[];
26
+ content: React.ReactNode | undefined;
27
+ };
28
28
 
29
29
  const NavigationHeader = ({
30
30
  className,
@@ -34,8 +34,8 @@ const NavigationHeader = ({
34
34
  children,
35
35
  breadcrumbs,
36
36
  }: NavigationHeaderProps) => {
37
- const navigation = useContext(NavigationContext)
38
- const currentPath = navigation.router.asPath
37
+ const navigation = useContext(NavigationContext);
38
+ const currentPath = navigation.router.asPath;
39
39
 
40
40
  const tabNavElements = useMemo(() => {
41
41
  const elements: NavigationHeaderTabsElement[] = [
@@ -57,10 +57,10 @@ const NavigationHeader = ({
57
57
  ],
58
58
  content: undefined,
59
59
  },
60
- ]
60
+ ];
61
61
 
62
- return elements
63
- }, [tabs, listingId])
62
+ return elements;
63
+ }, [tabs, listingId]);
64
64
 
65
65
  const tabNavItems = useMemo(() => {
66
66
  return (
@@ -77,8 +77,8 @@ const NavigationHeader = ({
77
77
  </TabNavItem>
78
78
  ))}
79
79
  </TabNav>
80
- )
81
- }, [currentPath, tabNavElements])
80
+ );
81
+ }, [currentPath, tabNavElements]);
82
82
 
83
83
  return (
84
84
  <PageHeader
@@ -89,7 +89,7 @@ const NavigationHeader = ({
89
89
  >
90
90
  {children}
91
91
  </PageHeader>
92
- )
93
- }
92
+ );
93
+ };
94
94
 
95
- export { NavigationHeader as default, NavigationHeader }
95
+ export { NavigationHeader as default, NavigationHeader };
@@ -1,4 +1,4 @@
1
- import React, { useContext } from "react"
1
+ import React, { useContext } from "react";
2
2
  import {
3
3
  AppearanceStyleType,
4
4
  Button,
@@ -12,31 +12,31 @@ import {
12
12
  AlertNotice,
13
13
  ErrorMessage,
14
14
  emailRegex,
15
- } from "@bloom-housing/ui-components"
16
- import { NetworkErrorReset, NetworkStatusContent } from "../sign-in/FormSignIn"
17
- import { NavigationContext } from "../../config/NavigationContext"
18
- import type { UseFormMethods } from "react-hook-form"
15
+ } from "../../..";
16
+ import { NetworkErrorReset, NetworkStatusContent } from "../sign-in/FormSignIn";
17
+ import { NavigationContext } from "../../config/NavigationContext";
18
+ import type { UseFormMethods } from "react-hook-form";
19
19
 
20
20
  export type FormForgotPasswordProps = {
21
- control: FormForgotPasswordControl
22
- onSubmit: (data: FormForgotPasswordValues) => void
23
- networkError: FormForgotPasswordNetworkError
24
- }
21
+ control: FormForgotPasswordControl;
22
+ onSubmit: (data: FormForgotPasswordValues) => void;
23
+ networkError: FormForgotPasswordNetworkError;
24
+ };
25
25
 
26
26
  export type FormForgotPasswordNetworkError = {
27
- error: NetworkStatusContent
28
- reset: NetworkErrorReset
29
- }
27
+ error: NetworkStatusContent;
28
+ reset: NetworkErrorReset;
29
+ };
30
30
 
31
31
  export type FormForgotPasswordControl = {
32
- errors: UseFormMethods["errors"]
33
- handleSubmit: UseFormMethods["handleSubmit"]
34
- register: UseFormMethods["register"]
35
- }
32
+ errors: UseFormMethods["errors"];
33
+ handleSubmit: UseFormMethods["handleSubmit"];
34
+ register: UseFormMethods["register"];
35
+ };
36
36
 
37
37
  export type FormForgotPasswordValues = {
38
- email: string
39
- }
38
+ email: string;
39
+ };
40
40
 
41
41
  const FormForgotPassword = ({
42
42
  onSubmit,
@@ -44,26 +44,33 @@ const FormForgotPassword = ({
44
44
  control: { errors, register, handleSubmit },
45
45
  }: FormForgotPasswordProps) => {
46
46
  const onError = () => {
47
- window.scrollTo(0, 0)
48
- }
47
+ window.scrollTo(0, 0);
48
+ };
49
49
 
50
- const { router } = useContext(NavigationContext)
50
+ const { router } = useContext(NavigationContext);
51
51
 
52
52
  return (
53
53
  <FormCard>
54
54
  <div className="form-card__lead text-center border-b mx-0">
55
55
  <Icon size="2xl" symbol="profile" />
56
- <h1 className="form-card__title">{t("authentication.forgotPassword.sendEmail")}</h1>
56
+ <h1 className="form-card__title">
57
+ {t("authentication.forgotPassword.sendEmail")}
58
+ </h1>
57
59
  </div>
58
60
 
59
61
  {Object.entries(errors).length > 0 && !networkError.error && (
60
62
  <AlertBox type="alert" inverted closeable>
61
- {errors.authentication ? errors.authentication.message : t("errors.errorsToResolve")}
63
+ {errors.authentication
64
+ ? errors.authentication.message
65
+ : t("errors.errorsToResolve")}
62
66
  </AlertBox>
63
67
  )}
64
68
 
65
69
  {!!networkError.error?.error && Object.entries(errors).length === 0 && (
66
- <ErrorMessage id={"forgotpasswordemail-error"} error={!!networkError.error}>
70
+ <ErrorMessage
71
+ id={"forgotpasswordemail-error"}
72
+ error={!!networkError.error}
73
+ >
67
74
  <AlertBox type="alert" inverted onClose={() => networkError.reset()}>
68
75
  {networkError.error.title}
69
76
  </AlertBox>
@@ -77,14 +84,20 @@ const FormForgotPassword = ({
77
84
  <SiteAlert type="notice" dismissable />
78
85
 
79
86
  <div className="form-card__group pt-0">
80
- <Form id="sign-in" className="mt-10" onSubmit={handleSubmit(onSubmit, onError)}>
87
+ <Form
88
+ id="sign-in"
89
+ className="mt-10"
90
+ onSubmit={handleSubmit(onSubmit, onError)}
91
+ >
81
92
  <Field
82
93
  caps={true}
83
94
  name="email"
84
95
  label={t("t.email")}
85
96
  validation={{ required: true, pattern: emailRegex }}
86
97
  error={errors.email}
87
- errorMessage={errors.email ? t("authentication.signIn.loginError") : undefined}
98
+ errorMessage={
99
+ errors.email ? t("authentication.signIn.loginError") : undefined
100
+ }
88
101
  register={register}
89
102
  onChange={() => networkError.reset()}
90
103
  />
@@ -103,7 +116,7 @@ const FormForgotPassword = ({
103
116
  </Form>
104
117
  </div>
105
118
  </FormCard>
106
- )
107
- }
119
+ );
120
+ };
108
121
 
109
- export { FormForgotPassword as default, FormForgotPassword }
122
+ export { FormForgotPassword as default, FormForgotPassword };
@@ -1,4 +1,4 @@
1
- import React, { useContext } from "react"
1
+ import React, { useContext } from "react";
2
2
  import {
3
3
  AppearanceStyleType,
4
4
  Button,
@@ -9,47 +9,47 @@ import {
9
9
  LinkButton,
10
10
  t,
11
11
  FormSignInErrorBox,
12
- } from "@bloom-housing/ui-components"
13
- import type { UseFormMethods } from "react-hook-form"
14
- import { NavigationContext } from "../../config/NavigationContext"
15
- import { AlertTypes } from "../../notifications/alertTypes"
12
+ } from "../../..";
13
+ import type { UseFormMethods } from "react-hook-form";
14
+ import { NavigationContext } from "../../config/NavigationContext";
15
+ import { AlertTypes } from "../../notifications/alertTypes";
16
16
 
17
- export type NetworkErrorDetermineError = (status: number, error: Error) => void
17
+ export type NetworkErrorDetermineError = (status: number, error: Error) => void;
18
18
 
19
- export type NetworkStatusType = AlertTypes
19
+ export type NetworkStatusType = AlertTypes;
20
20
 
21
- export type NetworkErrorReset = () => void
21
+ export type NetworkErrorReset = () => void;
22
22
 
23
23
  export type NetworkStatusContent = {
24
- title: string
25
- description: string
26
- error?: boolean
27
- } | null
24
+ title: string;
25
+ description: string;
26
+ error?: boolean;
27
+ } | null;
28
28
 
29
29
  export type NetworkStatus = {
30
- content: NetworkStatusContent
31
- type?: NetworkStatusType
32
- reset: NetworkErrorReset
33
- }
30
+ content: NetworkStatusContent;
31
+ type?: NetworkStatusType;
32
+ reset: NetworkErrorReset;
33
+ };
34
34
 
35
35
  export type FormSignInProps = {
36
- control: FormSignInControl
37
- onSubmit: (data: FormSignInValues) => void
38
- networkStatus: NetworkStatus
39
- showRegisterBtn?: boolean
40
- }
36
+ control: FormSignInControl;
37
+ onSubmit: (data: FormSignInValues) => void;
38
+ networkStatus: NetworkStatus;
39
+ showRegisterBtn?: boolean;
40
+ };
41
41
 
42
42
  export type FormSignInControl = {
43
- errors: UseFormMethods["errors"]
44
- handleSubmit: UseFormMethods["handleSubmit"]
45
- register: UseFormMethods["register"]
46
- watch: UseFormMethods["watch"]
47
- }
43
+ errors: UseFormMethods["errors"];
44
+ handleSubmit: UseFormMethods["handleSubmit"];
45
+ register: UseFormMethods["register"];
46
+ watch: UseFormMethods["watch"];
47
+ };
48
48
 
49
49
  export type FormSignInValues = {
50
- email: string
51
- password: string
52
- }
50
+ email: string;
51
+ password: string;
52
+ };
53
53
 
54
54
  const FormSignIn = ({
55
55
  onSubmit,
@@ -58,9 +58,9 @@ const FormSignIn = ({
58
58
  control: { errors, register, handleSubmit },
59
59
  }: FormSignInProps) => {
60
60
  const onError = () => {
61
- window.scrollTo(0, 0)
62
- }
63
- const { LinkComponent } = useContext(NavigationContext)
61
+ window.scrollTo(0, 0);
62
+ };
63
+ const { LinkComponent } = useContext(NavigationContext);
64
64
 
65
65
  return (
66
66
  <FormCard>
@@ -74,7 +74,11 @@ const FormSignIn = ({
74
74
  errorMessageId={"main-sign-in"}
75
75
  />
76
76
  <div className="form-card__group pt-0">
77
- <Form id="sign-in" className="mt-10" onSubmit={handleSubmit(onSubmit, onError)}>
77
+ <Form
78
+ id="sign-in"
79
+ className="mt-10"
80
+ onSubmit={handleSubmit(onSubmit, onError)}
81
+ >
78
82
  <Field
79
83
  caps={true}
80
84
  name="email"
@@ -105,7 +109,10 @@ const FormSignIn = ({
105
109
  />
106
110
 
107
111
  <div className="text-center mt-6">
108
- <Button styleType={AppearanceStyleType.primary} data-test-id="sign-in-button">
112
+ <Button
113
+ styleType={AppearanceStyleType.primary}
114
+ data-test-id="sign-in-button"
115
+ >
109
116
  {t("nav.signIn")}
110
117
  </Button>
111
118
  </div>
@@ -113,13 +120,17 @@ const FormSignIn = ({
113
120
  </div>
114
121
  {showRegisterBtn && (
115
122
  <div className="form-card__group text-center border-t">
116
- <h2 className="mb-6">{t("authentication.createAccount.noAccount")}</h2>
123
+ <h2 className="mb-6">
124
+ {t("authentication.createAccount.noAccount")}
125
+ </h2>
117
126
 
118
- <LinkButton href="/create-account">{t("account.createAccount")}</LinkButton>
127
+ <LinkButton href="/create-account">
128
+ {t("account.createAccount")}
129
+ </LinkButton>
119
130
  </div>
120
131
  )}
121
132
  </FormCard>
122
- )
123
- }
133
+ );
134
+ };
124
135
 
125
- export { FormSignIn as default, FormSignIn }
136
+ export { FormSignIn as default, FormSignIn };
@@ -1,4 +1,4 @@
1
- import React from "react"
1
+ import React from "react";
2
2
  import {
3
3
  AppearanceStyleType,
4
4
  Button,
@@ -9,26 +9,26 @@ import {
9
9
  SiteAlert,
10
10
  PhoneField,
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 FormSignInAddPhoneProps = {
17
- control: FormSignInAddPhoneControl
18
- onSubmit: (data: FormSignInAddPhoneValues) => void
19
- networkError: NetworkStatus
20
- phoneNumber: string
21
- }
17
+ control: FormSignInAddPhoneControl;
18
+ onSubmit: (data: FormSignInAddPhoneValues) => void;
19
+ networkError: NetworkStatus;
20
+ phoneNumber: string;
21
+ };
22
22
 
23
23
  export type FormSignInAddPhoneControl = {
24
- errors: UseFormMethods["errors"]
25
- handleSubmit: UseFormMethods["handleSubmit"]
26
- control: UseFormMethods["control"]
27
- }
24
+ errors: UseFormMethods["errors"];
25
+ handleSubmit: UseFormMethods["handleSubmit"];
26
+ control: UseFormMethods["control"];
27
+ };
28
28
 
29
29
  export type FormSignInAddPhoneValues = {
30
- phoneNumber: string
31
- }
30
+ phoneNumber: string;
31
+ };
32
32
 
33
33
  const FormSignInAddPhone = ({
34
34
  onSubmit,
@@ -37,15 +37,19 @@ const FormSignInAddPhone = ({
37
37
  phoneNumber,
38
38
  }: FormSignInAddPhoneProps) => {
39
39
  const onError = () => {
40
- window.scrollTo(0, 0)
41
- }
42
- const { errors, handleSubmit } = control
40
+ window.scrollTo(0, 0);
41
+ };
42
+ const { errors, handleSubmit } = control;
43
43
  return (
44
44
  <FormCard>
45
45
  <div className="form-card__lead text-center">
46
46
  <Icon size="2xl" symbol="profile" className="form-card__header-icon" />
47
- <h2 className="form-card__title is-borderless">{t("nav.signInMFA.addNumber")}</h2>
48
- <p className="form-card__sub-title">{t("nav.signInMFA.addNumberSecondaryTitle")}</p>
47
+ <h2 className="form-card__title is-borderless">
48
+ {t("nav.signInMFA.addNumber")}
49
+ </h2>
50
+ <p className="form-card__sub-title">
51
+ {t("nav.signInMFA.addNumberSecondaryTitle")}
52
+ </p>
49
53
  </div>
50
54
  <FormSignInErrorBox
51
55
  errors={errors}
@@ -55,7 +59,11 @@ const FormSignInAddPhone = ({
55
59
 
56
60
  <SiteAlert type="notice" dismissable />
57
61
  <div className="form-card__group pt-0">
58
- <Form id="sign-in-mfa" className="mt-10" onSubmit={handleSubmit(onSubmit, onError)}>
62
+ <Form
63
+ id="sign-in-mfa"
64
+ className="mt-10"
65
+ onSubmit={handleSubmit(onSubmit, onError)}
66
+ >
59
67
  <PhoneField
60
68
  label={t("nav.signInMFA.phoneNumber")}
61
69
  caps={true}
@@ -81,7 +89,7 @@ const FormSignInAddPhone = ({
81
89
  </Form>
82
90
  </div>
83
91
  </FormCard>
84
- )
85
- }
92
+ );
93
+ };
86
94
 
87
- export { FormSignInAddPhone as default, FormSignInAddPhone }
95
+ export { FormSignInAddPhone as default, FormSignInAddPhone };