@bloom-housing/ui-components 4.2.2-alpha.7 → 4.2.2-alpha.8
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 +11 -0
- package/package.json +2 -2
- package/src/authentication/timeout.tsx +1 -0
- package/src/overlays/Drawer.tsx +11 -3
- package/src/overlays/Modal.tsx +16 -7
- package/src/overlays/Overlay.tsx +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.2.2-alpha.8](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.2.2-alpha.7...@bloom-housing/ui-components@4.2.2-alpha.8) (2022-04-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* application timeout screen reader accessible ([#2625](https://github.com/bloom-housing/bloom/issues/2625)) ([0771ef3](https://github.com/bloom-housing/bloom/commit/0771ef3f7e4001efb4dae8cca06743801daace05))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [4.2.2-alpha.7](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.2.2-alpha.6...@bloom-housing/ui-components@4.2.2-alpha.7) (2022-04-20)
|
|
7
18
|
|
|
8
19
|
**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": "4.2.2-alpha.
|
|
3
|
+
"version": "4.2.2-alpha.8",
|
|
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",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"tailwindcss": "2.2.10",
|
|
101
101
|
"typesafe-actions": "^5.1.0"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "429d0871f219e82003b424e22767ca336236046b"
|
|
104
104
|
}
|
package/src/overlays/Drawer.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { useRef } from "react"
|
|
2
2
|
import "./Drawer.scss"
|
|
3
3
|
import { Icon } from "../icons/Icon"
|
|
4
4
|
import { Overlay, OverlayProps } from "./Overlay"
|
|
@@ -6,6 +6,7 @@ import { Tag } from "../text/Tag"
|
|
|
6
6
|
import { AppearanceStyleType, AppearanceSizeType } from "../global/AppearanceTypes"
|
|
7
7
|
import { AlertTypes } from "../notifications/alertTypes"
|
|
8
8
|
import { AlertBox } from "../notifications"
|
|
9
|
+
import { nanoid } from "nanoid"
|
|
9
10
|
|
|
10
11
|
export enum DrawerSide {
|
|
11
12
|
left = "left",
|
|
@@ -28,18 +29,25 @@ const Drawer = (props: DrawerProps) => {
|
|
|
28
29
|
const drawerClasses = ["drawer"]
|
|
29
30
|
if (props.className) drawerClasses.push(props.className)
|
|
30
31
|
|
|
32
|
+
const uniqueIdRef = useRef(nanoid())
|
|
33
|
+
|
|
31
34
|
return (
|
|
32
35
|
<Overlay
|
|
33
|
-
|
|
36
|
+
ariaLabelledBy={uniqueIdRef.current}
|
|
34
37
|
ariaDescription={props.ariaDescription}
|
|
35
38
|
open={props.open}
|
|
36
39
|
onClose={props.onClose}
|
|
37
40
|
backdrop={props.backdrop}
|
|
38
41
|
className={"has-drawer" + (props.direction == DrawerSide.left ? " is-direction-left" : "")}
|
|
42
|
+
role="dialog"
|
|
39
43
|
>
|
|
40
44
|
<div className={drawerClasses.join(" ")}>
|
|
41
45
|
<header className="drawer__header">
|
|
42
|
-
{props.title &&
|
|
46
|
+
{props.title && (
|
|
47
|
+
<h1 className="drawer__title" id={uniqueIdRef.current}>
|
|
48
|
+
{props.title}
|
|
49
|
+
</h1>
|
|
50
|
+
)}
|
|
43
51
|
{props.headerTag && (
|
|
44
52
|
<Tag
|
|
45
53
|
pillStyle={true}
|
package/src/overlays/Modal.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from "react"
|
|
1
|
+
import React, { useRef } from "react"
|
|
2
2
|
import "./Modal.scss"
|
|
3
3
|
import { Icon } from "../icons/Icon"
|
|
4
4
|
import { Overlay, OverlayProps } from "./Overlay"
|
|
5
|
+
import { nanoid } from "nanoid"
|
|
5
6
|
|
|
6
7
|
export interface ModalProps extends Omit<OverlayProps, "children"> {
|
|
7
8
|
title: string
|
|
@@ -9,12 +10,17 @@ export interface ModalProps extends Omit<OverlayProps, "children"> {
|
|
|
9
10
|
hideCloseIcon?: boolean
|
|
10
11
|
children?: React.ReactNode
|
|
11
12
|
slim?: boolean
|
|
13
|
+
role?: string
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
const ModalHeader = (props: { title: string }) => (
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
16
|
+
const ModalHeader = (props: { title: string; uniqueId?: string }) => (
|
|
17
|
+
<>
|
|
18
|
+
<header className="modal__inner">
|
|
19
|
+
<h1 className="modal__title" id={props.uniqueId}>
|
|
20
|
+
{props.title}
|
|
21
|
+
</h1>
|
|
22
|
+
</header>
|
|
23
|
+
</>
|
|
18
24
|
)
|
|
19
25
|
|
|
20
26
|
const ModalFooter = (props: { actions: React.ReactNode[] }) => (
|
|
@@ -28,17 +34,20 @@ const ModalFooter = (props: { actions: React.ReactNode[] }) => (
|
|
|
28
34
|
)
|
|
29
35
|
|
|
30
36
|
export const Modal = (props: ModalProps) => {
|
|
37
|
+
const uniqueIdRef = useRef(nanoid())
|
|
38
|
+
|
|
31
39
|
return (
|
|
32
40
|
<Overlay
|
|
33
|
-
|
|
41
|
+
ariaLabelledBy={uniqueIdRef.current}
|
|
34
42
|
ariaDescription={props.ariaDescription}
|
|
35
43
|
open={props.open}
|
|
36
44
|
onClose={props.onClose}
|
|
37
45
|
backdrop={props.backdrop}
|
|
38
46
|
slim={props.slim}
|
|
47
|
+
role={props.role ? props.role : "dialog"}
|
|
39
48
|
>
|
|
40
49
|
<div className="modal">
|
|
41
|
-
<ModalHeader title={props.title} />
|
|
50
|
+
<ModalHeader title={props.title} uniqueId={uniqueIdRef.current} />
|
|
42
51
|
|
|
43
52
|
<section className="modal__inner">
|
|
44
53
|
{typeof props.children === "string" ? (
|
package/src/overlays/Overlay.tsx
CHANGED
|
@@ -8,13 +8,14 @@ import { CSSTransition } from "react-transition-group"
|
|
|
8
8
|
|
|
9
9
|
export type OverlayProps = {
|
|
10
10
|
open?: boolean
|
|
11
|
-
|
|
11
|
+
ariaLabelledBy?: string
|
|
12
12
|
ariaDescription?: string
|
|
13
13
|
className?: string
|
|
14
14
|
backdrop?: boolean
|
|
15
15
|
onClose?: () => void
|
|
16
16
|
children: React.ReactNode
|
|
17
17
|
slim?: boolean
|
|
18
|
+
role?: string
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
const OverlayInner = (props: OverlayProps) => {
|
|
@@ -31,8 +32,8 @@ const OverlayInner = (props: OverlayProps) => {
|
|
|
31
32
|
return (
|
|
32
33
|
<div
|
|
33
34
|
className={classNames.join(" ")}
|
|
34
|
-
role=
|
|
35
|
-
aria-labelledby={props.
|
|
35
|
+
role={props.role}
|
|
36
|
+
aria-labelledby={props.ariaLabelledBy}
|
|
36
37
|
aria-describedby={props.ariaDescription}
|
|
37
38
|
onClick={(e) => {
|
|
38
39
|
if (e.target === e.currentTarget) closeHandler()
|