@awesomephant/reactcake 1.1.1 → 1.1.2
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/lib/Html/index.tsx +4 -1
- package/lib/ScaledSvg/index.tsx +13 -1
- package/lib/Svg/index.tsx +3 -1
- package/lib/types.ts +4 -1
- package/package.json +1 -1
package/lib/Html/index.tsx
CHANGED
|
@@ -6,12 +6,15 @@ interface HtmlProps extends LayoutProps {
|
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
const Html = ({ overflow = "visible", children }: HtmlProps) => {
|
|
9
|
+
const Html = ({ overflow = "visible", label, labelledBy, describedBy, children }: HtmlProps) => {
|
|
10
10
|
const { padding } = useReactCake();
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
13
|
<div
|
|
14
14
|
className="reactcake-html"
|
|
15
|
+
aria-label={labelledBy}
|
|
16
|
+
aria-describedby={describedBy}
|
|
17
|
+
role={label ? "figure" : "none"}
|
|
15
18
|
style={{
|
|
16
19
|
position: "absolute",
|
|
17
20
|
top: `${padding.top}px`,
|
package/lib/ScaledSvg/index.tsx
CHANGED
|
@@ -3,16 +3,27 @@ import { useReactCake } from "../ReactCake";
|
|
|
3
3
|
import { LayoutProps } from "../types";
|
|
4
4
|
|
|
5
5
|
interface SvgProps extends LayoutProps {
|
|
6
|
+
title?: string;
|
|
6
7
|
children?: ReactNode;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
const ScaledSvg = ({
|
|
10
|
+
const ScaledSvg = ({
|
|
11
|
+
children,
|
|
12
|
+
label,
|
|
13
|
+
labelledBy,
|
|
14
|
+
describedBy,
|
|
15
|
+
title,
|
|
16
|
+
overflow = "visible",
|
|
17
|
+
}: SvgProps) => {
|
|
10
18
|
const { padding } = useReactCake();
|
|
11
19
|
return (
|
|
12
20
|
<>
|
|
13
21
|
<style>{`svg * { vector-effect: non-scaling-stroke;}`}</style>
|
|
14
22
|
<svg
|
|
15
23
|
className="reactcake-svg"
|
|
24
|
+
aria-label={labelledBy}
|
|
25
|
+
aria-describedby={describedBy}
|
|
26
|
+
role={label ? "figure" : "none"}
|
|
16
27
|
preserveAspectRatio="none"
|
|
17
28
|
height={`calc(100% - ${padding.top}px - ${padding.bottom}px`}
|
|
18
29
|
width={`calc(100% - ${padding.left}px - ${padding.right}px`}
|
|
@@ -24,6 +35,7 @@ const ScaledSvg = ({ children, overflow = "visible" }: SvgProps) => {
|
|
|
24
35
|
overflow: overflow,
|
|
25
36
|
}}
|
|
26
37
|
>
|
|
38
|
+
{title && <title>{title}</title>}
|
|
27
39
|
{children}
|
|
28
40
|
</svg>
|
|
29
41
|
</>
|
package/lib/Svg/index.tsx
CHANGED
|
@@ -3,10 +3,11 @@ import { useReactCake } from "../ReactCake";
|
|
|
3
3
|
import { LayoutProps } from "../types";
|
|
4
4
|
|
|
5
5
|
interface SvgProps extends LayoutProps {
|
|
6
|
+
title?: string;
|
|
6
7
|
children?: ReactNode;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
const Svg = ({ children, overflow = "hidden" }: SvgProps) => {
|
|
10
|
+
const Svg = ({ children, title, overflow = "hidden" }: SvgProps) => {
|
|
10
11
|
const { padding } = useReactCake();
|
|
11
12
|
return (
|
|
12
13
|
<svg
|
|
@@ -24,6 +25,7 @@ const Svg = ({ children, overflow = "hidden" }: SvgProps) => {
|
|
|
24
25
|
overflow: overflow,
|
|
25
26
|
}}
|
|
26
27
|
>
|
|
28
|
+
{title && <title>{title}</title>}
|
|
27
29
|
<g transform={`translate(${padding.left} ${padding.top})`}>{children}</g>
|
|
28
30
|
</svg>
|
|
29
31
|
);
|
package/lib/types.ts
CHANGED