Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useControlledValue updates [LG-3608] #1953

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
753ba16
Extends `useControlledValue` to accept any type
TheSonOfThomp Aug 24, 2023
eec25b7
Merge branch 'main' into adam/generic-useControlledValue
TheSonOfThomp Aug 24, 2023
c565f26
Adds more explicit tests
TheSonOfThomp Aug 24, 2023
b612835
adds test component tests
TheSonOfThomp Aug 24, 2023
f4e1c61
adds value tests
TheSonOfThomp Aug 24, 2023
bbb1832
isControlled never changes from initial render
TheSonOfThomp Aug 24, 2023
af6cc48
adds synthetic events
TheSonOfThomp Aug 24, 2023
f6751e8
adds initialValue & warning
TheSonOfThomp Aug 24, 2023
4f37e4b
Merge branch 'main' into adam/generic-useControlledValue
TheSonOfThomp Aug 24, 2023
0fd6d6b
Update useControlledValue.spec.tsx
TheSonOfThomp Aug 25, 2023
405229a
resolves circular dependency in lib
TheSonOfThomp Aug 25, 2023
152db57
expect no console
TheSonOfThomp Aug 25, 2023
3d0abb5
Merge branch 'main' into adam/generic-useControlledValue
TheSonOfThomp Aug 25, 2023
50a45ae
Adds NextLink legacyBehavior test
TheSonOfThomp Aug 25, 2023
d2377e7
Merge branch 'fix-button-test-next' into adam/generic-useControlledValue
TheSonOfThomp Aug 25, 2023
80dc30c
rm lib from dev dep
TheSonOfThomp Aug 25, 2023
a1c34e9
Merge branch 'main' into adam/generic-useControlledValue
TheSonOfThomp Aug 25, 2023
a697215
Update useControlledValue.spec.tsx
TheSonOfThomp Sep 15, 2023
7a833ae
updates useControlled value to be more flexible
TheSonOfThomp Sep 18, 2023
cf61a27
add warnings
TheSonOfThomp Sep 18, 2023
d4af1bd
Update soft-berries-obey.md
TheSonOfThomp Sep 18, 2023
799a672
Merge branch 'main' into adam/generic-useControlledValue
TheSonOfThomp Sep 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/soft-berries-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@leafygreen-ui/hooks': minor
---

- Extends `useControlledValue` to accept any type.
- Adds `updateValue` function in return value. This method triggers a synthetic event to update the value of a controlled or uncontrolled component.
TheSonOfThomp marked this conversation as resolved.
Show resolved Hide resolved
- Adds `initialValue` argument. Used for setting the initial value for uncontrolled components. Without this we may encounter a React error for switching between controlled/uncontrolled inputs
- The value of `isControlled` is now immutable after the first render
4 changes: 2 additions & 2 deletions packages/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"access": "public"
},
"dependencies": {
"@leafygreen-ui/lib": "^11.0.0",
"lodash": "^4.17.21"
},
"gitHead": "dd71a2d404218ccec2e657df9c0263dc1c15b9e0",
Expand All @@ -34,7 +35,6 @@
"url": "https://jira.mongodb.org/projects/PD/summary"
},
"devDependencies": {
"@leafygreen-ui/emotion": "^4.0.7",
"@leafygreen-ui/lib": "^11.0.0"
"@leafygreen-ui/emotion": "^4.0.7"
}
}

This file was deleted.

Loading
Loading