@bloom-housing/ui-components 5.1.1-alpha.1 → 5.1.1-alpha.4

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,64 @@
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
+ ## [5.1.1-alpha.4](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.1.1-alpha.3...@bloom-housing/ui-components@5.1.1-alpha.4) (2022-08-12)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * clean up str variable assignment ([7db94e8](https://github.com/bloom-housing/bloom/commit/7db94e81d65eb7ff7314a435f7d34a93af22049e))
12
+ * fix changing const ([c5b37a9](https://github.com/bloom-housing/bloom/commit/c5b37a9106aab902f11e2a8034ea835c46c53d53))
13
+ * fix html string errors ([1548c60](https://github.com/bloom-housing/bloom/commit/1548c6085b882e8b894bc17d96a096553bf7eccf))
14
+ * remove types from removed dep ([4cd5e14](https://github.com/bloom-housing/bloom/commit/4cd5e148a29b6081f7337f26ed8e9e477e2737a4))
15
+ * replace usage of sanitize-html ([aad2f94](https://github.com/bloom-housing/bloom/commit/aad2f949ae6386d1e460b959808501be1b8c0f06))
16
+
17
+
18
+
19
+
20
+
21
+ ## [5.1.1-alpha.3](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.1.1-alpha.2...@bloom-housing/ui-components@5.1.1-alpha.3) (2022-08-03)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * **expandabletext:** add required strings to expandable text ([03bbc46](https://github.com/bloom-housing/bloom/commit/03bbc46b4f8f910efef0a1f984717da0a65794ed))
27
+ * **expandabletext:** fix stories with passing req prop ([057d8fe](https://github.com/bloom-housing/bloom/commit/057d8feb038e07bb3d6784d1d6d4d068ba72460c)), closes [#2925](https://github.com/bloom-housing/bloom/issues/2925)
28
+ * **expandabletext:** fix tests; remove test prop ([28af8fc](https://github.com/bloom-housing/bloom/commit/28af8fc319190c50b2751d29c251e472e48e6971))
29
+ * option typing with import ([dc195f8](https://github.com/bloom-housing/bloom/commit/dc195f8acb8850bab11eafc80a2cea3f8b6e0de5))
30
+
31
+
32
+ ### Features
33
+
34
+ * **expandabletext:** fix a broken ci check; fix a prop name ([e839c81](https://github.com/bloom-housing/bloom/commit/e839c811b237164b1cd26bbc888db512f66bc6b0))
35
+ * **expandabletext:** fix type usage ([1a406fe](https://github.com/bloom-housing/bloom/commit/1a406fe7c19639e28bb1fdc19fd9e58a25c8bfd1)), closes [#2925](https://github.com/bloom-housing/bloom/issues/2925)
36
+ * **expandabletext:** remove translations;pass markdown props through component ([e21e88a](https://github.com/bloom-housing/bloom/commit/e21e88a5be527ec860b3515c1dc545a186713e06)), closes [#2925](https://github.com/bloom-housing/bloom/issues/2925)
37
+
38
+
39
+ ### BREAKING CHANGES
40
+
41
+ * **expandabletext:** In uses of ExpandableText component, the translations are now being passed down
42
+ instead of done within the component. Any options for the Markdown component used within
43
+ ExpandableText also needs to be passed
44
+
45
+
46
+
47
+
48
+
49
+ ## [5.1.1-alpha.2](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.1.1-alpha.1...@bloom-housing/ui-components@5.1.1-alpha.2) (2022-08-01)
50
+
51
+
52
+ ### Features
53
+
54
+ * **errormessage:** add classname to errormessage; apply styles to Field ([b63be81](https://github.com/bloom-housing/bloom/commit/b63be81f2fa5fc523b5804842d0eb4781ed32054)), closes [#2911](https://github.com/bloom-housing/bloom/issues/2911)
55
+ * **errormessage:** add text color ([74adf72](https://github.com/bloom-housing/bloom/commit/74adf72fcd625ad14c51815dce54d3e7beae5e11)), closes [#2911](https://github.com/bloom-housing/bloom/issues/2911)
56
+ * **forms.scss:** apply styling change to error-message class ([2c30044](https://github.com/bloom-housing/bloom/commit/2c300441c580464be1b69f861b5080e74242166e)), closes [#2911](https://github.com/bloom-housing/bloom/issues/2911)
57
+ * **formsigninerrorbox:** add classnames to undo changes ([fa7e9f7](https://github.com/bloom-housing/bloom/commit/fa7e9f7e235e4a6b750d67d7338bebaace202519)), closes [#2911](https://github.com/bloom-housing/bloom/issues/2911)
58
+ * **textarea:** apply lineheight and margin to textarea ([afbe5e4](https://github.com/bloom-housing/bloom/commit/afbe5e49c081bc85da1d4718e2ea1e6b8cc295b0)), closes [#2911](https://github.com/bloom-housing/bloom/issues/2911)
59
+
60
+
61
+
62
+
63
+
6
64
  ## [5.1.1-alpha.1](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.1.1-alpha.0...@bloom-housing/ui-components@5.1.1-alpha.1) (2022-08-01)
7
65
 
8
66
  **Note:** Version bump only for package @bloom-housing/ui-components
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "5.1.1-alpha.1",
3
+ "version": "5.1.1-alpha.4",
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",
@@ -85,7 +85,6 @@
85
85
  "@types/react-dom": "^16.9.5",
86
86
  "@types/react-text-mask": "^5.4.6",
87
87
  "@types/react-transition-group": "^4.4.0",
88
- "@types/sanitize-html": "^2.6.2",
89
88
  "ag-grid-community": "^26.0.0",
90
89
  "ag-grid-react": "^26.0.0",
91
90
  "aria-autocomplete": "^1.4.0",
@@ -107,10 +106,9 @@
107
106
  "react-tabs": "^3.2.2",
108
107
  "react-text-mask": "^5.4.3",
109
108
  "react-transition-group": "^4.4.1",
110
- "sanitize-html": "^2.7.1",
111
109
  "tailwindcss": "2.2.10",
112
110
  "ts-jest": "^26.4.1",
113
111
  "typesafe-actions": "^5.1.0"
114
112
  },
115
- "gitHead": "e78464e61bc07c2893128c3da038a52f02bc2d69"
113
+ "gitHead": "17b005dd65067cb9cf34d498834c448c20d3d2f6"
116
114
  }
@@ -1,6 +1,5 @@
1
1
  import React, { useState } from "react"
2
- import Markdown from "markdown-to-jsx"
3
- import { t } from "../helpers/translator"
2
+ import Markdown, { MarkdownOptions } from "markdown-to-jsx"
4
3
  import "./ExpandableText.scss"
5
4
 
6
5
  export interface ExpandableTextProps {
@@ -8,6 +7,11 @@ export interface ExpandableTextProps {
8
7
  expand?: boolean
9
8
  maxLength?: number
10
9
  className?: string
10
+ strings: {
11
+ readMore: string
12
+ readLess: string
13
+ }
14
+ markdownProps?: MarkdownOptions
11
15
  }
12
16
 
13
17
  const getText = (text: string, expanded: boolean, maxLength: number) => {
@@ -22,10 +26,14 @@ const getText = (text: string, expanded: boolean, maxLength: number) => {
22
26
  return position > 0 ? text.substring(0, position) + "..." : text.substring(0, maxLength) + "..."
23
27
  }
24
28
 
25
- const moreLessButton = (expanded: boolean, setExpanded: (newValue: boolean) => void) => {
29
+ const moreLessButton = (
30
+ expanded: boolean,
31
+ setExpanded: (newValue: boolean) => void,
32
+ strings: ExpandableTextProps["strings"]
33
+ ) => {
26
34
  return (
27
35
  <span className="button-toggle" onClick={() => setExpanded(!expanded)}>
28
- {expanded ? t("t.less") : t("t.more")}
36
+ {expanded ? strings?.readLess : strings?.readMore}
29
37
  </span>
30
38
  )
31
39
  }
@@ -38,13 +46,14 @@ const ExpandableText = (props: ExpandableTextProps) => {
38
46
  if (!props.children) return null
39
47
 
40
48
  if (props.children.length > maxLength) {
41
- button = moreLessButton(expanded, setExpanded)
49
+ button = moreLessButton(expanded, setExpanded, props.strings)
42
50
  }
43
51
  return (
44
- <div className={`expandable-text ${props.className}`}>
52
+ <div className={`expandable-text ${props?.className}`}>
53
+ {" "}
45
54
  <Markdown
46
55
  children={getText(props.children, expanded, maxLength)}
47
- options={{ disableParsingRawHTML: true }}
56
+ options={props.markdownProps}
48
57
  />
49
58
  {button}
50
59
  </div>
@@ -55,7 +55,11 @@ const HouseholdSizeField = (props: HouseholdSizeFieldProps) => {
55
55
  }
56
56
  />
57
57
  </span>
58
- <ErrorMessage id={"householdsize-error"} error={!!error}>
58
+ <ErrorMessage
59
+ id={"householdsize-error"}
60
+ error={!!error}
61
+ className="block mt-0 line-normal text-red-700"
62
+ >
59
63
  <AlertBox type="alert" inverted onClose={() => clearErrors()}>
60
64
  {t("application.household.dontQualifyHeader")}
61
65
  </AlertBox>
@@ -6,6 +6,7 @@
6
6
  @apply p-2;
7
7
  @apply text-gray-900;
8
8
  @apply bg-gray-200;
9
+ @apply align-top;
9
10
  font-size: 1rem;
10
11
  }
11
12
 
@@ -26,6 +27,8 @@
26
27
  @apply text-xs;
27
28
  @apply text-alert;
28
29
  @apply block;
30
+ @apply leading-5;
31
+ @apply mt-2;
29
32
  }
30
33
 
31
34
  .textarea-label {
@@ -326,9 +326,12 @@ input[type="number"] {
326
326
  }
327
327
 
328
328
  .error-message {
329
+ display: inline-block;
329
330
  @apply text-sm;
330
331
  @apply text-red-700;
331
332
  @apply tracking-wide;
333
+ @apply leading-5;
334
+ @apply mt-2;
332
335
  }
333
336
 
334
337
  .field-sub-note {
@@ -1,5 +1,5 @@
1
1
  import * as React from "react"
2
- import sanitizeHtml from "sanitize-html"
2
+ import Markdown from "markdown-to-jsx"
3
3
 
4
4
  export interface Address {
5
5
  city?: string
@@ -19,20 +19,28 @@ export interface MultiLineAddressProps {
19
19
  const MultiLineAddress = ({ address }: MultiLineAddressProps) => {
20
20
  if (!address) return null
21
21
 
22
+ const makeHtmlString = (address: Address) => {
23
+ let str = ""
24
+
25
+ if (address.placeName) {
26
+ str += `${address.placeName} <br />`
27
+ }
28
+
29
+ if (address.street || address.street2) {
30
+ str += `${address.street || ""} ${address.street2 || ""} <br />`
31
+ }
32
+
33
+ if (address.city || address.state || address.zipCode) {
34
+ str += `${address.city && `${address.city} ,`} ${address.state} ${address.zipCode}`
35
+ }
36
+
37
+ return str
38
+ }
39
+
22
40
  return (
23
- <span
24
- dangerouslySetInnerHTML={{
25
- __html: sanitizeHtml(
26
- `
27
- ${address.placeName ? `${address.placeName} <br />` : ""}
28
- ${address.street || ""} ${address.street2 || ""}
29
- ${address.street || address.street2 ? `<br />` : ""}
30
- ${address.city}
31
- ${address.city && (address.state || address.zipCode) ? "," : ""} ${address.state} ${` `}
32
- ${address.zipCode}
33
- `
34
- ),
35
- }}
41
+ <Markdown
42
+ options={{ disableParsingRawHTML: false }}
43
+ children={`<span>${makeHtmlString(address)}</span>`}
36
44
  />
37
45
  )
38
46
  }
@@ -1,11 +1,21 @@
1
1
  import React from "react"
2
2
 
3
- const ErrorMessage = (props: { id?: string; error?: boolean; children?: React.ReactNode }) => {
3
+ const ErrorMessage = (props: {
4
+ id?: string
5
+ error?: boolean
6
+ children?: React.ReactNode
7
+ className?: string
8
+ }) => {
4
9
  if (props.error) {
10
+ const classes = ["error-message"]
11
+ if (props.className) {
12
+ classes.push(props.className)
13
+ }
14
+
5
15
  return (
6
16
  <span
7
17
  id={props.id}
8
- className="error-message"
18
+ className={classes.join(" ")}
9
19
  aria-live="assertive"
10
20
  data-test-id={"error-message"}
11
21
  >
@@ -24,7 +24,11 @@ const FormSignInErrorBox = ({ networkStatus, errors, errorMessageId }: FormSignI
24
24
  )}
25
25
 
26
26
  {networkStatus.content?.error && Object.entries(errors).length === 0 && (
27
- <ErrorMessage id={`form-sign-in-${errorMessageId}-error`} error={!!networkStatus.content}>
27
+ <ErrorMessage
28
+ id={`form-sign-in-${errorMessageId}-error`}
29
+ error={!!networkStatus.content}
30
+ className="block mt-0 leading-normal text-red-700"
31
+ >
28
32
  <AlertBox type={"alert"} inverted onClose={() => networkStatus.reset()}>
29
33
  {networkStatus.content.title}
30
34
  </AlertBox>