@bloom-housing/ui-components 2.0.0-pre-tailwind
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/.jest/setup-tests.js +24 -0
- package/CHANGELOG.md +20 -0
- package/README.md +195 -0
- package/index.ts +148 -0
- package/jest.config.js +41 -0
- package/package.json +98 -0
- package/public/images/alameda-logo-white.svg +1 -0
- package/public/images/arrow-down.png +0 -0
- package/public/images/arrow-down.svg +1 -0
- package/public/images/check.png +0 -0
- package/public/images/check.svg +11 -0
- package/public/images/eho-logo-white.svg +1 -0
- package/public/images/eho-logo.svg +1 -0
- package/public/images/logo_glyph.svg +11 -0
- package/src/actions/Button.scss +157 -0
- package/src/actions/Button.tsx +80 -0
- package/src/actions/ExpandableContent.tsx +29 -0
- package/src/actions/ExpandableText.scss +18 -0
- package/src/actions/ExpandableText.tsx +52 -0
- package/src/actions/LinkButton.tsx +30 -0
- package/src/actions/LocalizedLink.tsx +11 -0
- package/src/authentication/AuthContext.ts +327 -0
- package/src/authentication/RequireLogin.tsx +62 -0
- package/src/authentication/index.ts +5 -0
- package/src/authentication/timeout.tsx +127 -0
- package/src/authentication/token.ts +17 -0
- package/src/authentication/useRequireLoggedInUser.ts +19 -0
- package/src/blocks/ActionBlock.scss +108 -0
- package/src/blocks/ActionBlock.tsx +51 -0
- package/src/blocks/AppStatusItem.scss +140 -0
- package/src/blocks/AppStatusItem.tsx +75 -0
- package/src/blocks/DashBlock.tsx +42 -0
- package/src/blocks/DashBlocks.scss +56 -0
- package/src/blocks/DashBlocks.tsx +7 -0
- package/src/blocks/FormCard.scss +201 -0
- package/src/blocks/FormCard.tsx +29 -0
- package/src/blocks/HousingCounselor.tsx +51 -0
- package/src/blocks/ImageCard.scss +91 -0
- package/src/blocks/ImageCard.tsx +77 -0
- package/src/blocks/InfoCard.scss +42 -0
- package/src/blocks/InfoCard.tsx +44 -0
- package/src/blocks/StatusBar.scss +30 -0
- package/src/blocks/StatusBar.tsx +31 -0
- package/src/blocks/ViewItem.scss +59 -0
- package/src/blocks/ViewItem.tsx +32 -0
- package/src/config/ConfigContext.tsx +36 -0
- package/src/config/NavigationContext.tsx +54 -0
- package/src/config/index.ts +2 -0
- package/src/footers/ExygyFooter.tsx +12 -0
- package/src/footers/SiteFooter.scss +28 -0
- package/src/footers/SiteFooter.tsx +10 -0
- package/src/forms/CloudinaryUpload.ts +50 -0
- package/src/forms/DOBField.tsx +132 -0
- package/src/forms/DateField.tsx +120 -0
- package/src/forms/Dropzone.scss +17 -0
- package/src/forms/Dropzone.tsx +67 -0
- package/src/forms/Field.tsx +115 -0
- package/src/forms/FieldGroup.tsx +82 -0
- package/src/forms/Form.tsx +22 -0
- package/src/forms/HouseholdMemberForm.tsx +41 -0
- package/src/forms/HouseholdSizeField.tsx +74 -0
- package/src/forms/PhoneField.tsx +69 -0
- package/src/forms/PhoneMask.tsx +24 -0
- package/src/forms/Select.tsx +80 -0
- package/src/forms/Textarea.scss +40 -0
- package/src/forms/Textarea.tsx +64 -0
- package/src/forms/TimeField.tsx +176 -0
- package/src/global/AppearanceTypes.ts +46 -0
- package/src/global/ApplicationStatusType.ts +6 -0
- package/src/global/accordion.scss +4 -0
- package/src/global/blocks.scss +137 -0
- package/src/global/custom_counter.scss +50 -0
- package/src/global/forms.scss +362 -0
- package/src/global/headers.scss +89 -0
- package/src/global/homepage.scss +8 -0
- package/src/global/index.scss +72 -0
- package/src/global/lists.scss +21 -0
- package/src/global/markdown.scss +33 -0
- package/src/global/mixins.scss +175 -0
- package/src/global/navbar.scss +280 -0
- package/src/global/print.scss +59 -0
- package/src/global/tables.scss +197 -0
- package/src/global/text.scss +141 -0
- package/src/global/vendor/AgPagination.tsx +133 -0
- package/src/global/vendor/_setup_bulma.scss +31 -0
- package/src/global/vendor/ag_grid.scss +140 -0
- package/src/headers/Hero.scss +56 -0
- package/src/headers/Hero.tsx +76 -0
- package/src/headers/PageHeader.scss +31 -0
- package/src/headers/PageHeader.tsx +39 -0
- package/src/headers/SiteHeader.tsx +136 -0
- package/src/helpers/address.tsx +46 -0
- package/src/helpers/blankApplication.ts +108 -0
- package/src/helpers/capitalize.tsx +7 -0
- package/src/helpers/dateToString.ts +11 -0
- package/src/helpers/debounce.ts +12 -0
- package/src/helpers/formOptions.tsx +229 -0
- package/src/helpers/formatYesNoLabel.ts +9 -0
- package/src/helpers/getTranslationWithArguments.ts +14 -0
- package/src/helpers/links.ts +7 -0
- package/src/helpers/localeRoute.tsx +13 -0
- package/src/helpers/mergeDeep.ts +12 -0
- package/src/helpers/nextjs.ts +7 -0
- package/src/helpers/numberOrdinal.ts +17 -0
- package/src/helpers/occupancyFormatting.tsx +46 -0
- package/src/helpers/pdfs.ts +19 -0
- package/src/helpers/photos.ts +19 -0
- package/src/helpers/preferences.tsx +426 -0
- package/src/helpers/resolveObject.ts +5 -0
- package/src/helpers/state.tsx +7 -0
- package/src/helpers/tableSummaries.tsx +80 -0
- package/src/helpers/translator.tsx +37 -0
- package/src/helpers/useKeyPress.ts +17 -0
- package/src/helpers/useMutate.ts +40 -0
- package/src/helpers/useOutsideClick.ts +25 -0
- package/src/helpers/validators.ts +3 -0
- package/src/icons/HeaderBadge.scss +29 -0
- package/src/icons/HeaderBadge.tsx +38 -0
- package/src/icons/Icon.scss +76 -0
- package/src/icons/Icon.tsx +145 -0
- package/src/icons/Icons.tsx +556 -0
- package/src/lists/PreferencesList.scss +72 -0
- package/src/lists/PreferencesList.tsx +60 -0
- package/src/locales/es.json +745 -0
- package/src/locales/general.json +1307 -0
- package/src/locales/general_OLD.json +868 -0
- package/src/locales/vi.json +745 -0
- package/src/locales/zh.json +745 -0
- package/src/navigation/Breadcrumbs.scss +25 -0
- package/src/navigation/Breadcrumbs.tsx +27 -0
- package/src/navigation/FooterNav.scss +47 -0
- package/src/navigation/FooterNav.tsx +19 -0
- package/src/navigation/LanguageNav.scss +32 -0
- package/src/navigation/LanguageNav.tsx +53 -0
- package/src/navigation/ProgressNav.scss +102 -0
- package/src/navigation/ProgressNav.tsx +50 -0
- package/src/navigation/TabNav.scss +38 -0
- package/src/navigation/TabNav.tsx +69 -0
- package/src/navigation/Tabs.scss +65 -0
- package/src/navigation/Tabs.tsx +93 -0
- package/src/navigation/UserNav.tsx +37 -0
- package/src/notifications/AlertBox.scss +78 -0
- package/src/notifications/AlertBox.tsx +79 -0
- package/src/notifications/AlertNotice.scss +58 -0
- package/src/notifications/AlertNotice.tsx +37 -0
- package/src/notifications/ApplicationStatus.scss +10 -0
- package/src/notifications/ApplicationStatus.tsx +64 -0
- package/src/notifications/ErrorMessage.tsx +15 -0
- package/src/notifications/SiteAlert.tsx +54 -0
- package/src/notifications/StatusAside.scss +11 -0
- package/src/notifications/StatusAside.tsx +25 -0
- package/src/notifications/StatusMessage.scss +25 -0
- package/src/notifications/StatusMessage.tsx +59 -0
- package/src/notifications/alertTypes.ts +7 -0
- package/src/notifications/index.ts +4 -0
- package/src/overlays/Drawer.scss +105 -0
- package/src/overlays/Drawer.tsx +51 -0
- package/src/overlays/LoadingOverlay.scss +25 -0
- package/src/overlays/LoadingOverlay.tsx +29 -0
- package/src/overlays/Modal.scss +55 -0
- package/src/overlays/Modal.tsx +61 -0
- package/src/overlays/Overlay.scss +50 -0
- package/src/overlays/Overlay.tsx +100 -0
- package/src/page_components/listing/AdditionalFees.tsx +56 -0
- package/src/page_components/listing/ListingCard.scss +47 -0
- package/src/page_components/listing/ListingCard.tsx +34 -0
- package/src/page_components/listing/ListingDetailHeader.tsx +25 -0
- package/src/page_components/listing/ListingDetails.tsx +29 -0
- package/src/page_components/listing/ListingMap.scss +36 -0
- package/src/page_components/listing/ListingMap.tsx +138 -0
- package/src/page_components/listing/ListingsGroup.scss +65 -0
- package/src/page_components/listing/ListingsGroup.tsx +49 -0
- package/src/page_components/listing/UnitTables.tsx +111 -0
- package/src/page_components/listing/listing_sidebar/ApplicationSection.tsx +49 -0
- package/src/page_components/listing/listing_sidebar/Apply.tsx +225 -0
- package/src/page_components/listing/listing_sidebar/LeasingAgent.tsx +77 -0
- package/src/page_components/listing/listing_sidebar/ListingUpdated.tsx +20 -0
- package/src/page_components/listing/listing_sidebar/ReferralApplication.tsx +28 -0
- package/src/page_components/listing/listing_sidebar/SidebarAddress.tsx +56 -0
- package/src/page_components/listing/listing_sidebar/Waitlist.tsx +94 -0
- package/src/page_components/listing/listing_sidebar/WhatToExpect.tsx +22 -0
- package/src/page_components/listing/listing_sidebar/events/DownloadLotteryResults.tsx +34 -0
- package/src/page_components/listing/listing_sidebar/events/EventDateSection.tsx +24 -0
- package/src/page_components/listing/listing_sidebar/events/LotteryResultsEvent.tsx +26 -0
- package/src/page_components/listing/listing_sidebar/events/OpenHouseEvent.tsx +27 -0
- package/src/page_components/listing/listing_sidebar/events/PublicLotteryEvent.tsx +22 -0
- package/src/prototypes/AppCard.scss +64 -0
- package/src/prototypes/Back.scss +19 -0
- package/src/prototypes/ButtonGroup.scss +6 -0
- package/src/prototypes/ButtonPager.scss +22 -0
- package/src/prototypes/FieldSection.scss +35 -0
- package/src/prototypes/FieldSection.tsx +31 -0
- package/src/prototypes/GridItem.tsx +15 -0
- package/src/prototypes/SideNav.scss +32 -0
- package/src/prototypes/SideNav.tsx +14 -0
- package/src/prototypes/SummaryCard.scss +34 -0
- package/src/sections/ContentSection.scss +15 -0
- package/src/sections/ContentSection.tsx +25 -0
- package/src/sections/FooterSection.scss +6 -0
- package/src/sections/FooterSection.tsx +16 -0
- package/src/sections/GridSection.scss +72 -0
- package/src/sections/GridSection.tsx +82 -0
- package/src/sections/InfoCardGrid.scss +45 -0
- package/src/sections/InfoCardGrid.tsx +20 -0
- package/src/sections/ListSection.scss +7 -0
- package/src/sections/ListSection.tsx +23 -0
- package/src/sections/MarkdownSection.scss +13 -0
- package/src/sections/MarkdownSection.tsx +21 -0
- package/src/sections/ResponsiveContentList.tsx +67 -0
- package/src/sections/ResponsiveWrappers.tsx +23 -0
- package/src/tables/GroupedTable.tsx +86 -0
- package/src/tables/MinimalTable.tsx +32 -0
- package/src/tables/ResponsiveTable.tsx +24 -0
- package/src/tables/StandardTable.tsx +229 -0
- package/src/text/Description.scss +52 -0
- package/src/text/Description.tsx +24 -0
- package/src/text/Message.scss +16 -0
- package/src/text/Message.tsx +16 -0
- package/src/text/Tag.scss +94 -0
- package/src/text/Tag.tsx +22 -0
- package/tailwind.config.js +128 -0
- package/tailwind.tosass.js +29 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import Markdown from "markdown-to-jsx"
|
|
3
|
+
|
|
4
|
+
export interface Address {
|
|
5
|
+
city?: string
|
|
6
|
+
latitude?: number
|
|
7
|
+
longitude?: number
|
|
8
|
+
placeName?: string
|
|
9
|
+
state?: string
|
|
10
|
+
street2?: string
|
|
11
|
+
street?: string
|
|
12
|
+
zipCode?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface AddressProps {
|
|
16
|
+
address: Address
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const OneLineAddress = (props: AddressProps) => {
|
|
20
|
+
if (!props.address) return null
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
{props.address.street},{` `}
|
|
25
|
+
{props.address.city}, {props.address.state} {props.address.zipCode}
|
|
26
|
+
</>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const MultiLineAddress = (props: AddressProps) => {
|
|
31
|
+
if (!props.address) return null
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
{props.address.placeName && (
|
|
36
|
+
<>
|
|
37
|
+
{props.address.placeName}
|
|
38
|
+
<br />
|
|
39
|
+
</>
|
|
40
|
+
)}
|
|
41
|
+
<Markdown children={props.address.street || ""} />
|
|
42
|
+
<br />
|
|
43
|
+
{props.address.city}, {props.address.state} {props.address.zipCode}
|
|
44
|
+
</>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ApplicationStatus,
|
|
3
|
+
ApplicationSubmissionType,
|
|
4
|
+
Language,
|
|
5
|
+
ApplicationPreference,
|
|
6
|
+
} from "@bloom-housing/backend-core/types"
|
|
7
|
+
|
|
8
|
+
export const blankApplication = () => {
|
|
9
|
+
return {
|
|
10
|
+
loaded: false,
|
|
11
|
+
autofilled: false,
|
|
12
|
+
completedSections: 0,
|
|
13
|
+
submissionType: ApplicationSubmissionType.electronical,
|
|
14
|
+
language: Language.en,
|
|
15
|
+
acceptedTerms: false,
|
|
16
|
+
status: ApplicationStatus.submitted,
|
|
17
|
+
applicant: {
|
|
18
|
+
orderId: undefined,
|
|
19
|
+
firstName: "",
|
|
20
|
+
middleName: "",
|
|
21
|
+
lastName: "",
|
|
22
|
+
birthMonth: "",
|
|
23
|
+
birthDay: "",
|
|
24
|
+
birthYear: "",
|
|
25
|
+
emailAddress: null,
|
|
26
|
+
noEmail: false,
|
|
27
|
+
phoneNumber: "",
|
|
28
|
+
phoneNumberType: "",
|
|
29
|
+
noPhone: false,
|
|
30
|
+
workInRegion: null,
|
|
31
|
+
address: {
|
|
32
|
+
street: "",
|
|
33
|
+
street2: "",
|
|
34
|
+
city: "",
|
|
35
|
+
state: "",
|
|
36
|
+
zipCode: "",
|
|
37
|
+
county: "",
|
|
38
|
+
latitude: null,
|
|
39
|
+
longitude: null,
|
|
40
|
+
},
|
|
41
|
+
workAddress: {
|
|
42
|
+
street: "",
|
|
43
|
+
street2: "",
|
|
44
|
+
city: "",
|
|
45
|
+
state: "",
|
|
46
|
+
zipCode: "",
|
|
47
|
+
county: "",
|
|
48
|
+
latitude: null,
|
|
49
|
+
longitude: null,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
additionalPhone: false,
|
|
53
|
+
additionalPhoneNumber: "",
|
|
54
|
+
additionalPhoneNumberType: "",
|
|
55
|
+
contactPreferences: [],
|
|
56
|
+
householdSize: 0,
|
|
57
|
+
housingStatus: "",
|
|
58
|
+
sendMailToMailingAddress: false,
|
|
59
|
+
mailingAddress: {
|
|
60
|
+
street: "",
|
|
61
|
+
street2: "",
|
|
62
|
+
city: "",
|
|
63
|
+
state: "",
|
|
64
|
+
zipCode: "",
|
|
65
|
+
},
|
|
66
|
+
alternateAddress: {
|
|
67
|
+
street: "",
|
|
68
|
+
street2: "",
|
|
69
|
+
city: "",
|
|
70
|
+
state: "",
|
|
71
|
+
zipCode: "",
|
|
72
|
+
},
|
|
73
|
+
alternateContact: {
|
|
74
|
+
type: "",
|
|
75
|
+
otherType: "",
|
|
76
|
+
firstName: "",
|
|
77
|
+
lastName: "",
|
|
78
|
+
agency: "",
|
|
79
|
+
phoneNumber: "",
|
|
80
|
+
emailAddress: null,
|
|
81
|
+
mailingAddress: {
|
|
82
|
+
street: "",
|
|
83
|
+
city: "",
|
|
84
|
+
state: "",
|
|
85
|
+
zipCode: "",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
accessibility: {
|
|
89
|
+
mobility: null,
|
|
90
|
+
vision: null,
|
|
91
|
+
hearing: null,
|
|
92
|
+
},
|
|
93
|
+
incomeVouchers: null,
|
|
94
|
+
income: null,
|
|
95
|
+
incomePeriod: null,
|
|
96
|
+
householdMembers: [],
|
|
97
|
+
preferredUnit: [],
|
|
98
|
+
demographics: {
|
|
99
|
+
ethnicity: "",
|
|
100
|
+
race: "",
|
|
101
|
+
gender: "",
|
|
102
|
+
sexualOrientation: "",
|
|
103
|
+
howDidYouHear: [],
|
|
104
|
+
},
|
|
105
|
+
preferences: [] as ApplicationPreference[],
|
|
106
|
+
confirmationId: "",
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import moment from "moment"
|
|
2
|
+
|
|
3
|
+
export const dateToString = (submissionDate: Date) => {
|
|
4
|
+
if (!submissionDate) return null
|
|
5
|
+
const formattedSubmissionDate = moment(new Date(submissionDate)).utc()
|
|
6
|
+
const month = formattedSubmissionDate.format("MMMM")
|
|
7
|
+
const day = formattedSubmissionDate.format("DD")
|
|
8
|
+
const year = formattedSubmissionDate.format("YYYY")
|
|
9
|
+
|
|
10
|
+
return `${month} ${day}, ${year}`
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
export function debounce<F extends (...params: any[]) => void>(fn: F, delay: number) {
|
|
3
|
+
let timeoutID: number | null = null
|
|
4
|
+
return function (this: any, ...args: any[]) {
|
|
5
|
+
if (timeoutID) {
|
|
6
|
+
clearTimeout(timeoutID)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
timeoutID = window.setTimeout(() => fn.apply(this, args), delay)
|
|
10
|
+
} as F
|
|
11
|
+
}
|
|
12
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { t } from "./translator"
|
|
3
|
+
import { Language } from "@bloom-housing/backend-core/types"
|
|
4
|
+
|
|
5
|
+
export interface SelectOption {
|
|
6
|
+
value: string
|
|
7
|
+
label: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface FormOptionsProps {
|
|
11
|
+
options: (string | SelectOption)[]
|
|
12
|
+
keyPrefix?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface FieldGroupItem {
|
|
16
|
+
id: string
|
|
17
|
+
checked?: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const contactPreferencesKeys: FieldGroupItem[] = [
|
|
21
|
+
{
|
|
22
|
+
id: "email",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "phone",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "letter",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "text",
|
|
32
|
+
},
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
export const relationshipKeys = [
|
|
36
|
+
"",
|
|
37
|
+
"spouse",
|
|
38
|
+
"registeredDomesticPartner",
|
|
39
|
+
"parent",
|
|
40
|
+
"child",
|
|
41
|
+
"sibling",
|
|
42
|
+
"cousin",
|
|
43
|
+
"aunt",
|
|
44
|
+
"uncle",
|
|
45
|
+
"nephew",
|
|
46
|
+
"niece",
|
|
47
|
+
"grandparent",
|
|
48
|
+
"greatGrandparent",
|
|
49
|
+
"inLaw",
|
|
50
|
+
"friend",
|
|
51
|
+
"other",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
export const altContactRelationshipKeys = [
|
|
55
|
+
"familyMember",
|
|
56
|
+
"friend",
|
|
57
|
+
"caseManager",
|
|
58
|
+
"other",
|
|
59
|
+
"noContact",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
export const stateKeys = [
|
|
63
|
+
"",
|
|
64
|
+
"AL",
|
|
65
|
+
"AK",
|
|
66
|
+
"AZ",
|
|
67
|
+
"AR",
|
|
68
|
+
"CA",
|
|
69
|
+
"CO",
|
|
70
|
+
"CT",
|
|
71
|
+
"DE",
|
|
72
|
+
"DC",
|
|
73
|
+
"FL",
|
|
74
|
+
"GA",
|
|
75
|
+
"HI",
|
|
76
|
+
"ID",
|
|
77
|
+
"IL",
|
|
78
|
+
"IN",
|
|
79
|
+
"IA",
|
|
80
|
+
"KS",
|
|
81
|
+
"KY",
|
|
82
|
+
"LA",
|
|
83
|
+
"ME",
|
|
84
|
+
"MD",
|
|
85
|
+
"MA",
|
|
86
|
+
"MI",
|
|
87
|
+
"MN",
|
|
88
|
+
"MS",
|
|
89
|
+
"MO",
|
|
90
|
+
"MT",
|
|
91
|
+
"NE",
|
|
92
|
+
"NV",
|
|
93
|
+
"NH",
|
|
94
|
+
"NJ",
|
|
95
|
+
"NM",
|
|
96
|
+
"NY",
|
|
97
|
+
"NC",
|
|
98
|
+
"ND",
|
|
99
|
+
"OH",
|
|
100
|
+
"OK",
|
|
101
|
+
"OR",
|
|
102
|
+
"PA",
|
|
103
|
+
"RI",
|
|
104
|
+
"SC",
|
|
105
|
+
"SD",
|
|
106
|
+
"TN",
|
|
107
|
+
"TX",
|
|
108
|
+
"UT",
|
|
109
|
+
"VT",
|
|
110
|
+
"VA",
|
|
111
|
+
"WA",
|
|
112
|
+
"WV",
|
|
113
|
+
"WI",
|
|
114
|
+
"WY",
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
export const ethnicityKeys = ["hispanicLatino", "notHispanicLatino"]
|
|
118
|
+
|
|
119
|
+
export const raceKeys = [
|
|
120
|
+
"americanIndianAlaskanNative",
|
|
121
|
+
"asian",
|
|
122
|
+
"blackAfricanAmerican",
|
|
123
|
+
"nativeHawaiianOtherPacificIslander",
|
|
124
|
+
"white",
|
|
125
|
+
"americanIndianAlaskanNativeAndBlackAfricanAmerican",
|
|
126
|
+
"americanIndianAlaskanNativeAndWhite",
|
|
127
|
+
"asianAndWhite",
|
|
128
|
+
"blackAfricanAmericanAndWhite",
|
|
129
|
+
"otherMutliracial",
|
|
130
|
+
]
|
|
131
|
+
|
|
132
|
+
export const genderKeys = [
|
|
133
|
+
"female",
|
|
134
|
+
"male",
|
|
135
|
+
"genderqueerGenderNon-Binary",
|
|
136
|
+
"transFemale",
|
|
137
|
+
"transMale",
|
|
138
|
+
"notListed",
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
export const sexualOrientation = [
|
|
142
|
+
"bisexual",
|
|
143
|
+
"gayLesbianSameGenderLoving",
|
|
144
|
+
"questioningUnsure",
|
|
145
|
+
"straightHeterosexual",
|
|
146
|
+
"notListed",
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
export const howDidYouHear: FieldGroupItem[] = [
|
|
150
|
+
{
|
|
151
|
+
id: "alamedaCountyHCDWebsite",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: "developerWebsite",
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
id: "flyer",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "emailAlert",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: "friend",
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "housingCounselor",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "radioAd",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: "busAd",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: "other",
|
|
176
|
+
},
|
|
177
|
+
]
|
|
178
|
+
|
|
179
|
+
export const phoneNumberKeys = ["work", "home", "cell"]
|
|
180
|
+
|
|
181
|
+
export const preferredUnit: FieldGroupItem[] = [
|
|
182
|
+
{
|
|
183
|
+
id: "studio",
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: "oneBedroom",
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
id: "twoBedroom",
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "threeBedroom",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: "moreThanThreeBedroom",
|
|
196
|
+
},
|
|
197
|
+
]
|
|
198
|
+
|
|
199
|
+
export const bedroomKeys = ["studio", "oneBdrm", "twoBdrm", "threeBdrm"]
|
|
200
|
+
|
|
201
|
+
export const applicationLanguageKeys = [Language.en, Language.es, Language.zh, Language.vi]
|
|
202
|
+
|
|
203
|
+
export const numberOptions = (end: number, start = 1): SelectOption[] => {
|
|
204
|
+
const nums = []
|
|
205
|
+
for (let i = start; i <= end; i++) {
|
|
206
|
+
nums.push({ label: i.toString(), value: i.toString() })
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return nums
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export const FormOptions = (props: FormOptionsProps) => {
|
|
213
|
+
const options = props.options.map((option: string | SelectOption) => {
|
|
214
|
+
if (option == "" || option["value"] == "") {
|
|
215
|
+
return (
|
|
216
|
+
<option value="" key="select-one">
|
|
217
|
+
{t("t.selectOne")}
|
|
218
|
+
</option>
|
|
219
|
+
)
|
|
220
|
+
} else {
|
|
221
|
+
return (
|
|
222
|
+
<option value={option["value"] || option} key={option["value"] || option}>
|
|
223
|
+
{option["label"] || t(`${props.keyPrefix}.${option as string}`)}
|
|
224
|
+
</option>
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
return <>{options}</>
|
|
229
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t } from "./translator"
|
|
2
|
+
|
|
3
|
+
// translationKey must be in the format `key*argumentName:argumentValue*argumentName:argumentValue`
|
|
4
|
+
// any number of arguments can be passed, returns a fully translated string
|
|
5
|
+
export const getTranslationWithArguments = (translationKey: string) => {
|
|
6
|
+
if (translationKey.indexOf("*") >= 0) {
|
|
7
|
+
const [key, ...stringArguments] = translationKey.split("*")
|
|
8
|
+
const argumentsObject = stringArguments.reduce((obj, arg) => {
|
|
9
|
+
const [key, value] = arg.split(":")
|
|
10
|
+
return { ...obj, [key]: value }
|
|
11
|
+
}, {})
|
|
12
|
+
return t(key, argumentsObject)
|
|
13
|
+
} else return t(translationKey)
|
|
14
|
+
}
|