This commit is contained in:
lingdocs 2021-11-03 17:57:13 -04:00
parent 9cfbfa3e09
commit 1e4d5b5618
4 changed files with 14 additions and 16 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "1.4.0", "version": "1.4.1",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",

View File

@ -263,9 +263,7 @@ function App() {
{ label: "irregular", value: "irregular" }, { label: "irregular", value: "irregular" },
]} ]}
value={regularIrregular} value={regularIrregular}
handleChange={(p) => { handleChange={setRegularIrregular}
setRegularIrregular(p as "regular" | "irregular");
}}
/> />
</div> </div>
} }
@ -313,7 +311,7 @@ function App() {
handleChange={(p) => { handleChange={(p) => {
setTextOptions({ setTextOptions({
...textOptions, ...textOptions,
spelling: p as T.Spelling, spelling: p,
}); });
}} }}
/> />
@ -334,7 +332,7 @@ function App() {
{ label: "X-Large", value: "largest" }, { label: "X-Large", value: "largest" },
]} ]}
value={textOptions.pTextSize} value={textOptions.pTextSize}
handleChange={(p) => setTextOptions({ ...textOptions, pTextSize: p as "normal" | "larger" | "largest" })} handleChange={(p) => setTextOptions({ ...textOptions, pTextSize: p })}
/> />
<h6 className="mt-3">Phonetics</h6> <h6 className="mt-3">Phonetics</h6>
<ButtonSelect <ButtonSelect
@ -345,7 +343,7 @@ function App() {
{ label: "None", value: "none" }, { label: "None", value: "none" },
]} ]}
value={textOptions.phonetics} value={textOptions.phonetics}
handleChange={(p) => setTextOptions({ ...textOptions, phonetics: p as "lingdocs" | "ipa" | "none" | "alalc" })} handleChange={(p) => setTextOptions({ ...textOptions, phonetics: p })}
/> />
</Modal.Body> </Modal.Body>
<Modal.Footer> <Modal.Footer>

View File

@ -8,15 +8,15 @@
import classNames from "classnames"; import classNames from "classnames";
type PickerProps = { type PickerProps<T extends string> = {
options: { label: any, value: string, color?: string }[], options: { label: any, value: T, color?: string }[],
value: string, value: T,
handleChange: (payload: string) => void, handleChange: (payload: T) => void,
small?: boolean, small?: boolean,
xSmall?: boolean, xSmall?: boolean,
} }
function ButtonSelect(props: PickerProps) { function ButtonSelect<L extends string>(props: PickerProps<L>) {
return ( return (
<div className="d-inline-flex flex-row justify-content-center"> <div className="d-inline-flex flex-row justify-content-center">
<div className="btn-group"> <div className="btn-group">

View File

@ -248,7 +248,7 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
}, },
]} ]}
value={state.transitivitySelected} value={state.transitivitySelected}
handleChange={(p) => dispatch({ type: "setTransitivitySelected", payload: p as "transitive" | "grammatically transitive" })} handleChange={(p) => dispatch({ type: "setTransitivitySelected", payload: p })}
/> />
</div> </div>
</div>} </div>}
@ -264,7 +264,7 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
}, },
]} ]}
value={state.compoundTypeSelected} value={state.compoundTypeSelected}
handleChange={(p) => dispatch({ type: "choose compound type", payload: p as "dynamic" | "stative" })} handleChange={(p) => dispatch({ type: "choose compound type", payload: p })}
/> />
</div> </div>
</div>} </div>}
@ -280,7 +280,7 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
{ label: `Plur. ${verbConj1.info.objComplement.plural.p}`, value: "plur" }, { label: `Plur. ${verbConj1.info.objComplement.plural.p}`, value: "plur" },
]} ]}
value={state.compoundComplementVersionSelected} value={state.compoundComplementVersionSelected}
handleChange={(p) => dispatch({ type: "set compound complement version", payload: p as "sing" | "plur" })} handleChange={(p) => dispatch({ type: "set compound complement version", payload: p })}
/> />
</div> </div>
</div>} </div>}
@ -301,7 +301,7 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
{ label: `Sentences`, value: "sentence" }, { label: `Sentences`, value: "sentence" },
]} ]}
value={state.mode} value={state.mode}
handleChange={(p) => dispatch({ type: "setMode", payload: p as "chart" | "sentence" })} handleChange={(p) => dispatch({ type: "setMode", payload: p })}
/> />
</div>} </div>}
{!limitTo && <> {!limitTo && <>