feat: add Listbox component (#3)
* make jest monorepo aware
* add @testing-library/jest-dom for custom matchers
This way we can use expect(element).toHaveAttribute(key, value?)
* abstract keys enum
* change type to unknown, because we don't know the return value
* update use-id hook, make it suspense aware
Thanks Reach UI!
* hoist the disposables collection
* add accessbility assertions for listbox
Also made it consistent for the Menu component and simplified some of the assertions
* add use-computed hook
This allows us re-render when hooks change, but also return a value. So this is a combination of useEffect and a useState value.
* add Listbox component
* bump dependencies
* add listbox example
* add lint-staged
This way we will only lint the files that have been staged and ready to be committed instead of the whole codebase
* add missing prevent defaults
* improve tests to verify that we can actually update the value of the listbox
* scroll the active listbox item into view
* small optimization, only focus "Nothing" on pointer leave when we are the active item
We used to always go to "Nothing" on pointer leave. And while this code
doesn't get called often, it *gets* called if you are using your arrow
keys and the mouse pointer is still over the list.
* bump dependencies
Also moved the tailwind dependencies to the root
* fix typo
* drop the default Transition inside the Menu and Listbox components
* update examples to reflect drop of default Transition wrapper
* rename Listbox.{Items,Item} to Listbox.{Options,Option}
Also rename all instances of `item` to `option` in tests and comments
and what have you...
* fix typo
* drop disabled prop, use aria-disabled only
This commit is contained in:
+4
-18
@@ -1,23 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
ROOT_DIR="$(git rev-parse --show-toplevel)/"
|
||||
TARGET_DIR="$(pwd)"
|
||||
RELATIVE_TARGET_DIR="${TARGET_DIR/$ROOT_DIR/}"
|
||||
|
||||
# INFO: This script is always run from the root of the repository. If we execute this script from a
|
||||
# package then the filters (in this case a path to $RELATIVE_TARGET_DIR) will be applied.
|
||||
|
||||
pushd $ROOT_DIR > /dev/null
|
||||
|
||||
node="yarn node"
|
||||
tsdxArgs=()
|
||||
|
||||
# Add script name
|
||||
tsdxArgs+=("test")
|
||||
jestArgs=()
|
||||
|
||||
# Add default arguments
|
||||
tsdxArgs+=("--passWithNoTests" $RELATIVE_TARGET_DIR)
|
||||
jestArgs+=("--passWithNoTests")
|
||||
|
||||
# Add arguments based on environment variables
|
||||
if [ -n "$CI" ]; then
|
||||
@@ -26,9 +14,7 @@ if [ -n "$CI" ]; then
|
||||
fi
|
||||
|
||||
# Passthrough arguments and flags
|
||||
tsdxArgs+=($@)
|
||||
jestArgs+=($@)
|
||||
|
||||
# Execute
|
||||
$node "$(yarn bin tsdx)" "${tsdxArgs[@]}"
|
||||
|
||||
popd > /dev/null
|
||||
$node "$(yarn bin jest)" "${jestArgs[@]}"
|
||||
|
||||
Reference in New Issue
Block a user