@cutting/svg 4.31.6 → 4.32.0

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.
Files changed (45) hide show
  1. package/.turbo/turbo-build.log +22 -0
  2. package/CHANGELOG.md +38 -0
  3. package/README.md +2 -3
  4. package/demo/App.tsx +6 -7
  5. package/demo/global.css.ts +2 -1
  6. package/demo/index.tsx +1 -2
  7. package/dist/cjs/components/Group/Group.d.ts +1 -2
  8. package/dist/cjs/components/Group/Group.d.ts.map +1 -1
  9. package/dist/cjs/components/Line/Line.d.ts +2 -3
  10. package/dist/cjs/components/Line/Line.d.ts.map +1 -1
  11. package/dist/cjs/components/ParentsizeSVG/ParentsizeSVG.d.ts +3 -3
  12. package/dist/cjs/components/ParentsizeSVG/ParentsizeSVG.d.ts.map +1 -1
  13. package/dist/cjs/components/ResponsiveSVG/ResponsiveSVG.d.ts +4 -3
  14. package/dist/cjs/components/ResponsiveSVG/ResponsiveSVG.d.ts.map +1 -1
  15. package/dist/cjs/svg.cjs.development.js +13 -13
  16. package/dist/cjs/svg.cjs.development.js.map +1 -1
  17. package/dist/cjs/svg.cjs.production.min.js +1 -1
  18. package/dist/cjs/svg.cjs.production.min.js.map +1 -1
  19. package/dist/esm/components/Group/Group.d.ts +1 -2
  20. package/dist/esm/components/Group/Group.d.ts.map +1 -1
  21. package/dist/esm/components/Line/Line.d.ts +2 -3
  22. package/dist/esm/components/Line/Line.d.ts.map +1 -1
  23. package/dist/esm/components/ParentsizeSVG/ParentsizeSVG.d.ts +3 -3
  24. package/dist/esm/components/ParentsizeSVG/ParentsizeSVG.d.ts.map +1 -1
  25. package/dist/esm/components/ResponsiveSVG/ResponsiveSVG.d.ts +4 -3
  26. package/dist/esm/components/ResponsiveSVG/ResponsiveSVG.d.ts.map +1 -1
  27. package/dist/esm/index.js +1 -1
  28. package/dist/esm/index.js.map +1 -1
  29. package/dist/umd/components/Group/Group.d.ts +1 -2
  30. package/dist/umd/components/Group/Group.d.ts.map +1 -1
  31. package/dist/umd/components/Line/Line.d.ts +2 -3
  32. package/dist/umd/components/Line/Line.d.ts.map +1 -1
  33. package/dist/umd/components/ParentsizeSVG/ParentsizeSVG.d.ts +3 -3
  34. package/dist/umd/components/ParentsizeSVG/ParentsizeSVG.d.ts.map +1 -1
  35. package/dist/umd/components/ResponsiveSVG/ResponsiveSVG.d.ts +4 -3
  36. package/dist/umd/components/ResponsiveSVG/ResponsiveSVG.d.ts.map +1 -1
  37. package/dist/umd/index.js +1 -1
  38. package/dist/umd/index.js.map +1 -1
  39. package/package.json +30 -22
  40. package/src/components/Group/Group.tsx +3 -4
  41. package/src/components/Line/Line.tsx +4 -5
  42. package/src/components/ParentsizeSVG/ParentSizeSVG.test.tsx +21 -5
  43. package/src/components/ParentsizeSVG/ParentsizeSVG.tsx +8 -4
  44. package/src/components/ResponsiveSVG/ResponsiveSVG.test.tsx +2 -3
  45. package/src/components/ResponsiveSVG/ResponsiveSVG.tsx +6 -5
@@ -0,0 +1,22 @@
1
+ @cutting/svg:build: cache hit, replaying output 8026d1b55afa770c
2
+ @cutting/svg:build:
3
+ @cutting/svg:build: > @cutting/svg@4.32.0 build /home/runner/work/cuttingedge/cuttingedge/packages/svg
4
+ @cutting/svg:build: > NODE_ENV=production cutting rollup
5
+ @cutting/svg:build:
6
+ @cutting/svg:build: DEBUG using tsconfig.dist.json
7
+ @cutting/svg:build: WARNING emptying dist /home/runner/work/cuttingedge/cuttingedge/packages/svg/dist
8
+ @cutting/svg:build: START using input file index.ts for @cutting/svg
9
+ @cutting/svg:build:
10
+ @cutting/svg:build: INFO Generating @cutting/svg bundle.
11
+ @cutting/svg:build: INFO writing svg.cjs.development.js for @cutting/svg
12
+ @cutting/svg:build: INFO writing svg.cjs.production.min.js for @cutting/svg
13
+ @cutting/svg:build: INFO writing index.js for @cutting/svg
14
+ @cutting/svg:build: INFO writing index.js for @cutting/svg
15
+ @cutting/svg:build: No name was provided for external module 'react/jsx-runtime' in output.globals – guessing 'jsxRuntime'
16
+ @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/slicedToArray' in output.globals – guessing '_slicedToArray'
17
+ @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/objectSpread2' in output.globals – guessing '_objectSpread'
18
+ @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/objectWithoutProperties' in output.globals – guessing '_objectWithoutProperties'
19
+ @cutting/svg:build: No name was provided for external module '@cutting/use-get-parent-size' in output.globals – guessing 'useGetParentSize'
20
+ @cutting/svg:build: No name was provided for external module 'classnames' in output.globals – guessing 'cx'
21
+ @cutting/svg:build: DONE finished building
22
+ @cutting/svg:build:
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @cutting/svg
2
2
 
3
+ ## 4.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3413251c: build in production
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [3413251c]
12
+ - @cutting/util@4.31.0
13
+ - @cutting/use-get-parent-size@1.6.10
14
+
15
+ ## 4.31.9
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [e6a06fa0]
20
+ - @cutting/util@4.30.0
21
+ - @cutting/use-get-parent-size@1.6.9
22
+
23
+ ## 4.31.8
24
+
25
+ ### Patch Changes
26
+
27
+ - 128579ea: fix changesets
28
+ - Updated dependencies [128579ea]
29
+ - @cutting/use-get-parent-size@1.6.8
30
+ - @cutting/util@4.29.8
31
+
32
+ ## 4.31.7
33
+
34
+ ### Patch Changes
35
+
36
+ - 565b42ff: yes
37
+ - Updated dependencies [565b42ff]
38
+ - @cutting/use-get-parent-size@1.6.7
39
+ - @cutting/util@4.29.7
40
+
3
41
  ## 4.31.6
4
42
 
5
43
  ### Patch Changes
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ## install
6
6
 
7
7
  ```sh
8
- yarn add @cutting/svg
8
+ pnpm add @cutting/svg
9
9
 
10
10
  # or
11
11
 
@@ -23,11 +23,10 @@ The `ParentsizeSVG` component takes an `elementRef` prop that should point to a
23
23
  ## usage
24
24
 
25
25
  ```ts
26
- import type { FC } from 'react';
27
26
  import { useRef } from 'react';
28
27
  import { ParentsizeSVG } from '@cutting/svg';
29
28
 
30
- export const App: FC = () => {
29
+ export function App(): JSX.Element {
31
30
  const ref = useRef<HTMLDivElement>(null);
32
31
 
33
32
  return (
package/demo/App.tsx CHANGED
@@ -1,10 +1,9 @@
1
+ import * as styles from './global.css';
1
2
  import '@cutting/component-library/styles.css';
2
3
  import { useRef } from 'react';
3
4
  import { ApplicationLayout, cuttingTheme } from '@cutting/component-library';
4
5
  import { ParentsizeSVG } from '../src/components/ParentsizeSVG/ParentsizeSVG';
5
6
 
6
- import * as styles from './global.css';
7
-
8
7
  export function App(): JSX.Element {
9
8
  const ref = useRef<HTMLDivElement>(null);
10
9
  return (
@@ -12,17 +11,17 @@ export function App(): JSX.Element {
12
11
  <div className={styles.container} ref={ref}>
13
12
  <ParentsizeSVG elementRef={ref} options={{ debounceDelay: 10 }}>
14
13
  <rect
15
- x="20%"
16
- y="20%"
14
+ x="0"
15
+ y="0"
17
16
  width={'50%'}
18
17
  height={'50%'}
19
- rx="20"
18
+ rx="0"
20
19
  style={{ fill: '#ff0000', stroke: '#000000', strokeWidth: '2px' }}
21
20
  />
22
21
 
23
22
  <rect
24
- x="30%"
25
- y="30%"
23
+ x="0"
24
+ y="0"
26
25
  width={'50%'}
27
26
  height={'50%'}
28
27
  rx="40"
@@ -1,7 +1,7 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css';
2
2
 
3
3
  export const container = style({
4
- border: '1px solid yellow',
4
+ border: '10px solid yellow',
5
5
  background: 'grey',
6
6
  color: 'white',
7
7
  overflow: 'hidden',
@@ -12,6 +12,7 @@ export const container = style({
12
12
  justifyContent: 'center',
13
13
  alignItems: 'center',
14
14
  margin: '0 auto',
15
+ marginBottom: '10rem',
15
16
  });
16
17
 
17
18
  globalStyle('svg', {
package/demo/index.tsx CHANGED
@@ -1,10 +1,9 @@
1
1
  import ReactDOM from 'react-dom';
2
- import type { FC } from 'react';
3
2
  import { App } from './App';
4
3
 
5
4
  export const root = document.getElementById('root');
6
5
 
7
- const render = (Component: FC) => {
6
+ const render = (Component: typeof App) => {
8
7
  ReactDOM.render(<Component />, root);
9
8
  };
10
9
 
@@ -1,4 +1,3 @@
1
- import type { FC } from 'react';
2
1
  declare type GroupOnlyProps = {
3
2
  /** Top offset applied to `<g/>`. */
4
3
  y?: number;
@@ -11,6 +10,6 @@ declare type GroupOnlyProps = {
11
10
  innerRef?: React.Ref<SVGGElement>;
12
11
  };
13
12
  declare type GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;
14
- export declare const Group: FC<GroupProps>;
13
+ export declare function Group({ y, x, transform, className, children, innerRef, ...restProps }: GroupProps): JSX.Element;
15
14
  export {};
16
15
  //# sourceMappingURL=Group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../../src/components/Group/Group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,aAAK,cAAc,GAAG;IACpB,oCAAoC;IACpC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CACnC,CAAC;AAEF,aAAK,UAAU,GAAG,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,cAAc,CAAC,CAAC;AAE3F,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAmBhC,CAAC"}
1
+ {"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../../src/components/Group/Group.tsx"],"names":[],"mappings":"AAEA,aAAK,cAAc,GAAG;IACpB,oCAAoC;IACpC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CACnC,CAAC;AAEF,aAAK,UAAU,GAAG,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,cAAc,CAAC,CAAC;AAE3F,wBAAgB,KAAK,CAAC,EACpB,CAAK,EACL,CAAK,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAW1B"}
@@ -1,5 +1,4 @@
1
- import type { FC } from 'react';
2
- import { Point } from '../../types/types';
1
+ import type { AddSVGProps, Point } from '../../types/types';
3
2
  export declare type LineProps = {
4
3
  className?: string;
5
4
  innerRef?: React.Ref<SVGLineElement>;
@@ -9,5 +8,5 @@ export declare type LineProps = {
9
8
  /** Ending x,y point of the line. */
10
9
  to?: Point;
11
10
  };
12
- export declare const Line: FC<LineProps>;
11
+ export declare function Line({ from, to, fill, className, innerRef, ...restProps }: AddSVGProps<LineProps, SVGLineElement>): JSX.Element;
13
12
  //# sourceMappingURL=Line.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/components/Line/Line.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAe,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEvD,oBAAY,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,oCAAoC;IACpC,EAAE,CAAC,EAAE,KAAK,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAuB9B,CAAC"}
1
+ {"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/components/Line/Line.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE5D,oBAAY,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,oCAAoC;IACpC,EAAE,CAAC,EAAE,KAAK,CAAC;CACZ,CAAC;AAEF,wBAAgB,IAAI,CAAC,EACnB,IAAqB,EACrB,EAAmB,EACnB,IAAoB,EACpB,SAAS,EACT,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,WAAW,CAAC,SAAS,EAAE,cAAc,CAAC,GAAG,GAAG,CAAC,OAAO,CAgBtD"}
@@ -1,8 +1,8 @@
1
- import { CSSProperties, PropsWithChildren, RefObject } from 'react';
1
+ import type { CSSProperties, PropsWithChildren, RefObject } from 'react';
2
2
  import type { UseParentSizeOptions } from '@cutting/use-get-parent-size';
3
- import { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';
3
+ import type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';
4
4
  declare type Align = 'none' | 'center';
5
- export declare type ParentsizeSVGProps<E extends HTMLElement> = {
5
+ export declare type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {
6
6
  elementRef: RefObject<E>;
7
7
  style?: CSSProperties;
8
8
  align?: Align;
@@ -1 +1 @@
1
- {"version":3,"file":"ParentsizeSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ParentsizeSVG/ParentsizeSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EAAiB,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEnF,aAAK,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE/B,oBAAY,kBAAkB,CAAC,CAAC,SAAS,WAAW,IAAI;IACtD,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACzB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACzC,GAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;AAExE,eAAO,MAAM,YAAY,EAAE,aAOjB,CAAC;AAEX,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAAW,EAAE,EACnD,UAAU,EACV,QAAQ,EACR,KAAoB,EACpB,KAAS,EACT,KAAc,EACd,OAAO,EAAE,EAAE,aAAkB,EAAE,GAAG,WAAW,EAAO,EACpD,GAAG,IAAI,EACR,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAsB/D"}
1
+ {"version":3,"file":"ParentsizeSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ParentsizeSVG/ParentsizeSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,aAAK,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE/B,oBAAY,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI;IACpE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACzB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACzC,GAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;AAExE,eAAO,MAAM,YAAY,EAAE,aAOjB,CAAC;AAEX,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAAW,EAAE,EACnD,UAAU,EACV,QAAQ,EACR,KAAoB,EACpB,KAAS,EACT,KAAc,EACd,OAAO,EAAE,EAAE,aAAkB,EAAE,GAAG,WAAW,EAAO,EACpD,GAAG,IAAI,EACR,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAwB/D"}
@@ -1,5 +1,5 @@
1
- import type { FC, Ref } from 'react';
2
- import { PreserveAspectRatio } from '../../types/types';
1
+ import type { ReactNode, Ref } from 'react';
2
+ import type { PreserveAspectRatio } from '../../types/types';
3
3
  export interface Point {
4
4
  x: number;
5
5
  y: number;
@@ -12,6 +12,7 @@ export interface ResponsiveSVGProps {
12
12
  innerRef?: Ref<SVGSVGElement>;
13
13
  className?: string;
14
14
  hide?: boolean;
15
+ children: ReactNode;
15
16
  }
16
- export declare const ResponsiveSVG: FC<ResponsiveSVGProps>;
17
+ export declare function ResponsiveSVG({ height, width, children, origin, preserveAspectRatio, innerRef, className, }: ResponsiveSVGProps): JSX.Element;
17
18
  //# sourceMappingURL=ResponsiveSVG.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsiveSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAiChD,CAAC"}
1
+ {"version":3,"file":"ResponsiveSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,QAAQ,EACR,MAAuB,EACvB,mBAAqC,EACrC,QAAQ,EACR,SAAS,GACV,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAyBlC"}
@@ -29,7 +29,7 @@ var cx__default = /*#__PURE__*/_interopDefault(cx);
29
29
  globalThis.process = { env:env };
30
30
  })();
31
31
 
32
- var ResponsiveSVG = function ResponsiveSVG(_ref) {
32
+ function ResponsiveSVG(_ref) {
33
33
  var height = _ref.height,
34
34
  width = _ref.width,
35
35
  children = _ref.children,
@@ -60,9 +60,9 @@ var ResponsiveSVG = function ResponsiveSVG(_ref) {
60
60
  viewBox: "".concat(origin.x, " ").concat(origin.y, " ").concat(width, " ").concat(adjustedHeight),
61
61
  ref: innerRef,
62
62
  children: children
63
- }, void 0)
64
- }, void 0);
65
- };
63
+ })
64
+ });
65
+ }
66
66
 
67
67
  var _excluded$2 = ["debounceDelay"],
68
68
  _excluded2 = ["elementRef", "children", "style", "scale", "align", "options"];
@@ -111,7 +111,7 @@ function ParentsizeSVG(_ref) {
111
111
  elementRef.current.style[key] = value;
112
112
  }
113
113
  }, [elementRef, style]);
114
- var transform = align === 'center' ? "translate(".concat(width / 2, ",").concat(height / 2 - 20, ") scale(").concat(scale, ")") : "0,0) scale(".concat(scale, ")");
114
+ var transform = align === 'center' ? "translate(".concat(width / 2, ",").concat(height / 2 - 20, ") scale(").concat(scale, ")") : "translate(0,0) scale(".concat(scale, ")");
115
115
  return jsxRuntime.jsx(ResponsiveSVG, _objectSpread__default["default"](_objectSpread__default["default"]({
116
116
  width: width,
117
117
  height: height
@@ -119,12 +119,12 @@ function ParentsizeSVG(_ref) {
119
119
  children: jsxRuntime.jsx("g", {
120
120
  transform: transform,
121
121
  children: children
122
- }, void 0)
123
- }), void 0);
122
+ })
123
+ }));
124
124
  }
125
125
 
126
126
  var _excluded$1 = ["y", "x", "transform", "className", "children", "innerRef"];
127
- var Group = function Group(_ref) {
127
+ function Group(_ref) {
128
128
  var _ref$y = _ref.y,
129
129
  y = _ref$y === void 0 ? 0 : _ref$y,
130
130
  _ref$x = _ref.x,
@@ -141,11 +141,11 @@ var Group = function Group(_ref) {
141
141
  transform: transform || "translate(".concat(x, ", ").concat(y, ")")
142
142
  }, restProps), {}, {
143
143
  children: children
144
- }), void 0);
145
- };
144
+ }));
145
+ }
146
146
 
147
147
  var _excluded = ["from", "to", "fill", "className", "innerRef"];
148
- var Line = function Line(_ref) {
148
+ function Line(_ref) {
149
149
  var _ref$from = _ref.from,
150
150
  from = _ref$from === void 0 ? {
151
151
  x: 0,
@@ -172,8 +172,8 @@ var Line = function Line(_ref) {
172
172
  y2: to.y,
173
173
  fill: fill,
174
174
  shapeRendering: isRectilinear ? 'crispEdges' : 'auto'
175
- }, restProps), void 0);
176
- };
175
+ }, restProps));
176
+ }
177
177
 
178
178
  exports.Group = Group;
179
179
  exports.Line = Line;
@@ -1 +1 @@
1
- {"version":3,"file":"svg.cjs.development.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { FC, Ref } from 'react';\nimport { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n}\n\nexport const ResponsiveSVG: FC<ResponsiveSVGProps> = ({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}) => {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n};\n","import { CSSProperties, PropsWithChildren, RefObject, useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport { ResponsiveSVG, ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement> = {\n elementRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n elementRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(elementRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementRef.current.style[key as any] = value;\n }\n }, [elementRef, style]);\n\n const transform =\n align === 'center' ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})` : `0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import type { FC } from 'react';\nimport cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport const Group: FC<GroupProps> = ({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element => {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n};\n","import type { FC } from 'react';\nimport cx from 'classnames';\nimport { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport const Line: FC<LineProps> = ({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element => {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n};\n"],"names":["ResponsiveSVG","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","aspect","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","ParentsizeSVG","elementRef","scale","align","options","debounceDelay","optionsRest","rest","useParentSize","useEffect","current","Object","entries","key","value","transform","Group","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkBaA,aAAa,GAA2B,SAAxCA,aAAwC;MACnDC,cAAAA;MACAC,aAAAA;MACAC,gBAAAA;yBACAC;MAAAA,kCAAS;AAAEC,IAAAA,CAAC,EAAE,CAAL;AAAQC,IAAAA,CAAC,EAAE;AAAX;mCACTC;MAAAA,yDAAsB;MACtBC,gBAAAA;MACAC,iBAAAA;AAEA,MAAMC,MAAM,GAAGR,KAAK,GAAGD,MAAvB;AAEA,MAAMU,cAAc,GAAGC,IAAI,CAACC,IAAL,CAAUX,KAAK,GAAGQ,MAAlB,CAAvB;AAEA,SACEI;qBACgB;AACdC,IAAAA,KAAK,EAAE;AACLC,MAAAA,QAAQ,EAAE,UADL;AAELC,MAAAA,QAAQ,EAAE,SAFL;AAGLhB,MAAAA,MAAM,EAAE;AAHH;cAMPa;AACEC,MAAAA,KAAK,EAAE;AAAEE,QAAAA,QAAQ,EAAE;AAAZ;AACPR,MAAAA,SAAS,EAAEA;AACXF,MAAAA,mBAAmB,EAAEA;AACrBW,MAAAA,OAAO,YAAKd,MAAM,CAACC,CAAZ,cAAiBD,MAAM,CAACE,CAAxB,cAA6BJ,KAA7B,cAAsCS,cAAtC;AACPQ,MAAAA,GAAG,EAAEX;gBAEJL;;YAhBP;AAoBD;;;;ACpCM,IAAMiB,YAAY,GAAkB;AACzCC,EAAAA,OAAO,EAAE,MADgC;AAEzCC,EAAAA,aAAa,EAAE,QAF0B;AAGzCC,EAAAA,QAAQ,EAAE,CAH+B;AAI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H,SACE7B;AACEK,IAAAA,GAAG,EAAEX;AACLC,IAAAA,SAAS,EAAEmC,sBAAE,CAAC,YAAD,EAAenC,SAAf;AACbgC,IAAAA,SAAS,EAAEA,SAAS,wBAAiBpC,CAAjB,eAAuBC,CAAvB;KAChBqC;cAEHxC;aAPL;AAUD;;;ICtBY0C,IAAI,GAAkB,SAAtBA,IAAsB;uBACjCC;MAAAA,8BAAO;AAAEzC,IAAAA,CAAC,EAAE,CAAL;AAAQC,IAAAA,CAAC,EAAE;AAAX;qBACPyC;MAAAA,0BAAK;AAAE1C,IAAAA,CAAC,EAAE,CAAL;AAAQC,IAAAA,CAAC,EAAE;AAAX;uBACL0C;MAAAA,8BAAO;MACPvC,iBAAAA;MACAD,gBAAAA;MACGmC;;AAEH,MAAMM,aAAa,GAAGH,IAAI,CAACzC,CAAL,KAAW0C,EAAE,CAAC1C,CAAd,IAAmByC,IAAI,CAACxC,CAAL,KAAWyC,EAAE,CAACzC,CAAvD;AAEA,SACEQ;AACEK,IAAAA,GAAG,EAAEX;AACLC,IAAAA,SAAS,EAAEmC,sBAAE,CAAC,WAAD,EAAcnC,SAAd;AACbyC,IAAAA,EAAE,EAAEJ,IAAI,CAACzC;AACT8C,IAAAA,EAAE,EAAEL,IAAI,CAACxC;AACT8C,IAAAA,EAAE,EAAEL,EAAE,CAAC1C;AACPgD,IAAAA,EAAE,EAAEN,EAAE,CAACzC;AACP0C,IAAAA,IAAI,EAAEA;AACNM,IAAAA,cAAc,EAAEL,aAAa,GAAG,YAAH,GAAkB;KAC3CN,mBAVR;AAaD;;;;;;;"}
1
+ {"version":3,"file":"svg.cjs.development.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n elementRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n elementRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(elementRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementRef.current.style[key as any] = value;\n }\n }, [elementRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","aspect","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","ParentsizeSVG","elementRef","scale","align","options","debounceDelay","optionsRest","_objectWithoutProperties","_excluded","rest","useParentSize","_objectSpread","useEffect","current","Object","entries","_slicedToArray","key","value","transform","Group","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBgB,SAAAA,aAAA,CAQK,IAAA,EAAA;AAAA,EAPnBC,IAAAA,MAOmB,QAPnBA,MAOmB;AAAA,MANnBC,KAMmB,QANnBA,KAMmB;AAAA,MALnBC,QAKmB,QALnBA,QAKmB;AAAA,MAAA,WAAA,GAAA,IAAA,CAJnBC,MAImB;AAAA,MAJnBA,MAImB,GAJV,WAAA,KAAA,KAAA,CAAA,GAAA;AAAEC,IAAAA,CAAC,EAAE,CAAL;AAAQC,IAAAA,CAAC,EAAE,CAAA;AAAX,GAIU,GAAA,WAAA;AAAA,MAAA,qBAAA,GAAA,IAAA,CAHnBC,mBAGmB;AAAA,MAHnBA,mBAGmB,sCAHG,eAGH,GAAA,qBAAA;AAAA,MAFnBC,QAEmB,QAFnBA,QAEmB;AAAA,MADnBC,SACmB,QADnBA,SACmB,CAAA;AACnB,EAAA,IAAMC,MAAM,GAAGR,KAAK,GAAGD,MAAvB,CAAA;AAEA,EAAMU,IAAAA,cAAc,GAAGC,IAAI,CAACC,IAAL,CAAUX,KAAK,GAAGQ,MAAlB,CAAvB,CAAA;AAEA,EACEI,OAAAA,cAAA,CAAA,KAAA,EAAA;AAAA,IAAA,eAAA,EACgB,uBADhB;AAEEC,IAAAA,KAAK,EAAE;AACLC,MAAAA,QAAQ,EAAE,UADL;AAELC,MAAAA,QAAQ,EAAE,SA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I,EAAEA,IANN;AAOAM,IAAAA,cAAc,EAAEL,aAAa,GAAG,YAAH,GAAkB,MAAA;AAP/C,GAAA,EAQIN,SARJ,CAFJ,CAAA,CAAA;AAaD;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("@babel/runtime/helpers/objectSpread2"),i=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("react"),s=require("@cutting/use-get-parent-size"),a=require("classnames");function o(e){return e&&e.__esModule?e:{default:e}}var l=o(r),c=o(t),d=o(i),u=o(a);!function(){const e={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var f=function(r){var t=r.width,i=r.children,n=r.origin,s=void 0===n?{x:0,y:0}:n,a=r.preserveAspectRatio,o=void 0===a?"xMaxYMid meet":a,l=r.innerRef,c=r.className,d=Math.ceil(t/(t/r.height));return e.jsx("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e.jsx("svg",{style:{overflow:"visible"},className:c,preserveAspectRatio:o,viewBox:"".concat(s.x," ").concat(s.y," ").concat(t," ").concat(d),ref:l,children:i},void 0)},void 0)},v=["debounceDelay"],x=["elementRef","children","style","scale","align","options"],p={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},h=["y","x","transform","className","children","innerRef"],y=["from","to","fill","className","innerRef"];exports.Group=function(r){var t=r.y,i=void 0===t?0:t,n=r.x,s=void 0===n?0:n,a=r.transform,o=r.className,l=r.children,f=r.innerRef,v=d.default(r,h);return e.jsx("g",c.default(c.default({ref:f,className:u.default("visx-group",o),transform:a||"translate(".concat(s,", ").concat(i,")")},v),{},{children:l}),void 0)},exports.Line=function(r){var t=r.from,i=void 0===t?{x:0,y:0}:t,n=r.to,s=void 0===n?{x:1,y:1}:n,a=r.fill,o=void 0===a?"transparent":a,l=r.className,f=r.innerRef,v=d.default(r,y),x=i.x===s.x||i.y===s.y;return e.jsx("line",c.default({ref:f,className:u.default("visx-line",l),x1:i.x,y1:i.y,x2:s.x,y2:s.y,fill:o,shapeRendering:x?"crispEdges":"auto"},v),void 0)},exports.ParentsizeSVG=function(r){var t=r.elementRef,i=r.children,a=r.style,o=void 0===a?p:a,u=r.scale,h=void 0===u?1:u,y=r.align,m=void 0===y?"none":y,g=r.options,b=(g=void 0===g?{}:g).debounceDelay,j=void 0===b?50:b,R=d.default(g,v),N=d.default(r,x),w=s.useParentSize(t,c.default({debounceDelay:j},R)),q=w.width,D=w.height;n.useEffect((function(){if(t.current)for(var e=0,r=Object.entries(o);e<r.length;e++){var i=l.default(r[e],2);t.current.style[i[0]]=i[1]}}),[t,o]);var M="center"===m?"translate(".concat(q/2,",").concat(D/2-20,") scale(").concat(h,")"):"0,0) scale(".concat(h,")");return e.jsx(f,c.default(c.default({width:q,height:D},N),{},{children:e.jsx("g",{transform:M,children:i},void 0)}),void 0)},exports.ResponsiveSVG=f;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("@babel/runtime/helpers/objectSpread2"),n=require("@babel/runtime/helpers/objectWithoutProperties"),i=require("react"),s=require("@cutting/use-get-parent-size"),a=require("classnames");function o(e){return e&&e.__esModule?e:{default:e}}var l=o(r),c=o(t),u=o(n),d=o(a);function f(r){var t=r.width,n=r.children,i=r.origin,s=void 0===i?{x:0,y:0}:i,a=r.preserveAspectRatio,o=void 0===a?"xMaxYMid meet":a,l=r.innerRef,c=r.className,u=Math.ceil(t/(t/r.height));return e.jsx("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e.jsx("svg",{style:{overflow:"visible"},className:c,preserveAspectRatio:o,viewBox:"".concat(s.x," ").concat(s.y," ").concat(t," ").concat(u),ref:l,children:n})})}!function(){const e={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var v=["debounceDelay"],x=["elementRef","children","style","scale","align","options"],p={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},h=["y","x","transform","className","children","innerRef"],y=["from","to","fill","className","innerRef"];exports.Group=function(r){var t=r.y,n=void 0===t?0:t,i=r.x,s=void 0===i?0:i,a=r.transform,o=r.className,l=r.children,f=r.innerRef,v=u.default(r,h);return e.jsx("g",c.default(c.default({ref:f,className:d.default("visx-group",o),transform:a||"translate(".concat(s,", ").concat(n,")")},v),{},{children:l}))},exports.Line=function(r){var t=r.from,n=void 0===t?{x:0,y:0}:t,i=r.to,s=void 0===i?{x:1,y:1}:i,a=r.fill,o=void 0===a?"transparent":a,l=r.className,f=r.innerRef,v=u.default(r,y),x=n.x===s.x||n.y===s.y;return e.jsx("line",c.default({ref:f,className:d.default("visx-line",l),x1:n.x,y1:n.y,x2:s.x,y2:s.y,fill:o,shapeRendering:x?"crispEdges":"auto"},v))},exports.ParentsizeSVG=function(r){var t=r.elementRef,n=r.children,a=r.style,o=void 0===a?p:a,d=r.scale,h=void 0===d?1:d,y=r.align,m=void 0===y?"none":y,g=r.options,b=(g=void 0===g?{}:g).debounceDelay,j=void 0===b?50:b,R=u.default(g,v),N=u.default(r,x),w=s.useParentSize(t,c.default({debounceDelay:j},R)),q=w.width,D=w.height;i.useEffect((function(){if(t.current)for(var e=0,r=Object.entries(o);e<r.length;e++){var n=l.default(r[e],2);t.current.style[n[0]]=n[1]}}),[t,o]);var M="center"===m?"translate(".concat(q/2,",").concat(D/2-20,") scale(").concat(h,")"):"translate(0,0) scale(".concat(h,")");return e.jsx(f,c.default(c.default({width:q,height:D},N),{},{children:e.jsx("g",{transform:M,children:n})}))},exports.ResponsiveSVG=f;
2
2
  //# sourceMappingURL=svg.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"svg.cjs.production.min.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { FC, Ref } from 'react';\nimport { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n}\n\nexport const ResponsiveSVG: FC<ResponsiveSVGProps> = ({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}) => {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n};\n","import { CSSProperties, PropsWithChildren, RefObject, useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport { ResponsiveSVG, ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement> = {\n elementRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n elementRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(elementRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementRef.current.style[key as any] = value;\n }\n }, [elementRef, style]);\n\n const transform =\n align === 'center' ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})` : `0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import type { FC } from 'react';\nimport cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport const Group: FC<GroupProps> = ({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element => {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n};\n","import type { FC } from 'react';\nimport cx from 'classnames';\nimport { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport const Line: FC<LineProps> = ({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element => {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n};\n"],"names":["ResponsiveSVG","width","children","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","height","_jsx","style","position","overflow","viewBox","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","transform","restProps","cx","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering","elementRef","scale","align","options","debounceDelay","optionsRest","rest","useParentSize","useEffect","current","Object","entries"],"mappings":"ymBAkBaA,EAAwC,gBAEnDC,IAAAA,MACAC,IAAAA,aACAC,OAAAA,aAAS,CAAEC,EAAG,EAAGC,EAAG,SACpBC,oBAAAA,aAAsB,kBACtBC,IAAAA,SACAC,IAAAA,UAIMC,EAAiBC,KAAKC,KAAKV,GAFlBA,IARfW,gBAaEC,6BACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVJ,OAAQ,gBAGVC,aACEC,MAAO,CAAEE,SAAU,WACnBR,UAAWA,EACXF,oBAAqBA,EACrBW,kBAAYd,EAAOC,cAAKD,EAAOE,cAAKJ,cAASQ,GAC7CS,IAAKX,WAEJL,uGChCIiB,EAA8B,CACzCC,QAAS,OACTC,cAAe,SACfC,SAAU,EACVC,WAAY,EACZC,UAAW,KACXR,SAAU,gICJyB,oBACnCX,EAAAA,aAAI,QACJD,EAAAA,aAAI,IACJqB,IAAAA,UACAjB,IAAAA,UACAN,IAAAA,SACAK,IAAAA,SACGmB,wBAGDb,+BACEK,IAAKX,EACLC,UAAWmB,UAAG,aAAcnB,GAC5BiB,UAAWA,uBAA0BrB,eAAMC,QACvCqB,gBAEHxB,0BCnB4B,oBACjC0B,KAAAA,aAAO,CAAExB,EAAG,EAAGC,EAAG,SAClBwB,GAAAA,aAAK,CAAEzB,EAAG,EAAGC,EAAG,SAChByB,KAAAA,aAAO,gBACPtB,IAAAA,UACAD,IAAAA,SACGmB,iBAEGK,EAAgBH,EAAKxB,IAAMyB,EAAGzB,GAAKwB,EAAKvB,IAAMwB,EAAGxB,SAGrDQ,wBACEK,IAAKX,EACLC,UAAWmB,UAAG,YAAanB,GAC3BwB,GAAIJ,EAAKxB,EACT6B,GAAIL,EAAKvB,EACT6B,GAAIL,EAAGzB,EACP+B,GAAIN,EAAGxB,EACPyB,KAAMA,EACNM,eAAgBL,EAAgB,aAAe,QAC3CL,kDFTRW,IAAAA,WACAnC,IAAAA,aACAY,MAAAA,aAAQK,QACRmB,MAAAA,aAAQ,QACRC,MAAAA,aAAQ,aACRC,wBAAkD,MAAvCC,cAAAA,aAAgB,KAAOC,iBAC/BC,mBAEuBC,gBAAcP,aAAcI,cAAAA,GAAkBC,IAAhEzC,IAAAA,MAAOW,IAAAA,OAEfiC,aAAU,cACHR,EAAWS,sBAIWC,OAAOC,QAAQlC,kBAAQ,yBAEhDuB,EAAWS,QAAQhC,oBAEpB,CAACuB,EAAYvB,QAEVW,EACM,WAAVc,sBAAkCtC,EAAQ,cAAKW,EAAS,EAAI,sBAAa0B,4BAAyBA,cAGlGzB,MAACb,uBAAcC,MAAOA,EAAOW,OAAQA,GAAY+B,gBAC/C9B,WAAGY,UAAWA,WAAYvB"}
1
+ {"version":3,"file":"svg.cjs.production.min.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n elementRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n elementRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(elementRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementRef.current.style[key as any] = value;\n }\n }, [elementRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","_ref","height","width","children","_ref$origin","origin","x","y","_ref$preserveAspectRa","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","_ref$y","_ref$x","transform","restProps","_objectWithoutProperties","_excluded","_objectSpread","cx","_ref$from","from","_ref$to","to","_ref$fill","fill","isRectilinear","jsx","x1","y1","x2","y2","shapeRendering","elementRef","_ref$style","_ref$scale","scale","_ref$align","align","_ref$options","options","_ref$options$debounce","debounceDelay","optionsRest","rest","_excluded2","useParentSize","useEffect","current","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray"],"mappings":"+aAmBgB,SAAAA,EAQKC,GAPnBC,IACAC,IAAAA,MACAC,IAAAA,SAKmBC,EAAAJ,EAJnBK,OAAAA,OAAS,IAAAD,EAAA,CAAEE,EAAG,EAAGC,EAAG,GAIDH,EAAAI,EAAAR,EAHnBS,oBAAAA,aAAsB,gBAGHD,EAFnBE,IAAAA,SACAC,IAAAA,UAIMC,EAAiBC,KAAKC,KAAKZ,GAFlBA,IARfD,SAaEc,OAAAA,EAAAA,IAAA,MAAA,CAAA,gBACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVjB,OAAQ,OACTE,SAEDY,aACEC,MAAO,CAAEE,SAAU,WACnBP,UAAWA,EACXF,oBAAqBA,EACrBU,QAAO,GAAAC,OAAKf,EAAOC,EAAZ,KAAAc,OAAiBf,EAAOE,EAAxB,KAAAa,OAA6BlB,EAA7B,KAAAkB,OAAsCR,GAC7CS,IAAKX,EAAQP,SAEZA,kRC/BImB,EAA8B,CACzCC,QAAS,OACTC,cAAe,SACfC,SAAU,EACVC,WAAY,EACZC,UAAW,KACXT,SAAU,gICPN,SAQOlB,GAAA,IAAA4B,EAAA5B,EAPXO,EAAAA,aAAI,EAOOqB,EAAAC,EAAA7B,EANXM,EAAAA,aAAI,EAMOuB,EALXC,IAAAA,UACAnB,IAAAA,UACAR,IAAA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A6D,GACfC,EAAAA,EAAAA,cAAcb,EAADf,UAAA,CAAewB,cAAAA,GAAkBC,IAAhEzD,IAAAA,MAAOD,IAAAA,OAEf8D,EAAAA,WAAU,WACR,GAAKd,EAAWe,QAIhB,IAAA,IAAAC,EAAA,EAAAC,EAA2BC,OAAOC,QAAQpD,GAAQiD,EAAAC,EAAAG,OAAAJ,IAAA,CAA7C,IAAAK,EAAAC,EAAA,QAAAL,EAAAD,GAAA,GAEHhB,EAAWe,QAAQhD,MAFhBsD,EAAA,IAAAA,EAAA,MAIJ,CAACrB,EAAYjC,IAEhB,IAAMc,EACM,WAAVwB,EAAA,aAAAlC,OACiBlB,EAAQ,cAAKD,EAAS,EAAI,sBAAamD,EADxD,KAAA,wBAAAhC,OAE4BgC,EAH9B,KAMErC,OAAAA,MAAChB,uBAAcG,MAAOA,EAAOD,OAAQA,GAAY2D,OAAIzD,SACnDY,EAAG4B,IAAA,IAAA,CAAAb,UAAWA,WAAY3B"}
@@ -1,4 +1,3 @@
1
- import type { FC } from 'react';
2
1
  declare type GroupOnlyProps = {
3
2
  /** Top offset applied to `<g/>`. */
4
3
  y?: number;
@@ -11,6 +10,6 @@ declare type GroupOnlyProps = {
11
10
  innerRef?: React.Ref<SVGGElement>;
12
11
  };
13
12
  declare type GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;
14
- export declare const Group: FC<GroupProps>;
13
+ export declare function Group({ y, x, transform, className, children, innerRef, ...restProps }: GroupProps): JSX.Element;
15
14
  export {};
16
15
  //# sourceMappingURL=Group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../../src/components/Group/Group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,aAAK,cAAc,GAAG;IACpB,oCAAoC;IACpC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CACnC,CAAC;AAEF,aAAK,UAAU,GAAG,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,cAAc,CAAC,CAAC;AAE3F,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAmBhC,CAAC"}
1
+ {"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../../src/components/Group/Group.tsx"],"names":[],"mappings":"AAEA,aAAK,cAAc,GAAG;IACpB,oCAAoC;IACpC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CACnC,CAAC;AAEF,aAAK,UAAU,GAAG,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,cAAc,CAAC,CAAC;AAE3F,wBAAgB,KAAK,CAAC,EACpB,CAAK,EACL,CAAK,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAW1B"}
@@ -1,5 +1,4 @@
1
- import type { FC } from 'react';
2
- import { Point } from '../../types/types';
1
+ import type { AddSVGProps, Point } from '../../types/types';
3
2
  export declare type LineProps = {
4
3
  className?: string;
5
4
  innerRef?: React.Ref<SVGLineElement>;
@@ -9,5 +8,5 @@ export declare type LineProps = {
9
8
  /** Ending x,y point of the line. */
10
9
  to?: Point;
11
10
  };
12
- export declare const Line: FC<LineProps>;
11
+ export declare function Line({ from, to, fill, className, innerRef, ...restProps }: AddSVGProps<LineProps, SVGLineElement>): JSX.Element;
13
12
  //# sourceMappingURL=Line.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/components/Line/Line.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAe,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEvD,oBAAY,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,oCAAoC;IACpC,EAAE,CAAC,EAAE,KAAK,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAuB9B,CAAC"}
1
+ {"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/components/Line/Line.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE5D,oBAAY,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,oCAAoC;IACpC,EAAE,CAAC,EAAE,KAAK,CAAC;CACZ,CAAC;AAEF,wBAAgB,IAAI,CAAC,EACnB,IAAqB,EACrB,EAAmB,EACnB,IAAoB,EACpB,SAAS,EACT,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,WAAW,CAAC,SAAS,EAAE,cAAc,CAAC,GAAG,GAAG,CAAC,OAAO,CAgBtD"}
@@ -1,8 +1,8 @@
1
- import { CSSProperties, PropsWithChildren, RefObject } from 'react';
1
+ import type { CSSProperties, PropsWithChildren, RefObject } from 'react';
2
2
  import type { UseParentSizeOptions } from '@cutting/use-get-parent-size';
3
- import { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';
3
+ import type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';
4
4
  declare type Align = 'none' | 'center';
5
- export declare type ParentsizeSVGProps<E extends HTMLElement> = {
5
+ export declare type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {
6
6
  elementRef: RefObject<E>;
7
7
  style?: CSSProperties;
8
8
  align?: Align;
@@ -1 +1 @@
1
- {"version":3,"file":"ParentsizeSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ParentsizeSVG/ParentsizeSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EAAiB,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEnF,aAAK,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE/B,oBAAY,kBAAkB,CAAC,CAAC,SAAS,WAAW,IAAI;IACtD,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACzB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACzC,GAAG,OAAO,CAAC,IAAI,CAAC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,EACV,QAAQ,EACR,KAAoB,EACpB,KAAS,EACT,KAAc,EACd,OAAO,EAAE,EAAE,aAAkB,EAAE,GAAG,WAAW,EAAO,EACpD,GAAG,IAAI,EACR,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAwB/D"}
@@ -1,5 +1,5 @@
1
- import type { FC, Ref } from 'react';
2
- import { PreserveAspectRatio } from '../../types/types';
1
+ import type { ReactNode, Ref } from 'react';
2
+ import type { PreserveAspectRatio } from '../../types/types';
3
3
  export interface Point {
4
4
  x: number;
5
5
  y: number;
@@ -12,6 +12,7 @@ export interface ResponsiveSVGProps {
12
12
  innerRef?: Ref<SVGSVGElement>;
13
13
  className?: string;
14
14
  hide?: boolean;
15
+ children: ReactNode;
15
16
  }
16
- export declare const ResponsiveSVG: FC<ResponsiveSVGProps>;
17
+ export declare function ResponsiveSVG({ height, width, children, origin, preserveAspectRatio, innerRef, className, }: ResponsiveSVGProps): JSX.Element;
17
18
  //# sourceMappingURL=ResponsiveSVG.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsiveSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAiChD,CAAC"}
1
+ {"version":3,"file":"ResponsiveSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,QAAQ,EACR,MAAuB,EACvB,mBAAqC,EACrC,QAAQ,EACR,SAAS,GACV,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAyBlC"}
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import r from"@babel/runtime/helpers/esm/slicedToArray";import i from"@babel/runtime/helpers/esm/objectSpread2";import o from"@babel/runtime/helpers/esm/objectWithoutProperties";import{useEffect as n}from"react";import{useParentSize as t}from"@cutting/use-get-parent-size";import s from"classnames";!function(){const e={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var c=function(r){var i=r.width,o=r.children,n=r.origin,t=void 0===n?{x:0,y:0}:n,s=r.preserveAspectRatio,c=void 0===s?"xMaxYMid meet":s,a=r.innerRef,l=r.className,d=Math.ceil(i/(i/r.height));return e("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e("svg",{style:{overflow:"visible"},className:l,preserveAspectRatio:c,viewBox:"".concat(t.x," ").concat(t.y," ").concat(i," ").concat(d),ref:a,children:o},void 0)},void 0)},a=["debounceDelay"],l=["elementRef","children","style","scale","align","options"],d={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"};function v(s){var v=s.elementRef,f=s.children,m=s.style,p=void 0===m?d:m,h=s.scale,u=void 0===h?1:h,x=s.align,y=void 0===x?"none":x,g=s.options,b=(g=void 0===g?{}:g).debounceDelay,N=void 0===b?50:b,R=o(g,a),w=o(s,l),j=t(v,i({debounceDelay:N},R)),D=j.width,O=j.height;n((function(){if(v.current)for(var e=0,i=Object.entries(p);e<i.length;e++){var o=r(i[e],2);v.current.style[o[0]]=o[1]}}),[v,p]);var A="center"===y?"translate(".concat(D/2,",").concat(O/2-20,") scale(").concat(u,")"):"0,0) scale(".concat(u,")");return e(c,i(i({width:D,height:O},w),{},{children:e("g",{transform:A,children:f},void 0)}),void 0)}var f=["y","x","transform","className","children","innerRef"],m=function(r){var n=r.y,t=void 0===n?0:n,c=r.x,a=void 0===c?0:c,l=r.transform,d=r.className,v=r.children,m=r.innerRef,p=o(r,f);return e("g",i(i({ref:m,className:s("visx-group",d),transform:l||"translate(".concat(a,", ").concat(t,")")},p),{},{children:v}),void 0)},p=["from","to","fill","className","innerRef"],h=function(r){var n=r.from,t=void 0===n?{x:0,y:0}:n,c=r.to,a=void 0===c?{x:1,y:1}:c,l=r.fill,d=void 0===l?"transparent":l,v=r.className,f=r.innerRef,m=o(r,p),h=t.x===a.x||t.y===a.y;return e("line",i({ref:f,className:s("visx-line",v),x1:t.x,y1:t.y,x2:a.x,y2:a.y,fill:d,shapeRendering:h?"crispEdges":"auto"},m),void 0)};export{m as Group,h as Line,v as ParentsizeSVG,c as ResponsiveSVG};
1
+ import{jsx as e}from"react/jsx-runtime";import r from"@babel/runtime/helpers/esm/slicedToArray";import t from"@babel/runtime/helpers/esm/objectSpread2";import i from"@babel/runtime/helpers/esm/objectWithoutProperties";import{useEffect as n}from"react";import{useParentSize as o}from"@cutting/use-get-parent-size";import s from"classnames";function a(r){var t=r.width,i=r.children,n=r.origin,o=void 0===n?{x:0,y:0}:n,s=r.preserveAspectRatio,a=void 0===s?"xMaxYMid meet":s,c=r.innerRef,l=r.className,f=Math.ceil(t/(t/r.height));return e("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e("svg",{style:{overflow:"visible"},className:l,preserveAspectRatio:a,viewBox:"".concat(o.x," ").concat(o.y," ").concat(t," ").concat(f),ref:c,children:i})})}!function(){const e={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var c=["debounceDelay"],l=["elementRef","children","style","scale","align","options"],f={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"};function v(s){var v=s.elementRef,d=s.children,m=s.style,p=void 0===m?f:m,h=s.scale,u=void 0===h?1:h,x=s.align,y=void 0===x?"none":x,g=s.options,b=(g=void 0===g?{}:g).debounceDelay,N=void 0===b?50:b,R=i(g,c),w=i(s,l),j=o(v,t({debounceDelay:N},R)),D=j.width,O=j.height;n((function(){if(v.current)for(var e=0,t=Object.entries(p);e<t.length;e++){var i=r(t[e],2);v.current.style[i[0]]=i[1]}}),[v,p]);var A="center"===y?"translate(".concat(D/2,",").concat(O/2-20,") scale(").concat(u,")"):"translate(0,0) scale(".concat(u,")");return e(a,t(t({width:D,height:O},w),{},{children:e("g",{transform:A,children:d})}))}var d=["y","x","transform","className","children","innerRef"];function m(r){var n=r.y,o=void 0===n?0:n,a=r.x,c=void 0===a?0:a,l=r.transform,f=r.className,v=r.children,m=r.innerRef,p=i(r,d);return e("g",t(t({ref:m,className:s("visx-group",f),transform:l||"translate(".concat(c,", ").concat(o,")")},p),{},{children:v}))}var p=["from","to","fill","className","innerRef"];function h(r){var n=r.from,o=void 0===n?{x:0,y:0}:n,a=r.to,c=void 0===a?{x:1,y:1}:a,l=r.fill,f=void 0===l?"transparent":l,v=r.className,d=r.innerRef,m=i(r,p),h=o.x===c.x||o.y===c.y;return e("line",t({ref:d,className:s("visx-line",v),x1:o.x,y1:o.y,x2:c.x,y2:c.y,fill:f,shapeRendering:h?"crispEdges":"auto"},m))}export{m as Group,h as Line,v as ParentsizeSVG,a as ResponsiveSVG};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { FC, Ref } from 'react';\nimport { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n}\n\nexport const ResponsiveSVG: FC<ResponsiveSVGProps> = ({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}) => {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n};\n","import { CSSProperties, PropsWithChildren, RefObject, useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport { ResponsiveSVG, ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement> = {\n elementRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n elementRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(elementRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementRef.current.style[key as any] = value;\n }\n }, [elementRef, style]);\n\n const transform =\n align === 'center' ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})` : `0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import type { FC } from 'react';\nimport cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport const Group: FC<GroupProps> = ({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element => {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n};\n","import type { FC } from 'react';\nimport cx from 'classnames';\nimport { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport const Line: FC<LineProps> = ({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element => {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n};\n"],"names":["ResponsiveSVG","width","children","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","height","_jsx","style","position","overflow","viewBox","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","ParentsizeSVG","elementRef","scale","align","options","debounceDelay","optionsRest","rest","useParentSize","useEffect","current","Object","entries","transform","Group","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":"6gBAkBaA,EAAwC,gBAEnDC,IAAAA,MACAC,IAAAA,aACAC,OAAAA,aAAS,CAAEC,EAAG,EAAGC,EAAG,SACpBC,oBAAAA,aAAsB,kBACtBC,IAAAA,SACAC,IAAAA,UAIMC,EAAiBC,KAAKC,KAAKV,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C,EAAGxC,GAAKuC,EAAKtC,IAAMuC,EAAGvC,SAGrDQ,YACEK,IAAKX,EACLC,UAAWiC,EAAG,YAAajC,GAC3BuC,GAAIJ,EAAKvC,EACT4C,GAAIL,EAAKtC,EACT4C,GAAIL,EAAGxC,EACP8C,GAAIN,EAAGvC,EACPwC,KAAMA,EACNM,eAAgBL,EAAgB,aAAe,QAC3CN"}
1
+ {"version":3,"file":"index.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n elementRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n elementRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(elementRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementRef.current.style[key as any] = value;\n }\n }, [elementRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","_ref","height","width","children","_ref$origin","origin","x","y","_ref$preserveAspectRa","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","ParentsizeSVG","elementRef","_ref$style","_ref$scale","scale","_ref$align","align","_ref$options","options","_ref$options$debounce","debounceDelay","optionsRest","_objectWithoutProperties","_excluded","rest","_excluded2","useParentSize","_objectSpread","useEffect","current","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","transform","Group","_ref$y","_ref$x","restProps","cx","Line","_ref$from","from","_ref$to","to","_ref$fill","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":"mVAmBgB,SAAAA,EAQKC,GAPnBC,IACAC,IAAAA,MACAC,IAAAA,SAKmBC,EAAAJ,EAJnBK,OAAAA,OAAS,IAAAD,EAAA,CAAEE,EAAG,EAAGC,EAAG,GAIDH,EAAAI,EAAAR,EAHnBS,oBAAAA,aAAsB,gBAGHD,EAFnBE,IAAAA,SACAC,IAAAA,UAIMC,EAAiBC,KAAKC,KAAK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AH9B,KAMEjB,OAAAA,EAAChB,OAAcG,MAAOA,EAAOD,OAAQA,GAAYyC,OAAIvC,SACnDY,EAAG,IAAA,CAAAwC,UAAWA,WAAYpD,qECvC1B,SAAUqD,EAQHxD,GAAA,IAAAyD,EAAAzD,EAPXO,EAAAA,aAAI,EAOOkD,EAAAC,EAAA1D,EANXM,EAAAA,aAAI,EAMOoD,EALXH,IAAAA,UACA5C,IAAAA,UACAR,IAAAA,SACAO,IAAAA,SACGiD,EACQnB,EAAAxC,EAAAyC,GAET1B,OAAAA,EAAA,IAAA8B,EAAAA,EAAA,CACExB,IAAKX,EACLC,UAAWiD,EAAG,aAAcjD,GAC5B4C,UAAWA,GAA0BjD,aAAAA,OAAAA,eAAMC,EAAvB,MAChBoD,GAJN,GAAA,CAIexD,SAEZA,gECnBS0D,EAOyB7D,GAAA,IAAA8D,EAAA9D,EANvC+D,KAAAA,OAAO,IAAAD,EAAA,CAAExD,EAAG,EAAGC,EAAG,GAMqBuD,EAAAE,EAAAhE,EALvCiE,GAAAA,OAAK,IAAAD,EAAA,CAAE1D,EAAG,EAAGC,EAAG,GAKuByD,EAAAE,EAAAlE,EAJvCmE,KAAAA,aAAO,cAIgCD,EAHvCvD,IAAAA,UACAD,IAAAA,SACGiD,EACoCnB,EAAAxC,EAAAyC,GACjC2B,EAAgBL,EAAKzD,IAAM2D,EAAG3D,GAAKyD,EAAKxD,IAAM0D,EAAG1D,EAGrDQ,OAAAA,EACE,OAAA8B,EAAA,CAAAxB,IAAKX,EACLC,UAAWiD,EAAG,YAAajD,GAC3B0D,GAAIN,EAAKzD,EACTgE,GAAIP,EAAKxD,EACTgE,GAAIN,EAAG3D,EACPkE,GAAIP,EAAG1D,EACP4D,KAAMA,EACNM,eAAgBL,EAAgB,aAAe,QAC3CT"}
@@ -1,4 +1,3 @@
1
- import type { FC } from 'react';
2
1
  declare type GroupOnlyProps = {
3
2
  /** Top offset applied to `<g/>`. */
4
3
  y?: number;
@@ -11,6 +10,6 @@ declare type GroupOnlyProps = {
11
10
  innerRef?: React.Ref<SVGGElement>;
12
11
  };
13
12
  declare type GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;
14
- export declare const Group: FC<GroupProps>;
13
+ export declare function Group({ y, x, transform, className, children, innerRef, ...restProps }: GroupProps): JSX.Element;
15
14
  export {};
16
15
  //# sourceMappingURL=Group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../../src/components/Group/Group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,aAAK,cAAc,GAAG;IACpB,oCAAoC;IACpC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CACnC,CAAC;AAEF,aAAK,UAAU,GAAG,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,cAAc,CAAC,CAAC;AAE3F,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAmBhC,CAAC"}
1
+ {"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../../src/components/Group/Group.tsx"],"names":[],"mappings":"AAEA,aAAK,cAAc,GAAG;IACpB,oCAAoC;IACpC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CACnC,CAAC;AAEF,aAAK,UAAU,GAAG,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,cAAc,CAAC,CAAC;AAE3F,wBAAgB,KAAK,CAAC,EACpB,CAAK,EACL,CAAK,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAW1B"}
@@ -1,5 +1,4 @@
1
- import type { FC } from 'react';
2
- import { Point } from '../../types/types';
1
+ import type { AddSVGProps, Point } from '../../types/types';
3
2
  export declare type LineProps = {
4
3
  className?: string;
5
4
  innerRef?: React.Ref<SVGLineElement>;
@@ -9,5 +8,5 @@ export declare type LineProps = {
9
8
  /** Ending x,y point of the line. */
10
9
  to?: Point;
11
10
  };
12
- export declare const Line: FC<LineProps>;
11
+ export declare function Line({ from, to, fill, className, innerRef, ...restProps }: AddSVGProps<LineProps, SVGLineElement>): JSX.Element;
13
12
  //# sourceMappingURL=Line.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/components/Line/Line.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAe,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEvD,oBAAY,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,oCAAoC;IACpC,EAAE,CAAC,EAAE,KAAK,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAuB9B,CAAC"}
1
+ {"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/components/Line/Line.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE5D,oBAAY,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,oCAAoC;IACpC,EAAE,CAAC,EAAE,KAAK,CAAC;CACZ,CAAC;AAEF,wBAAgB,IAAI,CAAC,EACnB,IAAqB,EACrB,EAAmB,EACnB,IAAoB,EACpB,SAAS,EACT,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,WAAW,CAAC,SAAS,EAAE,cAAc,CAAC,GAAG,GAAG,CAAC,OAAO,CAgBtD"}
@@ -1,8 +1,8 @@
1
- import { CSSProperties, PropsWithChildren, RefObject } from 'react';
1
+ import type { CSSProperties, PropsWithChildren, RefObject } from 'react';
2
2
  import type { UseParentSizeOptions } from '@cutting/use-get-parent-size';
3
- import { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';
3
+ import type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';
4
4
  declare type Align = 'none' | 'center';
5
- export declare type ParentsizeSVGProps<E extends HTMLElement> = {
5
+ export declare type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {
6
6
  elementRef: RefObject<E>;
7
7
  style?: CSSProperties;
8
8
  align?: Align;
@@ -1 +1 @@
1
- {"version":3,"file":"ParentsizeSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ParentsizeSVG/ParentsizeSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBA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AAM,GAAG,QAAQ,CAAC;AAE/B,oBAAY,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI;IACpE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACzB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACzC,GAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;AAExE,eAAO,MAAM,YAAY,EAAE,aAOjB,CAAC;AAEX,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAAW,EAAE,EACnD,UAAU,EACV,QAAQ,EACR,KAAoB,EACpB,KAAS,EACT,KAAc,EACd,OAAO,EAAE,EAAE,aAAkB,EAAE,GAAG,WAAW,EAAO,EACpD,GAAG,IAAI,EACR,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAwB/D"}
@@ -1,5 +1,5 @@
1
- import type { FC, Ref } from 'react';
2
- import { PreserveAspectRatio } from '../../types/types';
1
+ import type { ReactNode, Ref } from 'react';
2
+ import type { PreserveAspectRatio } from '../../types/types';
3
3
  export interface Point {
4
4
  x: number;
5
5
  y: number;
@@ -12,6 +12,7 @@ export interface ResponsiveSVGProps {
12
12
  innerRef?: Ref<SVGSVGElement>;
13
13
  className?: string;
14
14
  hide?: boolean;
15
+ children: ReactNode;
15
16
  }
16
- export declare const ResponsiveSVG: FC<ResponsiveSVGProps>;
17
+ export declare function ResponsiveSVG({ height, width, children, origin, preserveAspectRatio, innerRef, className, }: ResponsiveSVGProps): JSX.Element;
17
18
  //# sourceMappingURL=ResponsiveSVG.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsiveSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAiChD,CAAC"}
1
+ {"version":3,"file":"ResponsiveSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,QAAQ,EACR,MAAuB,EACvB,mBAAqC,EACrC,QAAQ,EACR,SAAS,GACV,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAyBlC"}
package/dist/umd/index.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/objectSpread2"),require("@babel/runtime/helpers/objectWithoutProperties"),require("react"),require("@cutting/use-get-parent-size"),require("classnames")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","@babel/runtime/helpers/slicedToArray","@babel/runtime/helpers/objectSpread2","@babel/runtime/helpers/objectWithoutProperties","react","@cutting/use-get-parent-size","classnames"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@cutting/svg"]={},e.jsxRuntime,e._slicedToArray,e._objectSpread,e._objectWithoutProperties,e.React,e.useGetParentSize,e.cx)}(this,(function(e,t,r,i,n,s,a,o){"use strict";function c(e){return e&&e.__esModule?e:{default:e}}var l=c(r),d=c(i),u=c(n),f=c(o);!function(){const e={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var v=function(e){var r=e.width,i=e.children,n=e.origin,s=void 0===n?{x:0,y:0}:n,a=e.preserveAspectRatio,o=void 0===a?"xMaxYMid meet":a,c=e.innerRef,l=e.className,d=Math.ceil(r/(r/e.height));return t.jsx("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:t.jsx("svg",{style:{overflow:"visible"},className:l,preserveAspectRatio:o,viewBox:"".concat(s.x," ").concat(s.y," ").concat(r," ").concat(d),ref:c,children:i},void 0)},void 0)},p=["debounceDelay"],h=["elementRef","children","style","scale","align","options"],x={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},m=["y","x","transform","className","children","innerRef"],b=["from","to","fill","className","innerRef"];e.Group=function(e){var r=e.y,i=void 0===r?0:r,n=e.x,s=void 0===n?0:n,a=e.transform,o=e.className,c=e.children,l=e.innerRef,v=u.default(e,m);return t.jsx("g",d.default(d.default({ref:l,className:f.default("visx-group",o),transform:a||"translate(".concat(s,", ").concat(i,")")},v),{},{children:c}),void 0)},e.Line=function(e){var r=e.from,i=void 0===r?{x:0,y:0}:r,n=e.to,s=void 0===n?{x:1,y:1}:n,a=e.fill,o=void 0===a?"transparent":a,c=e.className,l=e.innerRef,v=u.default(e,b),p=i.x===s.x||i.y===s.y;return t.jsx("line",d.default({ref:l,className:f.default("visx-line",c),x1:i.x,y1:i.y,x2:s.x,y2:s.y,fill:o,shapeRendering:p?"crispEdges":"auto"},v),void 0)},e.ParentsizeSVG=function(e){var r=e.elementRef,i=e.children,n=e.style,o=void 0===n?x:n,c=e.scale,f=void 0===c?1:c,m=e.align,b=void 0===m?"none":m,y=e.options,g=(y=void 0===y?{}:y).debounceDelay,j=void 0===g?50:g,R=u.default(y,p),N=u.default(e,h),w=a.useParentSize(r,d.default({debounceDelay:j},R)),S=w.width,q=w.height;s.useEffect((function(){if(r.current)for(var e=0,t=Object.entries(o);e<t.length;e++){var i=l.default(t[e],2);r.current.style[i[0]]=i[1]}}),[r,o]);var P="center"===b?"translate(".concat(S/2,",").concat(q/2-20,") scale(").concat(f,")"):"0,0) scale(".concat(f,")");return t.jsx(v,d.default(d.default({width:S,height:q},N),{},{children:t.jsx("g",{transform:P,children:i},void 0)}),void 0)},e.ResponsiveSVG=v}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/objectSpread2"),require("@babel/runtime/helpers/objectWithoutProperties"),require("react"),require("@cutting/use-get-parent-size"),require("classnames")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","@babel/runtime/helpers/slicedToArray","@babel/runtime/helpers/objectSpread2","@babel/runtime/helpers/objectWithoutProperties","react","@cutting/use-get-parent-size","classnames"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@cutting/svg"]={},e.jsxRuntime,e._slicedToArray,e._objectSpread,e._objectWithoutProperties,e.React,e.useGetParentSize,e.cx)}(this,(function(e,t,r,i,n,s,a,o){"use strict";function c(e){return e&&e.__esModule?e:{default:e}}var l=c(r),u=c(i),d=c(n),f=c(o);function p(e){var r=e.width,i=e.children,n=e.origin,s=void 0===n?{x:0,y:0}:n,a=e.preserveAspectRatio,o=void 0===a?"xMaxYMid meet":a,c=e.innerRef,l=e.className,u=Math.ceil(r/(r/e.height));return t.jsx("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:t.jsx("svg",{style:{overflow:"visible"},className:l,preserveAspectRatio:o,viewBox:"".concat(s.x," ").concat(s.y," ").concat(r," ").concat(u),ref:c,children:i})})}!function(){const e={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var v=["debounceDelay"],h=["elementRef","children","style","scale","align","options"],x={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},m=["y","x","transform","className","children","innerRef"],b=["from","to","fill","className","innerRef"];e.Group=function(e){var r=e.y,i=void 0===r?0:r,n=e.x,s=void 0===n?0:n,a=e.transform,o=e.className,c=e.children,l=e.innerRef,p=d.default(e,m);return t.jsx("g",u.default(u.default({ref:l,className:f.default("visx-group",o),transform:a||"translate(".concat(s,", ").concat(i,")")},p),{},{children:c}))},e.Line=function(e){var r=e.from,i=void 0===r?{x:0,y:0}:r,n=e.to,s=void 0===n?{x:1,y:1}:n,a=e.fill,o=void 0===a?"transparent":a,c=e.className,l=e.innerRef,p=d.default(e,b),v=i.x===s.x||i.y===s.y;return t.jsx("line",u.default({ref:l,className:f.default("visx-line",c),x1:i.x,y1:i.y,x2:s.x,y2:s.y,fill:o,shapeRendering:v?"crispEdges":"auto"},p))},e.ParentsizeSVG=function(e){var r=e.elementRef,i=e.children,n=e.style,o=void 0===n?x:n,c=e.scale,f=void 0===c?1:c,m=e.align,b=void 0===m?"none":m,y=e.options,g=(y=void 0===y?{}:y).debounceDelay,j=void 0===g?50:g,R=d.default(y,v),N=d.default(e,h),w=a.useParentSize(r,u.default({debounceDelay:j},R)),S=w.width,q=w.height;s.useEffect((function(){if(r.current)for(var e=0,t=Object.entries(o);e<t.length;e++){var i=l.default(t[e],2);r.current.style[i[0]]=i[1]}}),[r,o]);var P="center"===b?"translate(".concat(S/2,",").concat(q/2-20,") scale(").concat(f,")"):"translate(0,0) scale(".concat(f,")");return t.jsx(p,u.default(u.default({width:S,height:q},N),{},{children:t.jsx("g",{transform:P,children:i})}))},e.ResponsiveSVG=p}));
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { FC, Ref } from 'react';\nimport { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n}\n\nexport const ResponsiveSVG: FC<ResponsiveSVGProps> = ({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}) => {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n};\n","import { CSSProperties, PropsWithChildren, RefObject, useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport { ResponsiveSVG, ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement> = {\n elementRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n elementRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(elementRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementRef.current.style[key as any] = value;\n }\n }, [elementRef, style]);\n\n const transform =\n align === 'center' ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})` : `0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import type { FC } from 'react';\nimport cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport const Group: FC<GroupProps> = ({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element => {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n};\n","import type { FC } from 'react';\nimport cx from 'classnames';\nimport { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport const Line: FC<LineProps> = ({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element => {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n};\n"],"names":["ResponsiveSVG","width","children","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","height","_jsx","style","position","overflow","viewBox","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","transform","restProps","cx","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering","elementRef","scale","align","options","debounceDelay","optionsRest","rest","useParentSize","useEffect","current","Object","entries"],"mappings":"wkCAkBaA,EAAwC,gBAEnDC,IAAAA,MACAC,IAAAA,aACAC,OAAAA,aAAS,CAAEC,EAAG,EAAGC,EAAG,SACp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IAAhEzC,IAAAA,MAAOW,IAAAA,OAEfiC,aAAU,cACHR,EAAWS,sBAIWC,OAAOC,QAAQlC,kBAAQ,yBAEhDuB,EAAWS,QAAQhC,oBAEpB,CAACuB,EAAYvB,QAEVW,EACM,WAAVc,sBAAkCtC,EAAQ,cAAKW,EAAS,EAAI,sBAAa0B,4BAAyBA,cAGlGzB,MAACb,uBAAcC,MAAOA,EAAOW,OAAQA,GAAY+B,gBAC/C9B,WAAGY,UAAWA,WAAYvB"}
1
+ {"version":3,"file":"index.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n elementRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n elementRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(elementRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementRef.current.style[key as any] = value;\n }\n }, [elementRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport function Group({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n}\n","import cx from 'classnames';\nimport type { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport function Line({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n}\n"],"names":["ResponsiveSVG","_ref","height","width","children","_ref$origin","origin","x","y","_ref$preserveAspectRa","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","_ref$y","_ref$x","transform","restProps","_objectWithoutProperties","_excluded","_objectSpread","cx","_ref$from","from","_ref$to","to","_ref$fill","fill","isRectilinear","jsx","x1","y1","x2","y2","shapeRendering","elementRef","_ref$style","_ref$scale","scale","_ref$align","align","_ref$options","options","_ref$options$debounce","debounceDelay","optionsRest","rest","_excluded2","useParentSize","useEffect","current","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray"],"mappings":"84BAmBgB,SAAAA,EAQKC,GAPnBC,IACAC,IAAAA,MACAC,IAAAA,SAKmBC,EAAAJ,EAJnBK,OAAAA,OAAS,IAAAD,EAAA,CAAEE,EAAG,EAAGC,EAAG,GAIDH,EAAAI,EAAAR,EAHnBS,oBAAAA,aAAsB,gBAGHD,EAFnB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GED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cutting/svg",
3
- "version": "4.31.6",
3
+ "version": "4.32.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dagda1/cuttingedge.git"
@@ -15,33 +15,33 @@
15
15
  "types": "dist/esm/index.d.ts",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@cutting/use-get-parent-size": "1.6.6",
19
- "@cutting/util": "4.29.6",
18
+ "@cutting/use-get-parent-size": "1.6.10",
19
+ "@cutting/util": "4.31.0",
20
+ "classnames": "^2.3.1",
20
21
  "resize-observer-polyfill": "^1.5.1"
21
22
  },
22
23
  "devDependencies": {
23
- "@cutting/devtools": "4.31.6",
24
- "@cutting/eslint-config": "4.28.3",
25
- "@cutting/tsconfig": "4.26.2",
26
- "@cutting/useful-types": "4.25.7",
27
- "@testing-library/jest-dom": "^5.16.1",
28
- "eslint": "^8.6.0",
29
- "react": "^17.0.2",
30
- "react-dom": "^17.0.2",
31
- "typescript": "^4.5.3"
24
+ "@babel/runtime": "7.17.8",
25
+ "@cutting/component-library": "5.5.0",
26
+ "@cutting/devtools": "4.31.8",
27
+ "@cutting/eslint-config": "4.29.0",
28
+ "@cutting/tsconfig": "4.26.4",
29
+ "@cutting/useful-types": "4.25.9",
30
+ "@jest/globals": "27.5.1",
31
+ "@testing-library/jest-dom": "5.16.2",
32
+ "@testing-library/react": "^12.1.4",
33
+ "@vanilla-extract/babel-plugin": "1.1.5",
34
+ "@vanilla-extract/css": "1.6.8",
35
+ "@vanilla-extract/sprinkles": "1.4.0",
36
+ "eslint": "8.11.0",
37
+ "react": "17.0.2",
38
+ "react-dom": "17.0.2",
39
+ "typescript": "4.6.2"
32
40
  },
33
41
  "peerDependencies": {
34
42
  "react": ">= 17.x.x",
35
43
  "react-dom": ">= 17.x.x"
36
44
  },
37
- "scripts": {
38
- "build": "NODE_ENV=development cutting rollup",
39
- "lint": "yarn eslint ./src/**/*.{ts,tsx} --fix",
40
- "start": "PORT=8888 NODE_ENV=development cutting devserver-start",
41
- "test": "NODE_ENV=test cutting test",
42
- "test:ci": "CI=true yarn test",
43
- "prepack": "yarn build"
44
- },
45
45
  "volta": {
46
46
  "extends": "../../package.json"
47
47
  },
@@ -56,5 +56,13 @@
56
56
  "dist/esm/index.d.ts"
57
57
  ]
58
58
  }
59
- }
60
- }
59
+ },
60
+ "scripts": {
61
+ "build": "NODE_ENV=production cutting rollup",
62
+ "lint": "eslint ./src/**/*.{ts,tsx} --fix",
63
+ "start": "PORT=8888 NODE_ENV=development cutting devserver-start",
64
+ "test": "NODE_ENV=test cutting test",
65
+ "test:ci": "CI=true pnpm test"
66
+ },
67
+ "readme": "# @cutting/svg - reusable svg components for SVG documents\n[![npm version](https://img.shields.io/npm/v/@cutting/svg.svg)](https://www.npmjs.com/package/@cutting/svg)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\n## install \n\n```sh\npnpm add @cutting/svg\n\n# or\n\nnpm install @cutting/svg\n```\n\n## ParentsizeSVG\n\nA react component that will resize and scale to the dimensions of the supplied react [ref object](https://reactjs.org/docs/refs-and-the-dom.html).\n\n![svg document resizing to scale when using the ParentsizeSVG component](./img/sizer.gif)\n\nThe `ParentsizeSVG` component takes an `elementRef` prop that should point to a valid HTML DOM element.\n\n## usage\n\n```ts\nimport { useRef } from 'react';\nimport { ParentsizeSVG } from '@cutting/svg';\n\nexport function App(): JSX.Element {\n const ref = useRef<HTMLDivElement>(null);\n\n return (\n <div className={styles.container} ref={ref}>\n <ParentsizeSVG ref={ref}>\n <rect\n x=\"20%\"\n y=\"20%\"\n width={'50%'}\n height={'50%'}\n rx=\"20\"\n style={{ fill: '#ff0000', stroke: '#000000', strokeWidth: '2px' }}\n />\n </ParentsizeSVG>\n </div>\n );\n};\n```"
68
+ }
@@ -1,4 +1,3 @@
1
- import type { FC } from 'react';
2
1
  import cx from 'classnames';
3
2
 
4
3
  type GroupOnlyProps = {
@@ -15,7 +14,7 @@ type GroupOnlyProps = {
15
14
 
16
15
  type GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;
17
16
 
18
- export const Group: FC<GroupProps> = ({
17
+ export function Group({
19
18
  y = 0,
20
19
  x = 0,
21
20
  transform,
@@ -23,7 +22,7 @@ export const Group: FC<GroupProps> = ({
23
22
  children,
24
23
  innerRef,
25
24
  ...restProps
26
- }: GroupProps): JSX.Element => {
25
+ }: GroupProps): JSX.Element {
27
26
  return (
28
27
  <g
29
28
  ref={innerRef}
@@ -34,4 +33,4 @@ export const Group: FC<GroupProps> = ({
34
33
  {children}
35
34
  </g>
36
35
  );
37
- };
36
+ }
@@ -1,6 +1,5 @@
1
- import type { FC } from 'react';
2
1
  import cx from 'classnames';
3
- import { AddSVGProps, Point } from '../../types/types';
2
+ import type { AddSVGProps, Point } from '../../types/types';
4
3
 
5
4
  export type LineProps = {
6
5
  className?: string;
@@ -12,14 +11,14 @@ export type LineProps = {
12
11
  to?: Point;
13
12
  };
14
13
 
15
- export const Line: FC<LineProps> = ({
14
+ export function Line({
16
15
  from = { x: 0, y: 0 },
17
16
  to = { x: 1, y: 1 },
18
17
  fill = 'transparent',
19
18
  className,
20
19
  innerRef,
21
20
  ...restProps
22
- }: AddSVGProps<LineProps, SVGLineElement>): JSX.Element => {
21
+ }: AddSVGProps<LineProps, SVGLineElement>): JSX.Element {
23
22
  const isRectilinear = from.x === to.x || from.y === to.y;
24
23
 
25
24
  return (
@@ -35,4 +34,4 @@ export const Line: FC<LineProps> = ({
35
34
  {...restProps}
36
35
  />
37
36
  );
38
- };
37
+ }
@@ -1,22 +1,22 @@
1
1
  import { describe, it, expect } from '@jest/globals';
2
- import type { FC } from 'react';
3
2
  import { render, screen } from '@testing-library/react';
4
3
  import { useParentSize } from '@cutting/use-get-parent-size';
5
4
  import { useRef } from 'react';
5
+ import type { ParentsizeSVGProps } from './ParentsizeSVG';
6
6
  import { ParentsizeSVG } from './ParentsizeSVG';
7
7
 
8
- const TestEr: FC = () => {
8
+ function TestEr(props: Partial<ParentsizeSVGProps>) {
9
9
  const ref = useRef<HTMLDivElement>(null);
10
10
  useParentSize(ref);
11
11
 
12
12
  return (
13
- <ParentsizeSVG elementRef={ref}>
13
+ <ParentsizeSVG {...props} elementRef={ref}>
14
14
  <rect x="20%" y="20%" width="200px" height="200px" rx="20" />
15
15
  </ParentsizeSVG>
16
16
  );
17
- };
17
+ }
18
18
 
19
- const wrap = () => render(<TestEr />);
19
+ const wrap = (props: Partial<ParentsizeSVGProps> = {}) => render(<TestEr {...props} />);
20
20
 
21
21
  describe('useParentSize', () => {
22
22
  it('should set the svg viewBox attribute', () => {
@@ -28,4 +28,20 @@ describe('useParentSize', () => {
28
28
 
29
29
  screen.getByTestId('cutting-svg-container');
30
30
  });
31
+
32
+ it('should render a transform attribute when not aligned', () => {
33
+ wrap();
34
+
35
+ const svg = document.querySelector('svg') as SVGElement;
36
+
37
+ expect(svg.querySelector('g') as SVGGElement).toHaveAttribute('transform', 'translate(0,0) scale(1)');
38
+ });
39
+
40
+ it('should render a transform attribute when aligned', () => {
41
+ wrap({ align: 'center' });
42
+
43
+ const svg = document.querySelector('svg') as SVGElement;
44
+
45
+ expect(svg.querySelector('g') as SVGGElement).toHaveAttribute('transform', 'translate(0.5,-19.5) scale(1)');
46
+ });
31
47
  });
@@ -1,11 +1,13 @@
1
- import { CSSProperties, PropsWithChildren, RefObject, useEffect } from 'react';
1
+ import type { CSSProperties, PropsWithChildren, RefObject } from 'react';
2
+ import { useEffect } from 'react';
2
3
  import type { UseParentSizeOptions } from '@cutting/use-get-parent-size';
3
4
  import { useParentSize } from '@cutting/use-get-parent-size';
4
- import { ResponsiveSVG, ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';
5
+ import type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';
6
+ import { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';
5
7
 
6
8
  type Align = 'none' | 'center';
7
9
 
8
- export type ParentsizeSVGProps<E extends HTMLElement> = {
10
+ export type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {
9
11
  elementRef: RefObject<E>;
10
12
  style?: CSSProperties;
11
13
  align?: Align;
@@ -45,7 +47,9 @@ export function ParentsizeSVG<E extends HTMLElement>({
45
47
  }, [elementRef, style]);
46
48
 
47
49
  const transform =
48
- align === 'center' ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})` : `0,0) scale(${scale})`;
50
+ align === 'center'
51
+ ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`
52
+ : `translate(0,0) scale(${scale})`;
49
53
 
50
54
  return (
51
55
  <ResponsiveSVG width={width} height={height} {...rest}>
@@ -1,5 +1,4 @@
1
1
  import { describe, it, expect, jest } from '@jest/globals';
2
- import type { FC } from 'react';
3
2
  import { render, screen } from '@testing-library/react';
4
3
  import { useParentSize } from '@cutting/use-get-parent-size';
5
4
  import { useRef } from 'react';
@@ -18,7 +17,7 @@ const resize = (width: number, height: number): void => {
18
17
  });
19
18
  };
20
19
 
21
- const TestEr: FC = () => {
20
+ function TestEr(): JSX.Element {
22
21
  const ref = useRef<HTMLDivElement>(null);
23
22
  const { width, height } = useParentSize(ref);
24
23
 
@@ -29,7 +28,7 @@ const TestEr: FC = () => {
29
28
  </ResponsiveSVG>
30
29
  </div>
31
30
  );
32
- };
31
+ }
33
32
 
34
33
  const wrap = () => render(<TestEr />);
35
34
 
@@ -1,5 +1,5 @@
1
- import type { FC, Ref } from 'react';
2
- import { PreserveAspectRatio } from '../../types/types';
1
+ import type { ReactNode, Ref } from 'react';
2
+ import type { PreserveAspectRatio } from '../../types/types';
3
3
 
4
4
  export interface Point {
5
5
  x: number;
@@ -14,9 +14,10 @@ export interface ResponsiveSVGProps {
14
14
  innerRef?: Ref<SVGSVGElement>;
15
15
  className?: string;
16
16
  hide?: boolean;
17
+ children: ReactNode;
17
18
  }
18
19
 
19
- export const ResponsiveSVG: FC<ResponsiveSVGProps> = ({
20
+ export function ResponsiveSVG({
20
21
  height,
21
22
  width,
22
23
  children,
@@ -24,7 +25,7 @@ export const ResponsiveSVG: FC<ResponsiveSVGProps> = ({
24
25
  preserveAspectRatio = 'xMaxYMid meet',
25
26
  innerRef,
26
27
  className,
27
- }) => {
28
+ }: ResponsiveSVGProps): JSX.Element {
28
29
  const aspect = width / height;
29
30
 
30
31
  const adjustedHeight = Math.ceil(width / aspect);
@@ -49,4 +50,4 @@ export const ResponsiveSVG: FC<ResponsiveSVGProps> = ({
49
50
  </svg>
50
51
  </div>
51
52
  );
52
- };
53
+ }