Skip to content

Commit

Permalink
Merge branch 'master' into bug/select-menu-window-scroll-to
Browse files Browse the repository at this point in the history
  • Loading branch information
Sodik authored Apr 9, 2024
2 parents 15497a9 + 555ed1f commit 411a8d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/ui/__stories__/InteractiveListFormik.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const WithCustomAddButton = () => {

const submit = async (values: Values) => {
try {
logger.log('value', inputRef.current?.getValue())
await inputRef.current?.addItem()
await schema.validate(values, { abortEarly: false })
} catch (e) {
Expand Down
6 changes: 5 additions & 1 deletion packages/ui/src/InteractiveList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export type InteractiveListCoreProps<V> = {

export type InteractiveListProps<V> = InteractiveListExtraProps & InteractiveListCoreProps<V>

export type InteractiveListInputRef = { setValue: (value: string) => void; addItem: () => Promise<string | undefined> }
export type InteractiveListInputRef = {
setValue: (value: string) => void
addItem: () => Promise<string | undefined>
getValue: () => string
}

export type InteractiveListItemProps = {
content: string
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/InteractiveListFormik.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export const InteractiveListFormik = <V extends object>({
setInputValue(value)
},
addItem: addItem,
getValue: () => inputValue,
}))

useEffect(() => {
Expand Down

0 comments on commit 411a8d8

Please sign in to comment.