@cutting/svg 4.52.2 → 4.53.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @cutting/svg@4.52.2 build /home/runner/work/cuttingedge/cuttingedge/packages/svg
2
+ > @cutting/svg@4.53.0 build /home/runner/work/cuttingedge/cuttingedge/packages/svg
3
3
  > NODE_ENV=production devtools rollup
4
4
 
5
5
  DEBUG using tsconfig.dist.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @cutting/svg
2
2
 
3
+ ## 4.53.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ce19c98e: more responsive fixes
8
+
9
+ ### Patch Changes
10
+
11
+ - @cutting/use-get-parent-size@1.26.1
12
+
3
13
  ## 4.52.2
4
14
 
5
15
  ### Patch Changes
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useParentSize as i}from"@cutting/use-get-parent-size";import t from"classnames";function r({height:i,width:t,children:r,origin:n={x:0,y:0},preserveAspectRatio:s="xMaxYMid meet",innerRef:a,className:o,...c}){const l=Math.ceil(t/(0===i?1:t/i));return e("div",{"data-testid":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e("svg",{style:{overflow:"visible"},className:o,preserveAspectRatio:s,viewBox:`${n.x} ${n.y} ${t} ${l}`,ref:a,...c,children:r})})}function n({parentRef:t,children:n,options:s,...a}){const{width:o,height:c}=i(t,s);return e(r,{width:o,height:c,...a,children:n})}function s({y:i=0,x:r=0,transform:n,className:s,children:a,innerRef:o,...c}){return e("g",{ref:o,className:t("visx-group",s),transform:n||`translate(${r}, ${i})`,...c,children:a})}function a({from:i={x:0,y:0},to:r={x:1,y:1},fill:n="transparent",className:s,innerRef:a,...o}){const c=i.x===r.x||i.y===r.y;return e("line",{ref:a,className:t("visx-line",s),x1:i.x,y1:i.y,x2:r.x,y2:r.y,fill:n,shapeRendering:c?"crispEdges":"auto",...o})}export{s as Group,a as Line,n as ParentsizeSVG,r as ResponsiveSVG};
1
+ import{jsx as e}from"react/jsx-runtime";import{useParentSize as t}from"@cutting/use-get-parent-size";import i from"classnames";function r({height:t,width:i,children:r,origin:n={x:0,y:0},preserveAspectRatio:s="xMaxYMid meet",innerRef:a,className:o,...c}){const l=Math.ceil(i/(0===t?1:i/t));return e("div",{"data-testid":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e("svg",{style:{overflow:"visible",width:"100%",height:"auto"},className:o,preserveAspectRatio:s,viewBox:`${n.x} ${n.y} ${i} ${l}`,ref:a,...c,children:r})})}function n({parentRef:i,children:n,options:s,...a}){const{width:o,height:c}=t(i,s);return e(r,{width:o,height:c,...a,children:n})}function s({y:t=0,x:r=0,transform:n,className:s,children:a,innerRef:o,...c}){return e("g",{ref:o,className:i("visx-group",s),transform:n||`translate(${r}, ${t})`,...c,children:a})}function a({from:t={x:0,y:0},to:r={x:1,y:1},fill:n="transparent",className:s,innerRef:a,...o}){const c=t.x===r.x||t.y===r.y;return e("line",{ref:a,className:i("visx-line",s),x1:t.x,y1:t.y,x2:r.x,y2:r.y,fill:n,shapeRendering:c?"crispEdges":"auto",...o})}export{s as Group,a as Line,n as ParentsizeSVG,r 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 { ReactNode, Ref } from 'react';\nimport type { PreserveAspectRatio, SVGAttributes } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport type ResponsiveSVGProps = SVGAttributes<{\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 ...props\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = height === 0 ? 1 : width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-testid=\"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 {...props}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { PropsWithChildren, RefObject } from 'react';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG.js';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n options,\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, options);\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n {children}\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","props","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","ref","ParentsizeSVG","parentRef","options","rest","useParentSize","Group","transform","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":"+HAmBgB,SAAAA,GAAcC,OAC5BA,EAAMC,MACNA,EAAKC,SACLA,EAAQC,OACRA,EAAS,CAAEC,EAAG,EAAGC,EAAG,GAAGC,oBACvBA,EAAsB,gBAAeC,SACrCA,EAAQC,UACRA,KACGC,IAEH,MAEMC,EAAiBC,KAAKC,KAAKX,GAFP,IAAXD,EAAe,EAAIC,EAAQD,IAI1C,OACEa,EAAA,MAAA,CAAA,cACc,wBACZC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVhB,OAAQ,OACTE,SAEDW,SACEC,MAAO,CAAEE,SAAU,WACnBR,UAAWA,EACXF,oBAAqBA,EACrBW,QAAS,GAAGd,EAAOC,KAAKD,EAAOE,KAAKJ,KAASS,IAC7CQ,IAAKX,KACDE,EAAKP,SAERA,KAIT,CCvCgB,SAAAiB,GAAqCC,UACnDA,EAASlB,SACTA,EAAQmB,QACRA,KACGC,IAEH,MAAMrB,MAAEA,EAAKD,OAAEA,GAAWuB,EAAcH,EAAWC,GAEnD,OACER,EAACd,EAAc,CAAAE,MAAOA,EAAOD,OAAQA,KAAYsB,WAC9CpB,GAGP,CCZM,SAAUsB,GAAMnB,EACpBA,EAAI,EAACD,EACLA,EAAI,EAACqB,UACLA,EAASjB,UACTA,EAASN,SACTA,EAAQK,SACRA,KACGmB,IAEH,OACEb,EAAA,IAAA,CACEK,IAAKX,EACLC,UAAWmB,EAAG,aAAcnB,GAC5BiB,UAAWA,GAAa,aAAarB,MAAMC,QACvCqB,EAASxB,SAEZA,GAGP,UCtBgB0B,GAAKC,KACnBA,EAAO,CAAEzB,EAAG,EAAGC,EAAG,GAAGyB,GACrBA,EAAK,CAAE1B,EAAG,EAAGC,EAAG,GAAG0B,KACnBA,EAAO,cAAavB,UACpBA,EAASD,SACTA,KACGmB,IAEH,MAAMM,EAAgBH,EAAKzB,IAAM0B,EAAG1B,GAAKyB,EAAKxB,IAAMyB,EAAGzB,EAEvD,OACEQ,EACE,OAAA,CAAAK,IAAKX,EACLC,UAAWmB,EAAG,YAAanB,GAC3ByB,GAAIJ,EAAKzB,EACT8B,GAAIL,EAAKxB,EACT8B,GAAIL,EAAG1B,EACPgC,GAAIN,EAAGzB,EACP0B,KAAMA,EACNM,eAAgBL,EAAgB,aAAe,UAC3CN,GAGV"}
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, SVGAttributes } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport type ResponsiveSVGProps = SVGAttributes<{\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 ...props\n}: ResponsiveSVGProps): JSX.Element {\n const aspect = height === 0 ? 1 : width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-testid=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible', width: '100%', height: 'auto' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n {...props}\n >\n {children}\n </svg>\n </div>\n );\n}\n","import type { PropsWithChildren, RefObject } from 'react';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG.js';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: RefObject<E>;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n parentRef,\n children,\n options,\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(parentRef, options);\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n {children}\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","props","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","ref","ParentsizeSVG","parentRef","options","rest","useParentSize","Group","transform","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":"+HAmBgB,SAAAA,GAAcC,OAC5BA,EAAMC,MACNA,EAAKC,SACLA,EAAQC,OACRA,E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zB,EACT8B,GAAIL,EAAKxB,EACT8B,GAAIL,EAAG1B,EACPgC,GAAIN,EAAGzB,EACP0B,KAAMA,EACNM,eAAgBL,EAAgB,aAAe,UAC3CN,GAGV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cutting/svg",
3
- "version": "4.52.2",
3
+ "version": "4.53.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dagda1/cuttingedge.git"
@@ -31,7 +31,7 @@
31
31
  "react": "18.2.0",
32
32
  "react-dom": "18.2.0",
33
33
  "typescript": "4.9.5",
34
- "@cutting/component-library": "5.36.3",
34
+ "@cutting/component-library": "5.37.0",
35
35
  "@cutting/devtools": "4.62.0",
36
36
  "@cutting/eslint-config": "4.43.1",
37
37
  "@cutting/tsconfig": "4.39.0",
@@ -41,7 +41,7 @@ export function ResponsiveSVG({
41
41
  }}
42
42
  >
43
43
  <svg
44
- style={{ overflow: 'visible' }}
44
+ style={{ overflow: 'visible', width: '100%', height: 'auto' }}
45
45
  className={className}
46
46
  preserveAspectRatio={preserveAspectRatio}
47
47
  viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}