From 48397070e5146e206ceb4ff5df620aa5ac0fe8ce Mon Sep 17 00:00:00 2001 From: Amit Dhamu Date: Sat, 7 Jan 2023 20:06:44 +0000 Subject: [PATCH] Update deps --- .eslintignore | 1 + .eslintrc.json | 15 +- .nvmrc | 2 +- .stylelintrc.json | 2 +- LICENCE | 2 +- esbuild.config.js | 4 +- package.json | 42 +- react-shim.js | 4 - src/InputSuggestions.tsx | 12 +- src/__tests__/InputSuggestions.test.tsx | 6 +- src/__tests__/elementText.test.tsx | 20 +- src/elementText.tsx | 99 +- tsconfig.json | 2 +- yarn.lock | 4221 ++++++++++++----------- 14 files changed, 2311 insertions(+), 2121 deletions(-) delete mode 100644 react-shim.js diff --git a/.eslintignore b/.eslintignore index 061936f..18c24a2 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ node_modules dist .coverage +public/script.js diff --git a/.eslintrc.json b/.eslintrc.json index 99eefa1..bca563d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,16 +1,3 @@ { - "extends": ["./node_modules/@adhamu/zero/eslint/typescript-react"], - "overrides": [ - { - "files": ["./setupTests.ts"], - "rules": { - "import/no-extraneous-dependencies": [ - "error", - { - "devDependencies": true - } - ] - } - } - ] + "extends": ["./node_modules/@adhamu/zero/eslint"] } diff --git a/.nvmrc b/.nvmrc index 0cf077e..8ca05d3 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.14 +18.13 diff --git a/.stylelintrc.json b/.stylelintrc.json index 8936562..88a1337 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,5 +1,5 @@ { - "extends": ["./node_modules/@adhamu/zero/stylelint/css"], + "extends": ["./node_modules/@adhamu/zero/stylelint"], "overrides": [ { "files": ["**/*.{js,ts,jsx,tsx}"], diff --git a/LICENCE b/LICENCE index fd164b1..5bf6f25 100644 --- a/LICENCE +++ b/LICENCE @@ -1,4 +1,4 @@ -Copyright 2022 Amit Dhamu +Copyright 2023 Amit Dhamu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/esbuild.config.js b/esbuild.config.js index 5bf6150..a153c2c 100644 --- a/esbuild.config.js +++ b/esbuild.config.js @@ -1,5 +1,3 @@ -const path = require('path') - const { arge } = require('arge') const chokidar = require('chokidar') const esbuild = require('esbuild') @@ -11,7 +9,7 @@ const { build = false, dev = false, watch = false } = arge(process.argv) const common = { bundle: true, - inject: [path.join(__dirname, './react-shim.js')], + jsx: 'automatic', sourcemap: false, } diff --git a/package.json b/package.json index f7761f9..f404d96 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-input-suggestions", - "version": "2.2.0", + "version": "2.3.0", "description": "A React input component with pluggable suggestions and autocomplete", "keywords": [ "react", @@ -32,40 +32,40 @@ "deploy": "gh-pages -d public", "dev": "node esbuild.config.js dev --watch", "lint": "yarn lint:scripts && yarn lint:styles", - "lint:scripts": "eslint 'src/**/*.ts*' --ignore-path=.eslintignore --config=.eslintrc.json", + "lint:scripts": "eslint .", "lint:styles": "stylelint 'src/**/*.ts*'", "test": "jest --colors", "test:coverage": "yarn test --coverage", "type": "tsc --noEmit" }, "dependencies": { - "@emotion/react": "^11.8.2", - "@emotion/styled": "^11.8.1", - "react": "^18.1.0", - "react-dom": "^18.1.0", + "@emotion/react": "^11.10.5", + "@emotion/styled": "^11.10.5", + "react": "^18.2.0", + "react-dom": "^18.2.0", "react-string-replace": "^1.1.0" }, "devDependencies": { - "@adhamu/zero": "^4.3.1", - "@emotion/jest": "^11.8.0", + "@adhamu/zero": "^5.1.2", + "@emotion/jest": "^11.10.5", "@stylelint/postcss-css-in-js": "^0.38.0", - "@swc/core": "^1.2.186", - "@swc/jest": "^0.2.21", - "@testing-library/jest-dom": "^5.16.4", - "@testing-library/react": "^13.2.0", - "@testing-library/user-event": "^14.2.0", - "@types/jest": "^27.5.1", - "@types/react": "^18.0.9", - "@types/react-dom": "^18.0.4", - "arge": "^1.1.4", + "@swc/core": "^1.3.25", + "@swc/jest": "^0.2.24", + "@testing-library/jest-dom": "^5.16.5", + "@testing-library/react": "^13.4.0", + "@testing-library/user-event": "^14.4.3", + "@types/jest": "^29.2.5", + "@types/react": "^18.0.26", + "@types/react-dom": "^18.0.10", + "arge": "^1.2.0", "chokidar": "^3.5.3", - "esbuild": "^0.14.39", + "esbuild": "^0.16.15", "gh-pages": "^4.0.0", - "jest": "^28.1.0", - "jest-environment-jsdom": "^28.1.0", + "jest": "^29.3.1", + "jest-environment-jsdom": "^29.3.1", "live-server": "^1.2.2", "postcss-syntax": "^0.36.2", - "typescript": "^4.6.4" + "typescript": "^4.9.4" }, "peerDependencies": { "react": "^18.1.0", diff --git a/react-shim.js b/react-shim.js deleted file mode 100644 index 5f88fbd..0000000 --- a/react-shim.js +++ /dev/null @@ -1,4 +0,0 @@ -import * as React from 'react' - -// eslint-disable-next-line import/prefer-default-export -export { React } diff --git a/src/InputSuggestions.tsx b/src/InputSuggestions.tsx index 54f6539..662c218 100644 --- a/src/InputSuggestions.tsx +++ b/src/InputSuggestions.tsx @@ -1,10 +1,9 @@ import type { ReactNode } from 'react' import { useRef, useState } from 'react' -import type { Props } from './types' - -import { getElementText, wrapElementText } from './elementText' +import { elementText } from './elementText' import { Styled } from './styled' +import type { Props } from './types' import { useSuggestions } from './useSuggestions' const InputSuggestions = ({ @@ -34,7 +33,8 @@ const InputSuggestions = ({ const filterSuggestions = (e: { target: { value: string } }) => setResults( suggestions.filter(suggestion => - getElementText(suggestion) + elementText + .get(suggestion) ?.toLowerCase() .includes(e.target.value.toLowerCase() || '') ) @@ -64,12 +64,12 @@ const InputSuggestions = ({