Skip to content

Commit 18409fb

Browse files
committed
fix: added types support and bugs
1 parent 679ada1 commit 18409fb

18 files changed

Lines changed: 532 additions & 3510 deletions

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ yarn add react-odontogram
4949

5050
```tsx
5151
import { Odontogram } from "react-odontogram";
52+
import "react-odontogram/style.css";
5253

5354
export default function App() {
5455
const handleChange = (selectedTeeth) => {
@@ -129,12 +130,19 @@ Example JSON output:
129130

130131
## ⚙️ Props
131132

132-
| Prop | Type | Default | Description |
133-
| ----------------- | ------------------------------------------- | ------- | ------------------------------------------------------- |
134-
| `onChange` | `(selectedTeeth: ToothSelection[]) => void` || Triggered whenever the user selects or deselects teeth. |
135-
| `initialSelected` | `string[]` | `[]` | Array of tooth IDs to preselect. |
136-
| `readOnly` | `boolean` | `false` | Makes the odontogram non-interactive (view-only). |
137-
| `className` | `string` || Optional class for custom styling. |
133+
| Prop | Type | Default | Description |
134+
| --- | --- | --- | --- |
135+
| `defaultSelected` | `string[]` | `[]` | Tooth IDs selected on first render. |
136+
| `onChange` | `(selectedTeeth: ToothSelection[]) => void` || Called whenever selection changes. |
137+
| `name` | `string` | `"teeth"` | Name used for hidden form input. |
138+
| `className` | `string` | `""` | Additional class for wrapper customization. |
139+
| `theme` | `"light" \| "dark"` | `"light"` | Applies built-in light/dark palette. |
140+
| `colors` | `{ darkBlue?: string; baseBlue?: string; lightBlue?: string }` | `{}` | Override palette colors. |
141+
| `notation` | `"FDI" \| "Universal" \| "Palmer"` | `"FDI"` | Display notation in native tooth titles/tooltips. |
142+
| `tooltip` | `{ placement?: Placement; margin?: number; content?: ReactNode \| ((payload?: ToothSelection) => ReactNode) }` | `{ placement: "top", margin: 10 }` | Tooltip behavior and custom content renderer. |
143+
| `showTooltip` | `boolean` | `true` | Enables/disables tooltip rendering. |
144+
| `showHalf` | `"full" \| "upper" \| "lower"` | `"full"` | Render full chart or only upper/lower arches. |
145+
| `maxTeeth` | `number` | `8` | Number of teeth per quadrant (for baby/mixed dentition views). |
138146

139147
---
140148

@@ -144,14 +152,8 @@ Each tooth is internally defined in a structured format:
144152

145153
```ts
146154
{
147-
id: "teeth-21",
148-
name: "21",
155+
name: "1",
149156
type: "Central Incisor",
150-
notations: {
151-
fdi: "21",
152-
universal: "9",
153-
palmer: "1UL"
154-
},
155157
outlinePath: "...",
156158
shadowPath: "...",
157159
lineHighlightPath: "..."
@@ -190,5 +192,3 @@ MIT © [biomathcode](https://github.com/biomathcode)
190192
## 💬 Feedback
191193

192194
If this library helps your dental project, please ⭐ the repo or open issues/PRs for enhancements!
193-
194-

lefthook.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ pre-commit:
44
lint:
55
run: git add -u
66
typecheck:
7-
run: pnpm tsc
7+
run: npx pnpm tsc
88
build:
9-
run: pnpm build
9+
run: npx pnpm build
1010
test:
11-
run: pnpm test:ci
11+
run: npx pnpm test:ci

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,17 @@
3535
"types": "./dist/index.d.ts",
3636
"exports": {
3737
".": {
38+
"types": "./dist/index.d.ts",
3839
"require": "./dist/index.js",
39-
"import": "./dist/index.mjs"
40-
}
40+
"import": "./dist/index.mjs",
41+
"default": "./dist/index.mjs"
42+
},
43+
"./style.css": "./dist/index.css"
4144
},
45+
"sideEffects": [
46+
"*.css",
47+
"**/*.css"
48+
],
4249
"files": [
4350
"dist"
4451
],

0 commit comments

Comments
 (0)