@@ -56,6 +56,9 @@ export interface OdontogramProps {
5656 content ?: React . ReactNode | ( ( payload ?: ToothDetail ) => React . ReactNode ) ;
5757 } ;
5858 showTooltip ?: boolean ;
59+ showHalf ?: "upper" | "lower" | "full" ;
60+
61+
5962}
6063
6164export function convertFDIToNotation (
@@ -198,6 +201,7 @@ export const Odontogram: React.FC<OdontogramProps> = ({
198201 margin : 10 ,
199202 } ,
200203 showTooltip = true ,
204+ showHalf = 'full' ,
201205
202206} ) => {
203207 const themeColors =
@@ -260,12 +264,25 @@ export const Odontogram: React.FC<OdontogramProps> = ({
260264 [ handleToggle ] ,
261265 ) ;
262266
263- const quadrants = [
264- { name : "first" , transform : "" } ,
265- { name : "second" , transform : "scale(-1, 1) translate(-409, 0)" } ,
266- { name : "third" , transform : "scale(1, -1) translate(0, -694)" } ,
267- { name : "fourth" , transform : "scale(-1, -1) translate(-409, -694)" } ,
268- ] ;
267+ const quadrants : Array < {
268+ name : "first" | "second" | "third" | "fourth" ;
269+ transform : string ;
270+ label : string ;
271+ position : { x : number ; y : number } ;
272+ } > = [
273+ { name : "first" , transform : "" , label : "Upper Right" , position : { x : 100 , y : 30 } } ,
274+ { name : "second" , transform : "scale(-1, 1) translate(-409, 0)" , label : "Upper Left" , position : { x : 309 , y : 30 } } ,
275+ { name : "third" , transform : "scale(1, -1) translate(0, -694)" , label : "Lower Right" , position : { x : 100 , y : 664 } } ,
276+ { name : "fourth" , transform : "scale(-1, -1) translate(-409, -694)" , label : "Lower Left" , position : { x : 309 , y : 664 } } ,
277+ ] ;
278+
279+ let visibleQuadrants = quadrants ;
280+ if ( showHalf === "upper" ) {
281+ visibleQuadrants = quadrants . slice ( 0 , 2 ) ;
282+ } else if ( showHalf === "lower" ) {
283+ visibleQuadrants = quadrants . slice ( 2 ) ;
284+ }
285+
269286
270287
271288 const handleHover = (
@@ -398,10 +415,9 @@ export const Odontogram: React.FC<OdontogramProps> = ({
398415 >
399416 < svg
400417 ref = { svgRef }
401-
402418 xmlns = "http://www.w3.org/2000/svg"
403419 fill = "none"
404- viewBox = " 0 0 409 694"
420+ viewBox = { showHalf === "full" ? " 0 0 409 694" : showHalf === 'upper' ? "0 0 409 347" : "0 200 409 694" }
405421 className = "Odontogram"
406422 style = { {
407423 width : "100%" ,
@@ -410,21 +426,13 @@ export const Odontogram: React.FC<OdontogramProps> = ({
410426 touchAction : "manipulation" ,
411427 } }
412428 >
413- < g name = "upper" >
414- { quadrants . slice ( 0 , 2 ) . map ( ( { name, transform } , index ) => (
415- < g key = { name } name = { name } transform = { transform } >
416- { renderTeeth ( `teeth-${ index + 1 } ` ) }
417- </ g >
418- ) ) }
419- </ g >
420-
421- < g name = "lower" >
422- { quadrants . slice ( 2 ) . map ( ( { name, transform } , index ) => (
423- < g key = { name } name = { name } transform = { transform } >
424- { renderTeeth ( `teeth-${ index + 3 } ` ) }
425- </ g >
426- ) ) }
427- </ g >
429+
430+ { visibleQuadrants . map ( ( { name, transform, label, position } , index ) => (
431+ < g key = { name } name = { name } transform = { transform } >
432+ { renderTeeth ( `teeth-${ index + 1 } ` ) }
433+
434+ </ g >
435+ ) ) }
428436 </ svg >
429437 { showTooltip && (
430438 < OdontogramTooltip
0 commit comments