@bloom-housing/ui-components 4.0.1-alpha.14 → 4.0.1-alpha.18

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,44 @@
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
+ ## [4.0.1-alpha.18](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.17...@bloom-housing/ui-components@4.0.1-alpha.18) (2022-01-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * ensure dayjs parsing strings will work as expected ([eb44939](https://github.com/bloom-housing/bloom/commit/eb449395ebea3a3b4b58eb217df1e1313c722a0d))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.0.1-alpha.17](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.16...@bloom-housing/ui-components@4.0.1-alpha.17) (2022-01-07)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * listings group expandable section css updates ([#2377](https://github.com/bloom-housing/bloom/issues/2377)) ([fba77ef](https://github.com/bloom-housing/bloom/commit/fba77efc25ccb213a0e18a8b58ddf8ada07fbb8c))
23
+
24
+
25
+
26
+
27
+
28
+ ## [4.0.1-alpha.16](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.15...@bloom-housing/ui-components@4.0.1-alpha.16) (2022-01-07)
29
+
30
+ **Note:** Version bump only for package @bloom-housing/ui-components
31
+
32
+
33
+
34
+
35
+
36
+ ## [4.0.1-alpha.15](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.14...@bloom-housing/ui-components@4.0.1-alpha.15) (2022-01-07)
37
+
38
+ **Note:** Version bump only for package @bloom-housing/ui-components
39
+
40
+
41
+
42
+
43
+
6
44
  ## [4.0.1-alpha.14](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.13...@bloom-housing/ui-components@4.0.1-alpha.14) (2022-01-04)
7
45
 
8
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "4.0.1-alpha.14",
3
+ "version": "4.0.1-alpha.18",
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,7 @@
69
69
  "webpack": "^4.44.2"
70
70
  },
71
71
  "dependencies": {
72
- "@bloom-housing/backend-core": "^3.0.2-alpha.10",
72
+ "@bloom-housing/backend-core": "^3.0.2-alpha.12",
73
73
  "@mapbox/mapbox-sdk": "^0.13.0",
74
74
  "@types/body-scroll-lock": "^2.6.1",
75
75
  "@types/jwt-decode": "^2.2.1",
@@ -82,9 +82,9 @@
82
82
  "@types/react-transition-group": "^4.4.0",
83
83
  "axios": "0.21.1",
84
84
  "body-scroll-lock": "^3.1.5",
85
+ "dayjs": "^1.10.7",
85
86
  "jwt-decode": "^2.2.0",
86
87
  "markdown-to-jsx": "^6.11.4",
87
- "moment": "^2.29.1",
88
88
  "nanoid": "^3.1.12",
89
89
  "react": "^17.0.2",
90
90
  "react-accessible-accordion": "^3.3.5",
@@ -100,5 +100,5 @@
100
100
  "tailwindcss": "2.2.10",
101
101
  "typesafe-actions": "^5.1.0"
102
102
  },
103
- "gitHead": "6cc3b8fcf9901a2a1390d97dadd4f08cdbba876a"
103
+ "gitHead": "45721de57d426c46e2879f6107420d42e64195a9"
104
104
  }
@@ -1,7 +1,9 @@
1
1
  import React from "react"
2
2
  import { t } from "../helpers/translator"
3
3
  import { Field } from "./Field"
4
- import moment from "moment"
4
+ import dayjs from "dayjs"
5
+ import customParseFormat from "dayjs/plugin/customParseFormat"
6
+ dayjs.extend(customParseFormat)
5
7
  import { UseFormMethods, FieldError, DeepMap } from "react-hook-form"
6
8
 
7
9
  export type DOBFieldValues = {
@@ -39,7 +41,7 @@ const DOBField = (props: DOBFieldProps) => {
39
41
  const validateAge = (value: string) => {
40
42
  return (
41
43
  parseInt(value) > 1900 &&
42
- moment(`${birthMonth}/${birthDay}/${value}`, "MM/DD/YYYY") < moment().subtract(18, "years")
44
+ dayjs(`${birthMonth}/${birthDay}/${value}`, "MM/DD/YYYY") < dayjs().subtract(18, "years")
43
45
  )
44
46
  }
45
47
 
@@ -108,7 +110,7 @@ const DOBField = (props: DOBFieldProps) => {
108
110
  validate: {
109
111
  yearRange: (value: string) => {
110
112
  if (props.required && value && parseInt(value) < 1900) return false
111
- if (props.required && value && parseInt(value) > moment().year() + 10) return false
113
+ if (props.required && value && parseInt(value) > dayjs().year() + 10) return false
112
114
  if (!props.required && !value?.length) return true
113
115
  if (value?.length && validateAge18) return validateAge(value)
114
116
  return true
@@ -1,7 +1,7 @@
1
1
  import React from "react"
2
2
  import { t } from "../helpers/translator"
3
3
  import { Field } from "./Field"
4
- import moment from "moment"
4
+ import dayjs from "dayjs"
5
5
  import { UseFormMethods, FieldError, DeepMap } from "react-hook-form"
6
6
 
7
7
  export type DateFieldValues = {
@@ -97,7 +97,7 @@ const DateField = (props: DateFieldProps) => {
97
97
  validate: {
98
98
  yearRange: (value: string) => {
99
99
  if (props.required && value && parseInt(value) < 1900) return false
100
- if (props.required && value && parseInt(value) > moment().year() + 10) return false
100
+ if (props.required && value && parseInt(value) > dayjs().year() + 10) return false
101
101
  if (!props.required && !value?.length) return true
102
102
  return true
103
103
  },
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from "react"
2
- import moment from "moment"
2
+ import dayjs from "dayjs"
3
3
  import { t } from "../helpers/translator"
4
4
  import { ErrorMessage } from "../notifications/ErrorMessage"
5
5
  import { Field } from "./Field"
@@ -32,7 +32,7 @@ export type TimeFieldProps = {
32
32
  }
33
33
 
34
34
  export const formatDateToTimeField = (date: Date) => {
35
- const dateObj = moment(date)
35
+ const dateObj = dayjs(date)
36
36
 
37
37
  return {
38
38
  hours: dateObj.format("hh"),
@@ -1,8 +1,10 @@
1
- import moment from "moment"
1
+ import dayjs from "dayjs"
2
+ import utc from "dayjs/plugin/utc"
3
+ dayjs.extend(utc)
2
4
 
3
5
  export const dateToString = (submissionDate: Date) => {
4
6
  if (!submissionDate) return null
5
- const formattedSubmissionDate = moment(new Date(submissionDate)).utc()
7
+ const formattedSubmissionDate = dayjs(new Date(submissionDate)).utc()
6
8
  const month = formattedSubmissionDate.format("MMMM")
7
9
  const day = formattedSubmissionDate.format("DD")
8
10
  const year = formattedSubmissionDate.format("YYYY")
@@ -17,6 +17,7 @@ import {
17
17
  CloseRound,
18
18
  CloseSmall,
19
19
  Cross,
20
+ DoubleHouse,
20
21
  Down,
21
22
  Download,
22
23
  Draggable,
@@ -75,6 +76,7 @@ const IconMap = {
75
76
  closeRound: CloseRound,
76
77
  closeSmall: CloseSmall,
77
78
  cross: Cross,
79
+ doubleHouse: DoubleHouse,
78
80
  down: Down,
79
81
  download: Download,
80
82
  draggable: Draggable,
@@ -243,6 +243,20 @@ export const Cross = (props: IconProps) => {
243
243
  )
244
244
  }
245
245
 
246
+ export const DoubleHouse = (props: IconProps) => {
247
+ return (
248
+ <svg viewBox="0 0 32 32" fill={props.fill ?? "currentColor"}>
249
+ <path d="M8.68 24.053c0.173 0 0.347-0.080 0.48-0.213 0.12-0.12 0.187-0.28 0.187-0.467 0-0.16-0.067-0.333-0.187-0.469-0.253-0.251-0.707-0.24-0.947 0-0.12 0.122-0.2 0.294-0.2 0.469 0 0.187 0.080 0.347 0.2 0.478 0.12 0.122 0.293 0.202 0.467 0.202z"></path>
250
+ <path d="M18.019 22.714h1.384c0.368 0 0.667-0.299 0.667-0.667s-0.299-0.667-0.667-0.667h-1.384c-0.368 0-0.667 0.299-0.667 0.667s0.298 0.667 0.667 0.667z"></path>
251
+ <path d="M18.019 18.714h1.384c0.368 0 0.667-0.299 0.667-0.667s-0.299-0.667-0.667-0.667h-1.384c-0.368 0-0.667 0.299-0.667 0.667s0.298 0.667 0.667 0.667z"></path>
252
+ <path d="M23.354 22.714h1.333c0.368 0 0.667-0.299 0.667-0.667s-0.299-0.667-0.667-0.667h-1.333c-0.368 0-0.667 0.299-0.667 0.667s0.298 0.667 0.667 0.667z"></path>
253
+ <path d="M23.354 26.715h1.333c0.368 0 0.667-0.299 0.667-0.667s-0.299-0.667-0.667-0.667h-1.333c-0.368 0-0.667 0.299-0.667 0.667s0.298 0.667 0.667 0.667z"></path>
254
+ <path d="M23.354 18.714h1.333c0.368 0 0.667-0.299 0.667-0.667s-0.299-0.667-0.667-0.667h-1.333c-0.368 0-0.667 0.299-0.667 0.667s0.298 0.667 0.667 0.667z"></path>
255
+ <path d="M31.51 15.406l-19.499-7.253c-0.342-0.128-0.728 0.046-0.858 0.392s0.048 0.73 0.394 0.858l1.805 0.672v6.784l-10.166 2.629c0 0 0 0-0.002 0l-2.618 0.675c-0.357 0.091-0.571 0.456-0.478 0.813 0.077 0.301 0.347 0.501 0.643 0.501 0.056 0 0.11-0.006 0.166-0.021l1.784-0.461v10.387c0 0.368 0.299 0.667 0.667 0.667h25.333c0.368 0 0.667-0.299 0.667-0.667v-15.354l1.693 0.629c0.077 0.027 0.157 0.042 0.234 0.042 0.27 0 0.525-0.166 0.626-0.435 0.128-0.344-0.045-0.728-0.39-0.856zM4.019 20.65l9.333-2.414v12.478h-1.333v-4.667c0-0.368-0.299-0.667-0.667-0.667h-5.333c-0.368 0-0.667 0.299-0.667 0.667v4.667h-1.333v-10.064zM6.685 30.715v-4h4v4h-4zM18.686 30.715v-4h1.333v4h-1.333zM28.019 30.715h-6.667v-4.667c0-0.368-0.299-0.667-0.667-0.667h-2.667c-0.368 0-0.667 0.299-0.667 0.667v4.667h-2.667v-20.144l13.333 4.962v15.182z"></path>
256
+ </svg>
257
+ )
258
+ }
259
+
246
260
  export const Down = (props: IconProps) => {
247
261
  return (
248
262
  <svg viewBox={"0 0 32 32"} fill={props.fill ?? "currentColor"}>
@@ -6,44 +6,71 @@
6
6
 
7
7
  .listings-group__header {
8
8
  @apply flex;
9
- @apply flex-row;
10
- @apply flex-wrap;
9
+ @apply flex-col;
11
10
  @apply max-w-5xl;
12
11
  @apply m-auto;
13
12
  @apply mt-6;
14
13
  @apply mb-8;
15
14
  @apply p-3;
15
+ @apply justify-between;
16
+
17
+ @screen md {
18
+ @apply flex-row;
19
+ }
16
20
  }
17
21
 
18
22
  .listings-group__icon {
19
23
  @apply hidden;
20
- @apply pt-2;
21
24
  @apply pr-5;
25
+ @apply mr-5;
26
+ @apply border-r-4;
27
+ @apply border-gray-700;
28
+ @apply items-center;
29
+ @apply hidden;
30
+ @screen md {
31
+ @apply flex;
32
+ }
33
+ }
34
+
35
+ .listings-group__content {
36
+ @apply flex;
37
+ @apply flex-row;
38
+ flex-grow: 2;
39
+ margin-right: 15px;
22
40
 
41
+ @apply max-w-full;
23
42
  @screen md {
24
- @apply inline-block;
43
+ max-width: 70%;
25
44
  }
26
45
  }
27
46
 
28
47
  .listings-group__header-group {
29
- @apply w-full;
48
+ max-width: inherit;
30
49
  @apply flex;
31
- @apply items-center;
32
- @apply mb-4;
50
+ @apply flex-col;
51
+ @apply items-start;
52
+ @apply justify-center;
53
+ @apply h-full;
54
+ }
33
55
 
56
+ .listings-group__info {
57
+ @apply text-gray-750;
58
+ @apply pt-1;
59
+ @apply pt-2;
34
60
  @screen md {
35
- @apply w-7/12;
36
- @apply mb-0;
61
+ @apply pt-0;
37
62
  }
38
63
  }
39
64
 
40
65
  .listings-group__button {
41
- @apply w-full;
42
66
  @apply flex;
43
67
  @apply items-center;
44
-
68
+ flex-shrink: 0;
69
+ @apply ml-0;
70
+ @apply pt-5;
45
71
  @screen md {
46
- @apply w-4/12;
72
+ @apply ml-6;
73
+ @apply pt-0;
47
74
  }
48
75
  }
49
76
 
@@ -51,15 +78,13 @@
51
78
  @apply uppercase;
52
79
  @apply font-alt-sans;
53
80
  @apply font-black;
54
- @apply my-1;
55
81
  @apply tracking-widest;
56
82
  @apply border-b-4;
57
- @apply border-gray-600;
83
+ @apply border-gray-700;
58
84
  @apply pb-1;
59
85
 
60
86
  @screen md {
61
- @apply px-4;
62
- @apply border-b-0;
63
- @apply border-l-4;
87
+ @apply pb-0;
88
+ @apply border-0;
64
89
  }
65
90
  }
@@ -1,43 +1,41 @@
1
1
  import React, { useState } from "react"
2
2
  import { Button } from "../../actions/Button"
3
- import { Icon } from "../../icons/Icon"
3
+ import { Icon, IconTypes } from "../../icons/Icon"
4
4
  import "./ListingsGroup.scss"
5
5
 
6
6
  export interface ListingsGroupProps {
7
7
  children?: React.ReactNode
8
- listingsCount: number
9
8
  header: string
9
+ hideButtonText: string
10
+ icon?: IconTypes
10
11
  info?: string
12
+ listingsCount: number
11
13
  showButtonText: string
12
- hideButtonText: string
13
14
  }
14
15
 
15
16
  const ListingsGroup = (props: ListingsGroupProps) => {
16
17
  const [showListings, setShowListings] = useState(false)
17
18
  const toggleListings = () => setShowListings(!showListings)
18
19
 
19
- let buttonText
20
-
21
20
  const listingsCount = ` (${props.listingsCount})`
22
- if (showListings) {
23
- buttonText = props.hideButtonText + listingsCount
24
- } else {
25
- buttonText = props.showButtonText + listingsCount
26
- }
27
21
 
28
22
  return (
29
23
  <div className="listings-group">
30
24
  <div className="listings-group__header">
31
- <div className="listings-group__icon">
32
- <Icon size="xlarge" symbol="clock" />
33
- </div>
34
- <div className="listings-group__header-group">
35
- <h2 className="listings-group__title">{props.header}</h2>
36
- {props.info && <div className="px-4 my-2">{props.info}</div>}
25
+ <div className={"listings-group__content"}>
26
+ <div className="listings-group__icon">
27
+ <Icon size="xlarge" symbol={props.icon ?? `clock`} />
28
+ </div>
29
+ <div className="listings-group__header-group">
30
+ <h2 className="listings-group__title">{props.header}</h2>
31
+ {props.info && <div className="listings-group__info">{props.info}</div>}
32
+ </div>
37
33
  </div>
38
34
  <div className="listings-group__button">
39
35
  <Button className="w-full" onClick={() => toggleListings()}>
40
- {buttonText}
36
+ {showListings
37
+ ? props.hideButtonText + listingsCount
38
+ : props.showButtonText + listingsCount}
41
39
  </Button>
42
40
  </div>
43
41
  </div>
@@ -1,6 +1,6 @@
1
1
  import * as React from "react"
2
2
  import { t } from "../../../helpers/translator"
3
- import moment from "moment"
3
+ import dayjs from "dayjs"
4
4
 
5
5
  interface ListingUpdatedProps {
6
6
  listingUpdated: Date
@@ -11,7 +11,7 @@ const ListingUpdated = (props: ListingUpdatedProps) => {
11
11
  return (
12
12
  <section className="aside-block">
13
13
  <p className="text-tiny text-gray-800">
14
- {`${t("listings.listingUpdated")}: ${moment(listingUpdated).format("MMMM DD, YYYY")}`}
14
+ {`${t("listings.listingUpdated")}: ${dayjs(listingUpdated).format("MMMM DD, YYYY")}`}
15
15
  </p>
16
16
  </section>
17
17
  )
@@ -1,7 +1,7 @@
1
1
  import * as React from "react"
2
2
  import { ListingEvent } from "@bloom-housing/backend-core/types"
3
3
  import { t } from "../../../../helpers/translator"
4
- import moment from "moment"
4
+ import dayjs from "dayjs"
5
5
 
6
6
  const DownloadLotteryResults = (props: { event: ListingEvent; pdfUrl: string }) => {
7
7
  const { event, pdfUrl } = props
@@ -12,7 +12,7 @@ const DownloadLotteryResults = (props: { event: ListingEvent; pdfUrl: string })
12
12
  <section className="aside-block text-center">
13
13
  <h2 className="text-caps pb-4">{t("listings.lotteryResults.header")}</h2>
14
14
  <p className="uppercase text-gray-800 text-tiny font-semibold pb-4">
15
- {moment(event.startTime).format("MMMM D, YYYY")}
15
+ {dayjs(event.startTime).format("MMMM D, YYYY")}
16
16
  </p>
17
17
  <a
18
18
  className="button is-primary w-full mb-2"
@@ -1,6 +1,6 @@
1
1
  import * as React from "react"
2
2
  import { ListingEvent } from "@bloom-housing/backend-core/types"
3
- import moment from "moment"
3
+ import dayjs from "dayjs"
4
4
 
5
5
  const EventDateSection = (props: { event: ListingEvent }) => {
6
6
  return (
@@ -8,12 +8,12 @@ const EventDateSection = (props: { event: ListingEvent }) => {
8
8
  {props.event.startTime && (
9
9
  <p className="text text-gray-800 pb-3 flex justify-between items-center">
10
10
  <span className="inline-block text-tiny uppercase">
11
- {moment(props.event.startTime).format("MMMM D, YYYY")}
11
+ {dayjs(props.event.startTime).format("MMMM D, YYYY")}
12
12
  </span>
13
13
  <span className="inline-block text-sm font-bold">
14
- {moment(props.event.startTime).format("hh:mma") +
14
+ {dayjs(props.event.startTime).format("hh:mma") +
15
15
  "-" +
16
- moment(props.event.endTime).format("hh:mma")}
16
+ dayjs(props.event.endTime).format("hh:mma")}
17
17
  </span>
18
18
  </p>
19
19
  )}
@@ -1,7 +1,7 @@
1
1
  import * as React from "react"
2
2
  import { ListingEvent } from "@bloom-housing/backend-core/types"
3
3
  import { t } from "../../../../helpers/translator"
4
- import moment from "moment"
4
+ import dayjs from "dayjs"
5
5
 
6
6
  const LotteryResultsEvent = (props: { event: ListingEvent }) => {
7
7
  const { event } = props
@@ -9,13 +9,13 @@ const LotteryResultsEvent = (props: { event: ListingEvent }) => {
9
9
  <section className="aside-block">
10
10
  <h4 className="text-caps-underline">{t("listings.lotteryResults.header")}</h4>
11
11
  <p className="text text-gray-800 pb-3 flex justify-between items-center">
12
- <span className="inline-block">{moment(props.event.startTime).format("MMMM D, YYYY")}</span>
12
+ <span className="inline-block">{dayjs(props.event.startTime).format("MMMM D, YYYY")}</span>
13
13
  </p>
14
14
  {event.note && <p className="text text-gray-600">{event.note}</p>}
15
15
  {!event.note && (
16
16
  <p className="text-tiny text-gray-600">
17
17
  {t("listings.lotteryResults.completeResultsWillBePosted", {
18
- hour: moment(props.event.startTime).format("h a"),
18
+ hour: dayjs(props.event.startTime).format("h a"),
19
19
  })}
20
20
  </p>
21
21
  )}