@bloom-housing/ui-components 5.1.1-alpha.2 → 5.1.1-alpha.5

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,60 @@
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.5](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.1.1-alpha.4...@bloom-housing/ui-components@5.1.1-alpha.5) (2022-08-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * ensure listing card link region covers image tags ([#2943](https://github.com/bloom-housing/bloom/issues/2943)) ([ebc8d48](https://github.com/bloom-housing/bloom/commit/ebc8d48556b587a4ad8fc9bc294be54b69e88462))
12
+
13
+
14
+
15
+
16
+
17
+ ## [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)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * clean up str variable assignment ([7db94e8](https://github.com/bloom-housing/bloom/commit/7db94e81d65eb7ff7314a435f7d34a93af22049e))
23
+ * fix changing const ([c5b37a9](https://github.com/bloom-housing/bloom/commit/c5b37a9106aab902f11e2a8034ea835c46c53d53))
24
+ * fix html string errors ([1548c60](https://github.com/bloom-housing/bloom/commit/1548c6085b882e8b894bc17d96a096553bf7eccf))
25
+ * remove types from removed dep ([4cd5e14](https://github.com/bloom-housing/bloom/commit/4cd5e148a29b6081f7337f26ed8e9e477e2737a4))
26
+ * replace usage of sanitize-html ([aad2f94](https://github.com/bloom-housing/bloom/commit/aad2f949ae6386d1e460b959808501be1b8c0f06))
27
+
28
+
29
+
30
+
31
+
32
+ ## [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)
33
+
34
+
35
+ ### Bug Fixes
36
+
37
+ * **expandabletext:** add required strings to expandable text ([03bbc46](https://github.com/bloom-housing/bloom/commit/03bbc46b4f8f910efef0a1f984717da0a65794ed))
38
+ * **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)
39
+ * **expandabletext:** fix tests; remove test prop ([28af8fc](https://github.com/bloom-housing/bloom/commit/28af8fc319190c50b2751d29c251e472e48e6971))
40
+ * option typing with import ([dc195f8](https://github.com/bloom-housing/bloom/commit/dc195f8acb8850bab11eafc80a2cea3f8b6e0de5))
41
+
42
+
43
+ ### Features
44
+
45
+ * **expandabletext:** fix a broken ci check; fix a prop name ([e839c81](https://github.com/bloom-housing/bloom/commit/e839c811b237164b1cd26bbc888db512f66bc6b0))
46
+ * **expandabletext:** fix type usage ([1a406fe](https://github.com/bloom-housing/bloom/commit/1a406fe7c19639e28bb1fdc19fd9e58a25c8bfd1)), closes [#2925](https://github.com/bloom-housing/bloom/issues/2925)
47
+ * **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)
48
+
49
+
50
+ ### BREAKING CHANGES
51
+
52
+ * **expandabletext:** In uses of ExpandableText component, the translations are now being passed down
53
+ instead of done within the component. Any options for the Markdown component used within
54
+ ExpandableText also needs to be passed
55
+
56
+
57
+
58
+
59
+
6
60
  ## [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)
7
61
 
8
62
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "5.1.1-alpha.2",
3
+ "version": "5.1.1-alpha.5",
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": "011a850750b1c9a53a364984e1216797ff25351c"
113
+ "gitHead": "e927a2e8e152e91cbb10ba0e9c13dd3ba51cc5e0"
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>
@@ -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
  }
@@ -65,6 +65,7 @@
65
65
  .is-card-link::after {
66
66
  content: "";
67
67
  position: absolute;
68
+ z-index: 10;
68
69
  left: 0;
69
70
  top: 0;
70
71
  right: 0;