Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Use Downshift instead of react-select

Uku Taht8e2601d76fcf
diff --git a/assets/css/react-select.css b/assets/css/react-select.css
deleted file mode 100644
index 27a598d61a..0000000000
--- a/assets/css/react-select.css
+++ /dev/null
@@ -1,97 +0,0 @@
-.filter-list-text:hover ~ .filter-list-edit {
- display: flex;
-}
-
-.filter-list-text:hover ~ .filter-list-remove {
- display: none;
-}
-
-.filter-select__control:focus-within {
- box-shadow: rgb(255, 255, 255) 0px 0px 0px 0px, rgb(99, 102, 241) 0px 0px 0px 1px, rgba(0, 0, 0, 0) 0px 0px 0px 0px; /* indigo-500 */
-}
-
-.filter-select__value-container {
- padding-left: 1rem !important;
-}
-
-.filter-select__control {
- @apply dark:bg-gray-900 border-gray-300 dark:border-gray-700 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 pr-8;
- border-radius: 0.375rem !important;
- background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
- background-position: right 0.5rem center;
- background-repeat: no-repeat;
- background-size: 1.35rem 1.35rem;
-}
-
-.filter-select__control:hover {
- @apply cursor-pointer;
- border-color: rgb(156, 163, 175) !important; /* gray-400 */
-}
-
-.filter-select__indicator-separator {
- @apply hidden;
-}
-
-.filter-select__dropdown-indicator {
- display: none !important;
-}
-
-.filter-select__input {
- @apply w-full text-base sm:text-sm;
- margin: 0 !important;
-}
-
-.filter-select__input input {
- width: 100% !important;
- box-shadow: none !important;
-}
-
-.dark .filter-select__input input {
- color: rgb(209, 213, 219) !important; /* gray-300 */
-}
-
-.filter-select__value-container > :not(.filter-select__single-value) {
- @apply w-full;
- padding-top: 0 !important;
-}
-
-.filter-select__loading-indicator {
- color: rgb(79, 70, 229) !important; /* indigo-600 */
-}
-
-.filter-select__loading-indicator > span {
- height: 1.5em;
- width: 1.5em;
-}
-
-.filter-select__single-value {
- @apply dark:text-gray-400 text-base sm:text-sm;
-}
-
-.filter-select__menu-list {
- @apply dark:bg-gray-900;
-}
-
-.filter-select__option {
- @apply dark:text-gray-300;
- font-size: 1rem !important;
- line-height: 1.5rem !important;
- cursor: pointer !important;
-}
-
-@media (min-width: 640px) {
- .filter-select__option {
- font-size: 0.875rem !important;
- line-height: 1.25rem !important;
- }
-}
-
-.filter-select__option--is-focused {
- background-color: rgb(99, 102, 241) !important; /* indigo-500 */
- color: white !important;
-}
-
-.dark .filter-select__option--is-focused {
- background-color: rgb(79, 70, 229) !important; /* indigo-600 */
-}
-
diff --git a/assets/js/app.js b/assets/js/app.js
index 81e2debee7..9a2ea9ac16 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -1,5 +1,4 @@
import "../css/app.css"
-import "../css/react-select.css"
import "flatpickr/dist/flatpickr.min.css"
import "./polyfills/closest"
import 'abortcontroller-polyfill/dist/polyfill-patch-fetch'
diff --git a/assets/js/dashboard/components/search-select.js b/assets/js/dashboard/components/search-select.js
new file mode 100644
index 0000000000..5dcc6f6bbb
--- /dev/null
+++ b/assets/js/dashboard/components/search-select.js
@@ -0,0 +1,115 @@
+import React, {useState, useCallback} from 'react'
+import {useCombobox} from 'downshift'
+import classNames from 'classnames'
+import debounce from 'debounce-promise'
+
+function selectInputText(e) {
+ e.target.select()
+}
+
+function ChevronDown() {
+ return (
+ <svg className="text-indigo-500 h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
+ <polyline points="6 9 12 15 18 9"></polyline>
+ </svg>
+ )
+}
+
+function Spinner() {
+ return (
+ <svg className="animate-spin h-4 w-4 text-indigo-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
+ <circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
+ <path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
+ </svg>
+ )
+}
+
+export default function SearchSelect(props) {
+ const [items, setItems] = useState([])
+ const [loading, setLoading] = useState(false)
+ const [initialLoadComplete, setInitialLoadComplete] = useState(false)
+
+ function fetchOptions({inputValue, isOpen}) {
+ setLoading(isOpen)
+
+ return props.fetchOptions(inputValue).then((loadedItems) => {
+ setLoading(false)
+ setItems(loadedItems)
+ })
+ }
+
+ const debouncedFetchOptions = useCallback(debounce(fetchOptions, 200), [])
+
+ const {
+ isOpen,
+ inputValue,
+ getToggleButtonProps,
+ getLabelProps,
+ getMenuProps,
+ getInputProps,
+ getComboboxProps,
+ highlightedIndex,
+ getItemProps,
+ selectItem,
+ closeMenu,
+ setInputValue
+ } = useCombobox({
+ items: items,
+ onInputValueChange: (changes) => {
+ debouncedFetchOptions(changes)
+ props.onInput(changes.inputValue)
+ },
+ initialSelectedItem: props.initialSelectedItem,
+ onIsOpenChange: ({inputValue}) => {
+ if (!initialLoadComplete) {
+ fetchOptions({inputValue: inputValue, isOpen: true}).then(() => {
+ setInitialLoadComplete(true)
+ })
+ }
+ }
+ })
+
+ function keydown(e) {
+ if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.isComposing || e.keyCode === 229) return
+
+ if (e.key == 'Enter' && isOpen && highlightedIndex === -1) {
+ closeMenu()
+ e.preventDefault()
+ }
+ }
+
+ return (
+ <div className="mt-1 relative">
+ <div className="relative rounded-md shadow-sm" {...getToggleButtonProps()} {...getComboboxProps()}>
+ <input {...getInputProps({onKeyDown: keydown})} onFocus={selectInputText} placeholder="Enter a filter value" type="text" className={classNames('focus:ring-indigo-500 focus:border-indigo-500 block w-full pr-10 sm:text-sm border-gray-300 rounded-md', {'cursor-pointer': inputValue === '' && !isOpen})} />
+ <div className="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
+ { !loading && <ChevronDown /> }
+ { loading && <Spinner /> }
+ </div>
+ </div>
+ <div {...getMenuProps()}>
+ { isOpen &&
+ <ul className="absolute z-10 mt-1 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm">
+ { !loading && items.length == 0 &&
+ <li className="cursor-default select-none relative py-2 pl-3 pr-9">No results found</li>
+ }
+ { loading && items.length == 0 &&
+ <li className="cursor-default select-none relative py-2 pl-3 pr-9">Loading options...</li>
+ }
+
+ {
+ items.map((item, index) => (
+ <li className={classNames("cursor-pointer select-none relative py-2 pl-3 pr-9", {'text-white bg-indigo-600': highlightedIndex === index, 'text-gray-900': highlightedIndex !== index})}
+ key={`${item}${index}`}
+ {...getItemProps({ item, index })}
+ >
+ {item}
+ </li>
+ ))
+ }
+ </ul>
+ }
+ </div>
+ </div>
+ )
+}
diff --git a/assets/js/dashboard/stats/modals/filter.js b/assets/js/dashboard/stats/modals/filter.js
index da362424cb..ea05cb29e1 100644
--- a/assets/js/dashboard/stats/modals/filter.js
+++ b/assets/js/dashboard/stats/modals/filter.js
@@ -2,8 +2,7 @@ import React from "react";
import { withRouter, Redirect } from 'react-router-dom'
import Datamap from 'datamaps'
-import AsyncSelect from 'react-select/async'
-import debounce from 'lodash.debounce'
+import SearchSelect from '../../components/search-select'
import Modal from './modal'
import { parseQuery, formattedFilters, navigateToQuery } from '../../query'
import Transition from "../../../transition";
@@ -14,44 +13,34 @@ class FilterModal extends React.Component {
super(props)
this.state = {
query: parseQuery(props.location.search, props.site),
- selectedFilter: "",
+ selectedFilter: this.props.match.params.field || 'page',
negated: false,
- updatedValue: "",
- inputValue: "",
- forceReloadSuggestions: 0,
- defaultOptions: []
+ filterValue: "",
}
this.editableGoals = Object.keys(this.state.query.filters).filter(filter => !['props'].includes(filter))
- this.renderSelector = this.renderSelector.bind(this)
- this.fetchSuggestions = this.fetchSuggestions.bind(this)
this.handleKeydown = this.handleKeydown.bind(this)
this.handleSubmit = this.handleSubmit.bind(this)
- this.fieldSelectRef = React.createRef()
- this.debouncedFetchSuggestions = debounce((q, callback) => this.fetchSuggestions(q, callback), 150)
}
componentDidMount() {
- this.setState({ selectedFilter: this.props.match.params.field })
- this.fieldSelectRef.current.focus()
document.addEventListener("keydown", this.handleKeydown)
}
componentDidUpdate(prevProps, prevState) {
- const { query, selectedFilter, updatedValue, forceReloadSuggestions } = this.state
+ const { query, selectedFilter, filterValue } = this.state
if (prevState.selectedFilter !== selectedFilter) {
const negated = !!query.filters[selectedFilter] && query.filters[selectedFilter][0] == '!' && this.negationSupported(selectedFilter)
- let updatedValue = negated ? query.filters[selectedFilter].slice(1) : (query.filters[selectedFilter] || "")
+ let filterValue = negated ? query.filters[selectedFilter].slice(1) : (query.filters[selectedFilter] || "")
if (selectedFilter == 'country') {
const allCountries = Datamap.prototype.worldTopo.objects.world.geometries;
- const selectedCountry = allCountries.find((c) => c.id === updatedValue) || { properties: { name: updatedValue } };
- updatedValue = selectedCountry.properties.name
+ const selectedCountry = allCountries.find((c) => c.id === filterValue) || { properties: { name: filterValue } };
+ filterValue = selectedCountry.properties.name
}
- if (selectedFilter) this.fetchSuggestions('', (defaultOptions) => this.setState({ defaultOptions }))
- this.setState({ updatedValue, inputValue: updatedValue, negated, forceReloadSuggestions: forceReloadSuggestions + 1 })
+ this.setState({ filterValue, negated })
}
}
@@ -71,73 +60,43 @@ class FilterModal extends React.Component {
return ['page', 'entry_page', 'exit_page'].includes(filter)
}
- fetchSuggestions(searchQuery = "", callback) {
- const { query, selectedFilter } = this.state
+ fetchOptions(input) {
+ const {query, selectedFilter} = this.state
const updatedQuery = { ...query, filters: { ...query.filters, [selectedFilter]: null } }
- if (selectedFilter == 'country') {
- const matchedCountries = Datamap.prototype.worldTopo.objects.world.geometries.filter(c => c.properties.name.includes(searchQuery.trim()))
+ if (selectedFilter === 'country') {
+ const matchedCountries = Datamap.prototype.worldTopo.objects.world.geometries.filter(c => c.properties.name.includes(input.trim()))
const matches = matchedCountries.map(c => c.id)
- api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/suggestions/country`, updatedQuery, { q: matches })
+ return api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/suggestions/country`, updatedQuery, { q: matches })
.then((res) => {
- const result = res.map(code => matchedCountries.filter(c => c.id == code)[0].properties.name).map(r => ({ label: r, value: r }))
- callback(result)
+ return res.map(code => matchedCountries.filter(c => c.id == code)[0].properties.name)
})
} else {
- api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/suggestions/${selectedFilter}`, updatedQuery, { q: searchQuery.trim() })
- .then((res) => {
- const result = res.map(r => ({ label: r, value: r }))
- callback(result)
- })
+ return api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/suggestions/${selectedFilter}`, updatedQuery, { q: input.trim() })
}
}
- renderSelector(filter) {
- const { updatedValue, selectedFilter, inputValue, forceReloadSuggestions, defaultOptions } = this.state;
-
- if (!filter) return null
+ onInput(val) {
+ this.setState({filterValue: val})
+ }
+ renderSearchSelector(filter) {
return (
- <AsyncSelect
- key={`select-${selectedFilter}-${forceReloadSuggestions}`}
- defaultOptions={inputValue == "" ? defaultOptions : true}
- cacheOptions
- loadOptions={(q, callback) => this.debouncedFetchSuggestions(q, callback)}
- placeholder='Filter value'
- maxMenuHeight={250}
- tabSelectsValue={false}
- classNamePrefix='filter-select'
- blurInputOnSelect
- noOptionsMessage={() => (
- <span className="text-red-500 text-md flex mt-2 px-3">
- <svg className="w-10 h-10 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
- <span className="">No results found in current dashboard, try removing some filters, checking your input and ensuring this {formattedFilters[selectedFilter].toLowerCase()} exists</span>
- </span>
- )}
- loadingMessage={() => (
- <span>
- Loading filter suggestions
- </span>
- )}
- value={inputValue == '' ? { label: 'Enter a filter value', value: '' } : { label: updatedValue, value: `${updatedValue } ` }}
- onChange={({ value }, a) => {
- this.setState({ updatedValue: value, inputValue: value, forceReloadSuggestions: forceReloadSuggestions + 1 })
- }}
- onInputChange={(value, { action }) => {
- if (action == 'input-change') this.setState({ inputValue: value })
- if (action == 'menu-close' || action == 'input-blur') this.setState(({inputValue}) => ({ updatedValue: inputValue }))
- }}
- inputValue={inputValue}
- onBlur={() => this.setState({ forceReloadSuggestions: forceReloadSuggestions + 1 })}
- />)
+ <SearchSelect
+ key={this.state.selectedFilter}
+ fetchOptions={this.fetchOptions.bind(this)}
+ initialSelectedItem={this.state.query.filters[this.state.selectedFilter]}
+ onInput={this.onInput.bind(this)}
+ />
+ )
}
handleSubmit() {
- const { selectedFilter, negated, updatedValue } = this.state;
- const validFilter = this.editableGoals.includes(selectedFilter) && updatedValue.trim()
+ const { selectedFilter, negated, filterValue } = this.state;
+ const validFilter = this.editableGoals.includes(selectedFilter) && filterValue.trim()
- let finalFilterValue = (this.negationSupported(selectedFilter) && negated ? '!' : '') + updatedValue.trim()
+ let finalFilterValue = (this.negationSupported(selectedFilter) && negated ? '!' : '') + filterValue.trim()
if (selectedFilter == 'country') {
const allCountries = Datamap.prototype.worldTopo.objects.world.geometries;
const selectedCountry = allCountries.find((c) => c.properties.name === finalFilterValue) || { id: finalFilterValue };
@@ -152,8 +111,8 @@ class FilterModal extends React.Component {
}
renderBody() {
- const { selectedFilter, negated, updatedValue, query } = this.state;
- const validFilter = this.editableGoals.includes(selectedFilter) && updatedValue.trim()
+ const { selectedFilter, negated, filterValue, query } = this.state;
+ const validFilter = this.editableGoals.includes(selectedFilter) && filterValue.trim()
return (
<>
@@ -167,7 +126,6 @@ class FilterModal extends React.Component {
className="my-2 block w-full py-2 pl-3 pr-10 text-base border-gray-300 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-200 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md dark:bg-gray-900 dark:text-gray-300 cursor-pointer"
placeholder="Select a Filter"
onChange={(e) => this.setState({ selectedFilter: e.target.value })}
- ref={this.fieldSelectRef}
>
<option disabled value="" className="hidden">Select a Filter</option>
{this.editableGoals.map(filter => <option key={filter} value={filter}>{formattedFilters[filter]}</option>)}
@@ -188,7 +146,7 @@ class FilterModal extends React.Component {
</div>
)}
- {this.renderSelector(selectedFilter)}
+ {this.renderSearchSelector(selectedFilter)}
<button
type="submit"
diff --git a/assets/package-lock.json b/assets/package-lock.json
index ecbb20a278..6c2970a044 100644
--- a/assets/package-lock.json
+++ b/assets/package-lock.json
@@ -17,12 +17,14 @@
"autoprefixer": "^10.2.6",
"babel-loader": "^8.2.2",
"chart.js": "^3.3.2",
+ "classnames": "^2.3.1",
"copy-webpack-plugin": "^9.0.0",
"css-loader": "^5.2.6",
"css-minimizer-webpack-plugin": "^3.0.1",
"datamaps": "^0.5.9",
+ "debounce-promise": "^3.1.2",
+ "downshift": "^6.1.3",
"iframe-resizer": "^4.3.2",
- "lodash.debounce": "^4.0.8",
"mini-css-extract-plugin": "^1.6.0",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
@@ -33,7 +35,6 @@
"react-flatpickr": "3.10.5",
"react-flip-move": "^3.0.4",
"react-router-dom": "^5.2.0",
- "react-select": "^4.3.1",
"react-transition-group": "^4.4.2",
"tailwindcss": "^2.1.2",
"terser-webpack-plugin": "^5.1.2",
@@ -1516,86 +1517,6 @@
"node": ">=10.0.0"
}
},
- "node_modules/@emotion/cache": {
- "version": "11.4.0",
- "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.4.0.tgz",
- "integrity": "sha512-Zx70bjE7LErRO9OaZrhf22Qye1y4F7iDl+ITjet0J+i+B88PrAOBkKvaAWhxsZf72tDLajwCgfCjJ2dvH77C3g==",
- "dependencies": {
- "@emotion/memoize": "^0.7.4",
- "@emotion/sheet": "^1.0.0",
- "@emotion/utils": "^1.0.0",
- "@emotion/weak-memoize": "^0.2.5",
- "stylis": "^4.0.3"
- }
- },
- "node_modules/@emotion/hash": {
- "version": "0.8.0",
- "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz",
- "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow=="
- },
- "node_modules/@emotion/memoize": {
- "version": "0.7.5",
- "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.5.tgz",
- "integrity": "sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ=="
- },
- "node_modules/@emotion/react": {
- "version": "11.4.0",
- "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.4.0.tgz",
- "integrity": "sha512-4XklWsl9BdtatLoJpSjusXhpKv9YVteYKh9hPKP1Sxl+mswEFoUe0WtmtWjxEjkA51DQ2QRMCNOvKcSlCQ7ivg==",
- "dependencies": {
- "@babel/runtime": "^7.13.10",
- "@emotion/cache": "^11.4.0",
- "@emotion/serialize": "^1.0.2",
- "@emotion/sheet": "^1.0.1",
- "@emotion/utils": "^1.0.0",
- "@emotion/weak-memoize": "^0.2.5",
- "hoist-non-react-statics": "^3.3.1"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0",
- "react": ">=16.8.0"
- },
- "peerDependenciesMeta": {
- "@babel/core": {
- "optional": true
- },
- "@types/react": {
- "optional": true
- }
- }
- },
- "node_modules/@emotion/serialize": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.2.tgz",
- "integrity": "sha512-95MgNJ9+/ajxU7QIAruiOAdYNjxZX7G2mhgrtDWswA21VviYIRP1R5QilZ/bDY42xiKsaktP4egJb3QdYQZi1A==",
- "dependencies": {
- "@emotion/hash": "^0.8.0",
- "@emotion/memoize": "^0.7.4",
- "@emotion/unitless": "^0.7.5",
- "@emotion/utils": "^1.0.0",
- "csstype": "^3.0.2"
- }
- },
- "node_modules/@emotion/sheet": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.1.tgz",
- "integrity": "sha512-GbIvVMe4U+Zc+929N1V7nW6YYJtidj31lidSmdYcWozwoBIObXBnaJkKNDjZrLm9Nc0BR+ZyHNaRZxqNZbof5g=="
- },
- "node_modules/@emotion/unitless": {
- "version": "0.7.5",
- "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz",
- "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg=="
- },
- "node_modules/@emotion/utils": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz",
- "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA=="
- },
- "node_modules/@emotion/weak-memoize": {
- "version": "0.2.5",
- "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz",
- "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA=="
- },
"node_modules/@eslint/eslintrc": {
"version": "0.2.2",
"dev": true,
@@ -2678,6 +2599,11 @@
"node": ">=6.0"
}
},
+ "node_modules/classnames": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz",
+ "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA=="
+ },
"node_modules/clone-deep": {
"version": "4.0.1",
"license": "MIT",
@@ -2748,6 +2674,11 @@
"version": "1.0.1",
"license": "MIT"
},
+ "node_modules/compute-scroll-into-view": {
+ "version": "1.0.17",
+ "resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-1.0.17.tgz",
+ "integrity": "sha512-j4dx+Fb0URmzbwwMUrhqWM2BEWHdFGx+qZ9qqASHRPqvTYdqvWnHg0H1hIbcyLnvgnoNAVMlwkepyqM3DaIFUg=="
+ },
"node_modules/concat-map": {
"version": "0.0.1",
"license": "MIT"
@@ -3270,6 +3201,11 @@
"topojson": "^1.6.19"
}
},
+ "node_modules/debounce-promise": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/debounce-promise/-/debounce-promise-3.1.2.tgz",
+ "integrity": "sha512-rZHcgBkbYavBeD9ej6sP56XfG53d51CD4dnaw989YX/nZ/ZJfgRx/9ePKmTNiUiyQvh4mtrMoS3OAWW+yoYtpg=="
+ },
"node_modules/debug": {
"version": "4.3.1",
"license": "MIT",
@@ -3419,6 +3355,25 @@
"domelementtype": "1"
}
},
+ "node_modules/downshift": {
+ "version": "6.1.3",
+ "resolved": "https://registry.npmjs.org/downshift/-/downshift-6.1.3.tgz",
+ "integrity": "sha512-RA1MuaNcTbt0j+sVLhSs8R2oZbBXYAtdQP/V+uHhT3DoDteZzJPjlC+LQVm9T07Wpvo84QXaZtUCePLDTDwGXg==",
+ "dependencies": {
+ "@babel/runtime": "^7.13.10",
+ "compute-scroll-into-view": "^1.0.17",
+ "prop-types": "^15.7.2",
+ "react-is": "^17.0.2"
+ },
+ "peerDependencies": {
+ "react": ">=16.12.0"
+ }
+ },
+ "node_modules/downshift/node_modules/react-is": {
+ "version": "17.0.2",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
+ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
+ },
"node_modules/duplexer": {
"version": "0.1.2",
"dev": true,
@@ -5693,11 +5648,6 @@
"version": "2.0.14",
"license": "CC0-1.0"
},
- "node_modules/memoize-one": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz",
- "integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q=="
- },
"node_modules/meow": {
"version": "8.0.0",
"dev": true,
@@ -7500,17 +7450,6 @@
"react-dom": ">=16.3.x"
}
},
- "node_modules/react-input-autosize": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-3.0.0.tgz",
- "integrity": "sha512-nL9uS7jEs/zu8sqwFE5MAPx6pPkNAriACQ2rGLlqmKr2sPGtN7TXTyDdQt4lbNXVx7Uzadb40x8qotIuru6Rhg==",
- "dependencies": {
- "prop-types": "^15.5.8"
- },
- "peerDependencies": {
- "react": "^16.3.0 || ^17.0.0"
- }
- },
"node_modules/react-is": {
"version": "16.11.0",
"license": "MIT"
@@ -7550,24 +7489,6 @@
"react": ">=15"
}
},
- "node_modules/react-select": {
- "version": "4.3.1",
- "resolved": "https://registry.npmjs.org/react-select/-/react-select-4.3.1.tgz",
- "integrity": "sha512-HBBd0dYwkF5aZk1zP81Wx5UsLIIT2lSvAY2JiJo199LjoLHoivjn9//KsmvQMEFGNhe58xyuOITjfxKCcGc62Q==",
- "dependencies": {
- "@babel/runtime": "^7.12.0",
- "@emotion/cache": "^11.4.0",
- "@emotion/react": "^11.1.1",
- "memoize-one": "^5.0.0",
- "prop-types": "^15.6.0",
- "react-input-autosize": "^3.0.0",
- "react-transition-group": "^4.3.0"
- },
- "peerDependencies": {
- "react": "^16.8.0 || ^17.0.0",
- "react-dom": "^16.8.0 || ^17.0.0"
- }
- },
"node_modules/react-transition-group": {
"version": "4.4.2",
"license": "BSD-3-Clause",
@@ -8818,11 +8739,6 @@
"node": ">=10.0.0"
}
},
- "node_modules/stylis": {
- "version": "4.0.10",
- "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz",
- "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg=="
- },
"node_modules/sugarss": {
"version": "2.0.0",
"dev": true,
@@ -10722,74 +10638,6 @@
"@discoveryjs/json-ext": {
"version": "0.5.3"
},
- "@emotion/cache": {
- "version": "11.4.0",
- "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.4.0.tgz",
- "integrity": "sha512-Zx70bjE7LErRO9OaZrhf22Qye1y4F7iDl+ITjet0J+i+B88PrAOBkKvaAWhxsZf72tDLajwCgfCjJ2dvH77C3g==",
- "requires": {
- "@emotion/memoize": "^0.7.4",
- "@emotion/sheet": "^1.0.0",
- "@emotion/utils": "^1.0.0",
- "@emotion/weak-memoize": "^0.2.5",
- "stylis": "^4.0.3"
- }
- },
- "@emotion/hash": {
- "version": "0.8.0",
- "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz",
- "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow=="
- },
- "@emotion/memoize": {
- "version": "0.7.5",
- "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.5.tgz",
- "integrity": "sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ=="
- },
- "@emotion/react": {
- "version": "11.4.0",
- "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.4.0.tgz",
- "integrity": "sha512-4XklWsl9BdtatLoJpSjusXhpKv9YVteYKh9hPKP1Sxl+mswEFoUe0WtmtWjxEjkA51DQ2QRMCNOvKcSlCQ7ivg==",
- "requires": {
- "@babel/runtime": "^7.13.10",
- "@emotion/cache": "^11.4.0",
- "@emotion/serialize": "^1.0.2",
- "@emotion/sheet": "^1.0.1",
- "@emotion/utils": "^1.0.0",
- "@emotion/weak-memoize": "^0.2.5",
- "hoist-non-react-statics": "^3.3.1"
- }
- },
- "@emotion/serialize": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.2.tgz",
- "integrity": "sha512-95MgNJ9+/ajxU7QIAruiOAdYNjxZX7G2mhgrtDWswA21VviYIRP1R5QilZ/bDY42xiKsaktP4egJb3QdYQZi1A==",
- "requires": {
- "@emotion/hash": "^0.8.0",
- "@emotion/memoize": "^0.7.4",
- "@emotion/unitless": "^0.7.5",
- "@emotion/utils": "^1.0.0",
- "csstype": "^3.0.2"
- }
- },
- "@emotion/sheet": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.1.tgz",
- "integrity": "sha512-GbIvVMe4U+Zc+929N1V7nW6YYJtidj31lidSmdYcWozwoBIObXBnaJkKNDjZrLm9Nc0BR+ZyHNaRZxqNZbof5g=="
- },
- "@emotion/unitless": {
- "version": "0.7.5",
- "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz",
- "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg=="
- },
- "@emotion/utils": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz",
- "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA=="
- },
- "@emotion/weak-memoize": {
- "version": "0.2.5",
- "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz",
- "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA=="
- },
"@eslint/eslintrc": {
"version": "0.2.2",
"dev": true,
@@ -11497,6 +11345,11 @@
"tslib": "^1.9.0"
}
},
+ "classnames": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz",
+ "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA=="
+ },
"clone-deep": {
"version": "4.0.1",
"requires": {
@@ -11549,6 +11402,11 @@
"commondir": {
"version": "1.0.1"
},
+ "compute-scroll-into-view": {
+ "version": "1.0.17",
+ "resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-1.0.17.tgz",
+ "integrity": "sha512-j4dx+Fb0URmzbwwMUrhqWM2BEWHdFGx+qZ9qqASHRPqvTYdqvWnHg0H1hIbcyLnvgnoNAVMlwkepyqM3DaIFUg=="
+ },
"concat-map": {
"version": "0.0.1"
},
@@ -11865,6 +11723,11 @@
"topojson": "^1.6.19"
}
},
+ "debounce-promise": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/debounce-promise/-/debounce-promise-3.1.2.tgz",
+ "integrity": "sha512-rZHcgBkbYavBeD9ej6sP56XfG53d51CD4dnaw989YX/nZ/ZJfgRx/9ePKmTNiUiyQvh4mtrMoS3OAWW+yoYtpg=="
+ },
"debug": {
"version": "4.3.1",
"requires": {
@@ -11968,6 +11831,24 @@
"domelementtype": "1"
}
},
+ "downshift": {
+ "version": "6.1.3",
+ "resolved": "https://registry.npmjs.org/downshift/-/downshift-6.1.3.tgz",
+ "integrity": "sha512-RA1MuaNcTbt0j+sVLhSs8R2oZbBXYAtdQP/V+uHhT3DoDteZzJPjlC+LQVm9T07Wpvo84QXaZtUCePLDTDwGXg==",
+ "requires": {
+ "@babel/runtime": "^7.13.10",
+ "compute-scroll-into-view": "^1.0.17",
+ "prop-types": "^15.7.2",
+ "react-is": "^17.0.2"
+ },
+ "dependencies": {
+ "react-is": {
+ "version": "17.0.2",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
+ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
+ }
+ }
+ },
"duplexer": {
"version": "0.1.2",
"dev": true
@@ -13375,11 +13256,6 @@
"mdn-data": {
"version": "2.0.14"
},
- "memoize-one": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz",
- "integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q=="
- },
"meow": {
"version": "8.0.0",
"dev": true,
@@ -14494,14 +14370,6 @@
"version": "3.0.4",
"requires": {}
},
- "react-input-autosize": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-3.0.0.tgz",
- "integrity": "sha512-nL9uS7jEs/zu8sqwFE5MAPx6pPkNAriACQ2rGLlqmKr2sPGtN7TXTyDdQt4lbNXVx7Uzadb40x8qotIuru6Rhg==",
- "requires": {
- "prop-types": "^15.5.8"
- }
- },
"react-is": {
"version": "16.11.0"
},
@@ -14532,20 +14400,6 @@
"tiny-warning": "^1.0.0"
}
},
- "react-select": {
- "version": "4.3.1",
- "resolved": "https://registry.npmjs.org/react-select/-/react-select-4.3.1.tgz",
- "integrity": "sha512-HBBd0dYwkF5aZk1zP81Wx5UsLIIT2lSvAY2JiJo199LjoLHoivjn9//KsmvQMEFGNhe58xyuOITjfxKCcGc62Q==",
- "requires": {
- "@babel/runtime": "^7.12.0",
- "@emotion/cache": "^11.4.0",
- "@emotion/react": "^11.1.1",
- "memoize-one": "^5.0.0",
- "prop-types": "^15.6.0",
- "react-input-autosize": "^3.0.0",
- "react-transition-group": "^4.3.0"
- }
- },
"react-transition-group": {
"version": "4.4.2",
"requires": {
@@ -15376,11 +15230,6 @@
"stylelint-config-recommended": "^3.0.0"
}
},
- "stylis": {
- "version": "4.0.10",
- "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz",
- "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg=="
- },
"sugarss": {
"version": "2.0.0",
"dev": true,
diff --git a/assets/package.json b/assets/package.json
index 28fb50eeac..d1050df455 100644
--- a/assets/package.json
+++ b/assets/package.json
@@ -17,12 +17,14 @@
"autoprefixer": "^10.2.6",
"babel-loader": "^8.2.2",
"chart.js": "^3.3.2",
+ "classnames": "^2.3.1",
"copy-webpack-plugin": "^9.0.0",
"css-loader": "^5.2.6",
"css-minimizer-webpack-plugin": "^3.0.1",
"datamaps": "^0.5.9",
+ "debounce-promise": "^3.1.2",
+ "downshift": "^6.1.3",
"iframe-resizer": "^4.3.2",
- "lodash.debounce": "^4.0.8",
"mini-css-extract-plugin": "^1.6.0",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
@@ -33,7 +35,6 @@
"react-flatpickr": "3.10.5",
"react-flip-move": "^3.0.4",
"react-router-dom": "^5.2.0",
- "react-select": "^4.3.1",
"react-transition-group": "^4.4.2",
"tailwindcss": "^2.1.2",
"terser-webpack-plugin": "^5.1.2",