@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.
@@ -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`,
@@ -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 = ({ children, overflow = "visible" }: SvgProps) => {
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
@@ -39,5 +39,8 @@ export interface ContextValue {
39
39
  }
40
40
 
41
41
  export interface LayoutProps {
42
- overflow?: "hidden" | "visible"
42
+ overflow?: "hidden" | "visible",
43
+ label?: string;
44
+ labelledBy?: string;
45
+ describedBy?: string;
43
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomephant/reactcake",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "A headless chart framework for React inspired by Layercake",
5
5
  "keywords": [
6
6
  "react",