@bloom-housing/ui-components 4.4.1-alpha.9 → 5.0.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +930 -0
  2. package/index.ts +6 -5
  3. package/package.json +8 -3
  4. package/src/actions/Button.tsx +2 -2
  5. package/src/actions/ExpandableContent.tsx +9 -5
  6. package/src/blocks/ImageCard.tsx +3 -3
  7. package/src/blocks/StandardCard.docs.mdx +34 -0
  8. package/src/blocks/StandardCard.scss +33 -0
  9. package/src/blocks/StandardCard.tsx +37 -0
  10. package/src/config/index.ts +0 -1
  11. package/src/forms/FieldGroup.tsx +1 -1
  12. package/src/forms/HouseholdSizeField.tsx +2 -1
  13. package/src/global/tables.scss +7 -1
  14. package/src/helpers/formOptions.tsx +0 -9
  15. package/src/helpers/preferences.tsx +3 -314
  16. package/src/icons/Icon.tsx +22 -3
  17. package/src/locales/es.json +18 -0
  18. package/src/locales/general.json +23 -0
  19. package/src/{prototypes → navigation}/SideNav.scss +15 -9
  20. package/src/navigation/SideNav.tsx +39 -0
  21. package/src/notifications/ApplicationStatus.tsx +2 -2
  22. package/src/overlays/Drawer.tsx +1 -1
  23. package/src/overlays/Modal.scss +5 -0
  24. package/src/overlays/Modal.tsx +19 -3
  25. package/src/page_components/listing/ListingsGroup.tsx +2 -2
  26. package/src/page_components/listing/listing_sidebar/ExpandableSection.tsx +34 -0
  27. package/src/page_components/listing/listing_sidebar/QuantityRowSection.tsx +1 -0
  28. package/src/page_components/sign-in/FormSignInMFACode.tsx +7 -3
  29. package/src/page_components/sign-in/FormSignInMFAType.tsx +7 -8
  30. package/src/page_components/sign-in/FormTerms.tsx +9 -27
  31. package/src/tables/StandardTable.tsx +17 -4
  32. package/src/authentication/AuthContext.ts +0 -386
  33. package/src/authentication/RequireLogin.tsx +0 -89
  34. package/src/authentication/index.ts +0 -5
  35. package/src/authentication/timeout.tsx +0 -128
  36. package/src/authentication/token.ts +0 -17
  37. package/src/authentication/useRequireLoggedInUser.ts +0 -19
  38. package/src/config/ConfigContext.tsx +0 -36
  39. package/src/helpers/tableSummaries.tsx +0 -104
  40. package/src/notifications/index.ts +0 -4
  41. package/src/page_components/listing/UnitTables.tsx +0 -122
  42. package/src/page_components/listing/listing_sidebar/WhatToExpect.tsx +0 -22
  43. package/src/prototypes/SideNav.tsx +0 -14
package/index.ts CHANGED
@@ -16,9 +16,9 @@ export * from "./src/blocks/ImageCard"
16
16
  export * from "./src/blocks/InfoCard"
17
17
  export * from "./src/blocks/StatusBar"
18
18
  export * from "./src/blocks/ViewItem"
19
+ export * from "./src/blocks/StandardCard"
19
20
 
20
21
  /* Contexts */
21
- export * from "./src/authentication"
22
22
  export * from "./src/config"
23
23
 
24
24
  /* Footers */
@@ -64,7 +64,6 @@ export * from "./src/helpers/numberOrdinal"
64
64
  export * from "./src/helpers/OneLineAddress"
65
65
  export * from "./src/helpers/preferences"
66
66
  export * from "./src/helpers/resolveObject"
67
- export * from "./src/helpers/tableSummaries"
68
67
  export * from "./src/helpers/translator"
69
68
  export * from "./src/helpers/useIntersect"
70
69
  export * from "./src/helpers/useMutate"
@@ -85,11 +84,14 @@ export * from "./src/navigation/TabNav"
85
84
  export * from "./src/navigation/Tabs"
86
85
 
87
86
  /* Notifications */
87
+ export * from "./src/notifications/AlertBox"
88
+ export * from "./src/notifications/AlertNotice"
88
89
  export * from "./src/notifications/ApplicationStatus"
89
90
  export * from "./src/notifications/ErrorMessage"
91
+ export * from "./src/notifications/SiteAlert"
90
92
  export * from "./src/notifications/StatusAside"
91
93
  export * from "./src/notifications/StatusMessage"
92
- export * from "./src/notifications"
94
+ export * from "./src/notifications/alertTypes"
93
95
 
94
96
  /* Overlays */
95
97
  export * from "./src/overlays/Overlay"
@@ -106,7 +108,6 @@ export * from "./src/page_components/listing/ListingDetailHeader"
106
108
  export * from "./src/page_components/listing/ListingDetails"
107
109
  export * from "./src/page_components/listing/ListingMap"
108
110
  export * from "./src/page_components/listing/ListingsGroup"
109
- export * from "./src/page_components/listing/UnitTables"
110
111
  export * from "./src/page_components/listing/listing_sidebar/GetApplication"
111
112
  export * from "./src/page_components/listing/listing_sidebar/Contact"
112
113
  export * from "./src/page_components/listing/listing_sidebar/ListingUpdated"
@@ -116,7 +117,7 @@ export * from "./src/page_components/listing/listing_sidebar/ReferralApplication
116
117
  export * from "./src/page_components/listing/listing_sidebar/ContactAddress"
117
118
  export * from "./src/page_components/listing/listing_sidebar/SubmitApplication"
118
119
  export * from "./src/page_components/listing/listing_sidebar/QuantityRowSection"
119
- export * from "./src/page_components/listing/listing_sidebar/WhatToExpect"
120
+ export * from "./src/page_components/listing/listing_sidebar/ExpandableSection"
120
121
  export * from "./src/page_components/listing/listing_sidebar/events/DownloadLotteryResults"
121
122
  export * from "./src/page_components/listing/listing_sidebar/events/EventSection"
122
123
  export * from "./src/page_components/sign-in/FormTerms"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "4.4.1-alpha.9",
3
+ "version": "5.0.0",
4
4
  "author": "Sean Albert <sean.albert@exygy.com>",
5
5
  "description": "Shared user interface components for Bloom affordable housing system",
6
6
  "homepage": "https://github.com/bloom-housing/bloom/tree/master/shared/ui-components",
@@ -69,7 +69,10 @@
69
69
  "webpack": "^4.44.2"
70
70
  },
71
71
  "dependencies": {
72
- "@bloom-housing/backend-core": "^4.4.1-alpha.7",
72
+ "@fortawesome/fontawesome-svg-core": "^6.1.1",
73
+ "@fortawesome/free-regular-svg-icons": "^6.1.1",
74
+ "@fortawesome/free-solid-svg-icons": "^6.1.1",
75
+ "@fortawesome/react-fontawesome": "^0.1.18",
73
76
  "@mapbox/mapbox-sdk": "^0.13.0",
74
77
  "@types/body-scroll-lock": "^2.6.1",
75
78
  "@types/jwt-decode": "^2.2.1",
@@ -89,6 +92,7 @@
89
92
  "jwt-decode": "^2.2.0",
90
93
  "markdown-to-jsx": "^6.11.4",
91
94
  "nanoid": "^3.1.12",
95
+ "node-polyglot": "^2.4.0",
92
96
  "react": "^17.0.2",
93
97
  "react-accessible-accordion": "^3.3.5",
94
98
  "react-beautiful-dnd": "^13.1.0",
@@ -101,7 +105,8 @@
101
105
  "react-text-mask": "^5.4.3",
102
106
  "react-transition-group": "^4.4.1",
103
107
  "tailwindcss": "2.2.10",
108
+ "ts-jest": "^26.4.1",
104
109
  "typesafe-actions": "^5.1.0"
105
110
  },
106
- "gitHead": "d2f7e17b4ff41e2020e1fe535b2d0ec3e72fb7f1"
111
+ "gitHead": "6af474347ea32b98bf8a216704cc12efcd838ff6"
107
112
  }
@@ -1,14 +1,14 @@
1
1
  import * as React from "react"
2
2
  import "./Button.scss"
3
3
  import { AppearanceProps, classNamesForAppearanceTypes } from "../global/AppearanceTypes"
4
- import { Icon, IconSize, IconTypes } from "../icons/Icon"
4
+ import { Icon, IconSize, UniversalIconType } from "../icons/Icon"
5
5
 
6
6
  export interface ButtonProps extends AppearanceProps {
7
7
  id?: string
8
8
  type?: "button" | "submit" | "reset"
9
9
  children: React.ReactNode
10
10
  onClick?: (e: React.MouseEvent) => void
11
- icon?: IconTypes
11
+ icon?: UniversalIconType
12
12
  iconPlacement?: "left" | "right"
13
13
  iconSize?: IconSize
14
14
  // TODO: inlineIcon is deprecated
@@ -1,15 +1,20 @@
1
1
  import React, { useState } from "react"
2
- import { t } from "@bloom-housing/ui-components"
3
2
 
4
3
  type ExpandableContentProps = {
5
4
  children: React.ReactChild
5
+ strings: {
6
+ readMore?: string
7
+ readLess?: string
8
+ }
9
+ className?: string
6
10
  }
7
11
 
8
- const ExpandableContent = ({ children }: ExpandableContentProps) => {
12
+ const ExpandableContent = ({ children, strings, className }: ExpandableContentProps) => {
9
13
  const [isExpanded, setExpanded] = useState(false)
14
+ const rootClassNames = className ? `${className}` : undefined
10
15
 
11
16
  return (
12
- <div>
17
+ <div className={rootClassNames}>
13
18
  <button
14
19
  type="button"
15
20
  className="button is-unstyled m-0 no-underline has-toggle"
@@ -18,9 +23,8 @@ const ExpandableContent = ({ children }: ExpandableContentProps) => {
18
23
  setExpanded(!isExpanded)
19
24
  }}
20
25
  >
21
- {t(isExpanded ? "t.readLess" : "t.readMore")}
26
+ {isExpanded ? strings.readLess : strings.readMore}
22
27
  </button>
23
-
24
28
  {isExpanded && <div className="mt-6">{children}</div>}
25
29
  </div>
26
30
  )
@@ -6,19 +6,19 @@ import { Tag } from "../text/Tag"
6
6
  import { ApplicationStatusType } from "../global/ApplicationStatusType"
7
7
  import { AppearanceStyleType } from "../global/AppearanceTypes"
8
8
  import { t } from "../helpers/translator"
9
- import { Icon, IconFillColors, IconTypes } from "../icons/Icon"
9
+ import { Icon, IconFillColors, UniversalIconType } from "../icons/Icon"
10
10
 
11
11
  export interface StatusBarType {
12
12
  status?: ApplicationStatusType
13
13
  content: string
14
14
  subContent?: string
15
15
  hideIcon?: boolean
16
- iconType?: IconTypes
16
+ iconType?: UniversalIconType
17
17
  }
18
18
 
19
19
  export interface ImageTag {
20
20
  text?: string
21
- iconType?: IconTypes
21
+ iconType?: UniversalIconType
22
22
  iconColor?: string
23
23
  }
24
24
 
@@ -0,0 +1,34 @@
1
+ import { Canvas, Story, ArgsTable } from "@storybook/addon-docs"
2
+ import { StandardCard } from "./StandardCard"
3
+
4
+ # Standard Card
5
+
6
+ The standard card component displays a title with a child element (e.g table) and optional footer.
7
+
8
+ <Canvas>
9
+ <Story id="blocks-standard-card" />
10
+ </Canvas>
11
+
12
+
13
+ ## Component Properties
14
+
15
+ <ArgsTable of={StandardCard} />
16
+
17
+ ## Theming Variables
18
+
19
+ <Canvas>
20
+ <Story id="blocks-standard-card--style-overrides" />
21
+ </Canvas>
22
+
23
+ You can apply CSS variables to the `.standard-card` selector to customize the appearance of the component.
24
+
25
+ | Name | Type | Description | Default |
26
+ | ---------------------------- | ----- | --------------------------------------------------------- | ------------------------------- |
27
+ | `--font-family` | Font | Title font family | `--bloom-font-alt-sans` |
28
+ | `--border-radius` | Size | Card border radius | `--bloom-rounded-lg` |
29
+ | `--border-width` | Size | Card border width | `--bloom-border-1` |
30
+ | `--border-color` | Size | Card border color | `--bloom-color-gray-500` |
31
+ | `--title-color` | Color | Card title color | `--bloom-color-gray-900` |
32
+ | `--background-color` | Size | Card background color | `--bloom-color-white` |
33
+ | `--blank-color` | Color | Empty state text color | `--bloom-color-gray-750` |
34
+ | `--blank-background` | Color | Empty state background color | `--bloom-color-gray-200` |
@@ -0,0 +1,33 @@
1
+ .standard-card {
2
+ --font-family: var(--bloom-font-alt-sans);
3
+ --border-radius: var(--bloom-rounded-lg);
4
+ --border-width: var(--bloom-border-1);
5
+ --border-color: var(--bloom-color-gray-500);
6
+ --title-color: var(--bloom-color-gray-900);
7
+ --background-color: var(--bloom-color-white);
8
+ --blank-color: var(--bloom-color-gray-750);
9
+ --blank-background: var(--bloom-color-gray-200);
10
+ }
11
+
12
+ .standard-card__inner {
13
+ @apply overflow-hidden;
14
+ border-radius: var(--border-radius);
15
+ border: var(--border-width) solid var(--border-color);
16
+ background-color: var(--background-color);
17
+ }
18
+
19
+ .standard-card__title {
20
+ color: var(--title-color);
21
+ font-family: var(--font-family);
22
+ padding: var(--bloom-s6) var(--bloom-s6) var(--bloom-s2) var(--bloom-s7);
23
+ }
24
+
25
+ .standard-card__blank {
26
+ color: var(--blank-color);
27
+ background-color: var(--blank-background);
28
+ padding: var(--bloom-s3) var(--bloom-s7);
29
+ }
30
+
31
+ .standard-card__footer {
32
+ margin-top: var(--bloom-s3);
33
+ }
@@ -0,0 +1,37 @@
1
+ import React from "react"
2
+ import { Heading } from "../headers/Heading"
3
+ import "./StandardCard.scss"
4
+
5
+ export interface StandardCardProps {
6
+ className?: string
7
+ title?: string
8
+ children?: React.ReactNode
9
+ footer?: React.ReactNode
10
+ emptyStateMessage: string
11
+ }
12
+
13
+ const StandardCard = ({
14
+ className = "",
15
+ title,
16
+ children,
17
+ footer,
18
+ emptyStateMessage,
19
+ }: StandardCardProps) => {
20
+ return (
21
+ <div className={`standard-card ${className}`}>
22
+ <div className="standard-card__inner">
23
+ {title && (
24
+ <Heading className="standard-card__title" priority={3}>
25
+ {title}
26
+ </Heading>
27
+ )}
28
+
29
+ {children ? children : <div className="standard-card__blank">{emptyStateMessage}</div>}
30
+ </div>
31
+
32
+ {footer && <div className="standard-card__footer">{footer}</div>}
33
+ </div>
34
+ )
35
+ }
36
+
37
+ export { StandardCard as default, StandardCard }
@@ -1,2 +1 @@
1
- export { ConfigProvider, ConfigContext } from "./ConfigContext"
2
1
  export * from "./NavigationContext"
@@ -103,7 +103,7 @@ const FieldGroup = ({
103
103
 
104
104
  {item.description && (
105
105
  <div className="ml-8 -mt-1 mb-5">
106
- <ExpandableContent>
106
+ <ExpandableContent strings={{ readMore: t("t.readMore"), readLess: t("t.readLess") }}>
107
107
  <p className="field-note mb-2 -mt-2">{item.description}</p>
108
108
  </ExpandableContent>
109
109
  </div>
@@ -1,7 +1,8 @@
1
1
  import React from "react"
2
2
  import { t } from "../helpers/translator"
3
3
  import { ErrorMessage } from "../notifications/ErrorMessage"
4
- import { AlertBox, AlertNotice } from "../notifications"
4
+ import { AlertBox } from "../notifications/AlertBox"
5
+ import { AlertNotice } from "../notifications/AlertNotice"
5
6
  import { UseFormMethods, FieldError } from "react-hook-form"
6
7
 
7
8
  export interface HouseholdSizeFieldProps {
@@ -86,7 +86,7 @@ table {
86
86
  }
87
87
 
88
88
  thead tr th {
89
- @apply border-0;
89
+ @apply border-gray-450;
90
90
  @apply py-2;
91
91
  background: transparent;
92
92
  }
@@ -102,6 +102,9 @@ table {
102
102
  @apply border-b;
103
103
  background: transparent;
104
104
  }
105
+ tr:last-child td {
106
+ @apply border-b-0;
107
+ }
105
108
  }
106
109
  &.is-flush-left {
107
110
  thead tr th:first-of-type {
@@ -367,6 +370,9 @@ table.td-plain {
367
370
  .table__thumbnail img {
368
371
  @apply -my-1;
369
372
  }
373
+ .table__is-dragging {
374
+ @apply border-t;
375
+ }
370
376
  }
371
377
 
372
378
  .table__draggable-cell {
@@ -1,6 +1,5 @@
1
1
  import * as React from "react"
2
2
  import { t } from "./translator"
3
- import { Language } from "@bloom-housing/backend-core/types"
4
3
  import { SelectOption } from "../forms/Select"
5
4
 
6
5
  export interface FormOptionsProps {
@@ -8,14 +7,6 @@ export interface FormOptionsProps {
8
7
  keyPrefix?: string
9
8
  }
10
9
 
11
- export const applicationLanguageKeys = [Language.en, Language.es, Language.zh, Language.vi]
12
-
13
- export enum RoleOption {
14
- Administrator = "administrator",
15
- Partner = "partner",
16
- }
17
- export const roleKeys = Object.values(RoleOption)
18
-
19
10
  export const numberOptions = (end: number, start = 1): SelectOption[] => {
20
11
  const nums = []
21
12
  for (let i = start; i <= end; i++) {