-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Generic support for Chakra UI (#3327)
* Generic support for Chakra UI - Partially fix #3072 - Extract ChakraIconButton to its own file to abstract away React.memo - Refactor AltDateWidget to extract DateElement component * Changes from code review * Update packages/chakra-ui/src/IconButton/index.ts Co-authored-by: Heath C <[email protected]>
- Loading branch information
1 parent
51a6517
commit db14094
Showing
32 changed files
with
512 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import React from "react"; | ||
import { IconButtonProps } from "@rjsf/utils"; | ||
import { | ||
FormContextType, | ||
IconButtonProps, | ||
RJSFSchema, | ||
StrictRJSFSchema, | ||
} from "@rjsf/utils"; | ||
import { Button } from "@chakra-ui/react"; | ||
import { AddIcon } from "@chakra-ui/icons"; | ||
|
||
const AddButton: React.ComponentType<IconButtonProps> = ({ | ||
uiSchema, | ||
registry, | ||
...props | ||
}) => ( | ||
<Button leftIcon={<AddIcon />} {...props}> | ||
Add Item | ||
</Button> | ||
); | ||
|
||
export default AddButton; | ||
export default function AddButton< | ||
T = any, | ||
S extends StrictRJSFSchema = RJSFSchema, | ||
F extends FormContextType = any | ||
>({ uiSchema, registry, ...props }: IconButtonProps<T, S, F>) { | ||
return ( | ||
<Button leftIcon={<AddIcon />} {...props}> | ||
Add Item | ||
</Button> | ||
); | ||
} |
15 changes: 12 additions & 3 deletions
15
packages/chakra-ui/src/AltDateTimeWidget/AltDateTimeWidget.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.