inflector bump

This commit is contained in:
lingdocs 2022-04-03 19:37:47 +05:00
parent 474f77c351
commit 03c7a8ba02
3 changed files with 12 additions and 17 deletions

View File

@ -5,7 +5,7 @@
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
"@lingdocs/lingdocs-main": "^0.2.0",
"@lingdocs/pashto-inflector": "^1.6.7",
"@lingdocs/pashto-inflector": "^1.6.8",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",

View File

@ -92,8 +92,9 @@ function VerbPicker({ onChange, subject, changeSubject, verb, verbs }: {
}
onChange(makeVerbSelection(v, changeSubject, verb));
}
function onTenseSelect({ value }: { label: string | JSX.Element, value: VerbTense | PerfectTense }) {
if (verb) {
function onTenseSelect(o: { value: VerbTense | PerfectTense } | null) {
const value = o?.value ? o.value : undefined;
if (verb && value) {
if (isPerfectTense(value)) {
onChange({
...verb,
@ -174,6 +175,7 @@ function VerbPicker({ onChange, subject, changeSubject, verb, verbs }: {
onChange(verb.changeStatDyn(c));
}
}
const tOptions = (verb?.tenseCategory === "perfect") ? perfectTenseOptions : tenseOptions;
return <div style={{ maxWidth: "225px", minWidth: "175px" }}>
<div>Verb:</div>
<Select
@ -236,18 +238,11 @@ function VerbPicker({ onChange, subject, changeSubject, verb, verbs }: {
<div>Tense:</div>
<Select
isSearchable={false}
value={verb && verb.tense}
// @ts-ignore
// for some reason can't use tOptions with find here;
value={verb && ([...tenseOptions, ...perfectTenseOptions].find(o => o.value === verb.tense))}
onChange={onTenseSelect}
className="mb-2"
// @ts-ignore
options={verb?.tenseCategory === "perfect" ? perfectTenseOptions : tenseOptions}
placeholder={verb ? (() => {
const label = (verb.tenseCategory === "perfect")
? perfectTenseOptions.find(o => o.value === verb.tense)?.label
: tenseOptions.find(o => o.value === verb.tense)?.label;
return label || "Select Tense...";
})() : undefined}
options={tOptions}
{...zIndexProps}
/>
{verb && verb.changeStatDyn && <div className="text-center">

View File

@ -1684,10 +1684,10 @@
pbf "^3.2.1"
rambda "^6.7.0"
"@lingdocs/pashto-inflector@^1.6.7":
version "1.6.7"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.6.7.tgz#958d7cf8a27db44f960d0a76a9b8f04a9537b5a3"
integrity sha512-DnhSL2Uiphm+z2Y0eTVsYCtq73JG+eqf00Txo1fDx0928w7dRQuaaTquuiuk2W+HSR/HuGTTDi+yHjRTMDj13w==
"@lingdocs/pashto-inflector@^1.6.8":
version "1.6.8"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.6.8.tgz#adc94c84c49cc067e26fb3066fae2a13b9d25d03"
integrity sha512-BGzMP0URWm6fEGdUUX653oImSMEkn11S/3vxeQILrQDCUNjGpNPQlORF27OlzCs8+n9lDBMDQHVjfhBlAZFN4w==
dependencies:
classnames "^2.2.6"
pbf "^3.2.1"