Skip to content

Commit def58b8

Browse files
authored
Biz/dj 2813 support custom input strings in connect react (#15356)
* Add support for custom string input * Add support for custom string input * Bump version and update changelog
1 parent 8c278bf commit def58b8

File tree

6 files changed

+17
-4
lines changed

6 files changed

+17
-4
lines changed

packages/connect-react/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<!-- markdownlint-disable MD024 -->
22
# Changelog
33

4+
# [1.0.0-preview.22] - 2025-01-21
5+
6+
- Allow custom string input for remote options
7+
48
# [1.0.0-preview.21] - 2025-01-17
59

610
- Fix a bug in async prop value validation when the prop is a string

packages/connect-react/examples/nextjs/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/connect-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/connect-react",
3-
"version": "1.0.0-preview.21",
3+
"version": "1.0.0-preview.22",
44
"description": "Pipedream Connect library for React",
55
"files": [
66
"dist"

packages/connect-react/src/components/ControlSelect.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ export function ControlSelect<T>({
9696
MenuList: LoadMore,
9797
}
9898
}
99+
100+
const handleCreate = (inputValue: string) => {
101+
options.unshift({
102+
label: inputValue,
103+
value: inputValue,
104+
})
105+
};
106+
99107
const MaybeCreatableSelect = isCreatable
100108
? CreatableSelect
101109
: Select;
@@ -110,6 +118,7 @@ export function ControlSelect<T>({
110118
required={!prop.optional}
111119
{...props}
112120
{...selectProps}
121+
onCreateOption={handleCreate}
113122
onChange={(o) => {
114123
if (o) {
115124
if (Array.isArray(o)) {

packages/connect-react/src/components/RemoteOptionsContainer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export function RemoteOptionsContainer({ queryEnabled }: RemoteOptionsContainerP
185185

186186
return (
187187
<ControlSelect
188+
isCreatable={true}
188189
showLoadMoreButton={showLoadMoreButton()}
189190
onLoadMore={onLoadMore}
190191
options={pageable.data}

pnpm-lock.yaml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)