Skip to content

Commit 8cfbda0

Browse files
authored
Merge pull request #315 from csandman/chore/update-dependencies
chore: Update all dependencies
2 parents b2c2140 + 2c0262c commit 8cfbda0

File tree

5 files changed

+2261
-1887
lines changed

5 files changed

+2261
-1887
lines changed

README.md

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,7 @@ There are a few ways to style the components that make up `chakra-react-select`.
444444
It's important to note that this package does not use the `theme` or `styles`
445445
props that are implemented in `react-select`. The `theme` prop isn't used as
446446
most of the components' base styles are pulling from your Chakra theme, and
447-
customizing your base theme (such as colors or component styles) should in turn
448-
change the styles in this package.
447+
[customizing your base theme (such as colors or component styles) should in turn change the styles in this package.](#theme-styles)
449448

450449
This package does however offer an alternative to the `styles` prop,
451450
`chakraStyles`. It mostly emulates the behavior of the original `styles` prop,
@@ -648,16 +647,18 @@ or are themselves those components. As this package pulls directly from your
648647
Chakra theme, any changes you make to those components' themes will propagate to
649648
the components in this package.
650649

651-
**NOTE:** Some of the theme styles are manually overridden when this package
652-
implements them. This is necessary for implementing styles for
653-
[`size`](#size--options-sm--md--lg--default-md) variants in components that do
654-
not natively have them in Chakra's default theme. This mostly concerns
655-
components that make up the `Menu`, but there are a few other cases where this
656-
exception applies. There is no alternative to this currently, so if your custom
657-
theme styles are not being applied correctly please use
658-
[`chakraStyles`](#chakrastyles) to style your components instead. `chakraStyles`
659-
always takes the highest priority in overriding the styles of a component. See
660-
#194 for more info.
650+
> **NOTE:** Some of the theme styles are manually overridden when this package
651+
> implements them. This is necessary for implementing styles for
652+
> [`size`](#size--options-responsivevaluesm--md--lg--default-md) variants in
653+
> components that do not natively have them in Chakra's default theme. This
654+
> mostly concerns components that make up the `Menu`, but there are a few other
655+
> cases where this exception applies. There is no alternative to this currently,
656+
> so if your custom theme styles are not being applied correctly please use
657+
> [`chakraStyles`](#chakrastyles) to style your components instead.
658+
> `chakraStyles` always takes the highest priority in overriding the styles of a
659+
> component. See
660+
> [#194](https://github.com/csandman/chakra-react-select/issues/194) for more
661+
> info.
661662
662663
Here is a list of all components that will be affected by changes to your theme:
663664

@@ -677,9 +678,9 @@ Here is a list of all components that will be affected by changes to your theme:
677678
In addition to specific component styles, any changes you make to your global
678679
color scheme will also be reflected in these custom components.
679680

680-
**NOTE:** Only make changes to your global component themes if you want them to
681-
appear in all instances of that component. Otherwise, just change the individual
682-
components' styles using the `chakraStyles` prop.
681+
> **NOTE:** Only make changes to your global component themes if you want them
682+
> to appear in all instances of that component. Otherwise, just change the
683+
> individual components' styles using the `chakraStyles` prop.
683684
684685
### `className`
685686

@@ -723,11 +724,11 @@ Here is an example of using classNames to style the components:
723724
724725
## TypeScript Support
725726
726-
This package has always supported typescript, however until `3.0.0` none of the
727+
This package has always supported typescript, however until `v3.0.0` none of the
727728
type inference was working on the props passed into this component. Now that
728-
they are, you may need to pass in some generics for your component to work
729-
properly, but **in most cases you shouldn't need to**. Here is a snippet from
730-
the original documentation on the subject:
729+
they are, you may need to pass in some generics for your component to be typed
730+
properly, but **in most cases you shouldn't need to because their types should
731+
be inferred**. Here is a snippet from the original documentation on the subject:
731732
732733
> ### Select generics
733734
>
@@ -750,11 +751,14 @@ so if you import that type it will include all of the extra props offered. This
750751
package also exports a few custom types that are specific to the custom props
751752
offered by this package:
752753
753-
- `ChakraStylesConfig` — The type for the prop `chakraStyles` that can be passed
754-
to customize the component styles. This is almost identical to the built-in
755-
`StylesConfig` type, however, it uses Chakra's
754+
- `ChakraStylesConfig<Option, IsMulti, Group>` — The type for the prop
755+
`chakraStyles` that can be passed to customize the component styles. This is
756+
almost identical to the built-in `StylesConfig` type, however, it uses
757+
Chakra's
756758
[`CSSObject`](https://github.com/chakra-ui/chakra-ui/blob/790d2417a3f5d59e2d69229a027af671c2dc0cbc/packages/styled-system/src/system.types.ts#L81)
757-
type instead of react-select's emotion styles.
759+
type instead of react-select's emotion styles. It also has the same three
760+
generics as your `Select` component which would be required if you define your
761+
styles separately from your component.
758762
- `OptionBase` — A type for your individual select options that includes the
759763
custom props for styling each of your selected options. This type is made to
760764
give you a base to extend off of and pass in as a generic to the root `Select`
@@ -777,7 +781,7 @@ import { GroupBase, OptionBase, Select } from "chakra-react-select";
777781
* used by this package to customize the styles of your selected options
778782
*
779783
* ```
780-
* type OptionBase = {
784+
* interface OptionBase {
781785
* variant?: string;
782786
* colorScheme?: string;
783787
* isDisabled?: boolean;
@@ -1028,8 +1032,9 @@ const GooglePlacesAutocomplete = () => {
10281032
export default GooglePlacesAutocomplete;
10291033
```
10301034

1031-
**NOTE:** An API key would be needed to create a CodeSandbox example for this so
1032-
you will have to implement it in your own project if you'd like to test it out.
1035+
> **NOTE:** An API key would be needed to create a CodeSandbox example for this
1036+
> so you will have to implement it in your own project if you'd like to test it
1037+
> out.
10331038
10341039
## Usage with React Form Libraries
10351040

@@ -1038,10 +1043,10 @@ _This section is a work in progress, check back soon for more examples_
10381043
This package can be used with form controllers such as Formik or React Hook Form
10391044
in the same way you would with the original React Select, and the quickest way
10401045
to figure out how to do so would be to Google something along the lines of
1041-
"react-select with formik/react-hook-form/etc" and replace `react-select` in
1042-
those examples with `chakra-react-select`. However, here are a few examples to
1043-
help you get started. If you'd like to see examples using other form providers,
1044-
you can
1046+
"react-select with formik/react-hook-form/etc" and replace the `react-select`
1047+
component in those examples with a `chakra-react-select` component. However,
1048+
here are a few examples to help you get started. If you'd like to see examples
1049+
using other form providers, you can
10451050
[submit it as a Q&A discussion](https://github.com/csandman/chakra-react-select/discussions/categories/q-a).
10461051

10471052
### [`react-hook-form`](https://react-hook-form.com/)
@@ -1059,45 +1064,61 @@ component or [`useController`](https://react-hook-form.com/api/usecontroller)
10591064
hook in order to keep the value(s) tracked in `react-hook-form`'s state. Here
10601065
are some examples using each:
10611066

1067+
---
1068+
10621069
#### `Controller` multi select with built-in validation
10631070

10641071
[![CS-JS]](https://codesandbox.io/s/chakra-react-select-react-hook-form-controller-v7llc?file=/example.js)
10651072
[![CS-TS]](https://codesandbox.io/s/chakra-react-select-react-hook-form-controller-typescript-v8ps5?file=/app.tsx)
10661073

1074+
---
1075+
10671076
#### `useController` multi select with built-in validation
10681077

10691078
[![CS-JS]](https://codesandbox.io/s/chakra-react-select-react-hook-form-usecontroller-n8wuf?file=/example.js)
10701079
[![CS-TS]](https://codesandbox.io/s/chakra-react-select-react-hook-form-usecontroller-typescript-qcm23?file=/app.tsx)
10711080

1081+
---
1082+
10721083
#### `useController` single select
10731084

10741085
[![CS-JS]](https://codesandbox.io/s/chakra-react-select-react-hook-form-usecontroller-single-select-vanilla-js-11x4zk?file=/example.js)
10751086
[![CS-TS]](https://codesandbox.io/s/chakra-react-select-react-hook-form-usecontroller-single-select-typescript-vylckh?file=/app.tsx)
10761087

1088+
---
1089+
10771090
#### Multi select with [`yup`](https://github.com/jquense/yup) validation (advanced example)
10781091

10791092
[![CS-JS]](https://codesandbox.io/s/chakra-react-select-react-hook-form-with-yup-validation-tno8v?file=/src/app.js)
10801093
[![CS-TS]](https://codesandbox.io/s/chakra-react-select-react-hook-form-with-yup-validation-typescript-n7slhu?file=/app.tsx)
10811094

1095+
---
1096+
10821097
#### Single select with [`yup`](https://github.com/jquense/yup) validation (advanced example)
10831098

10841099
[![CS-JS]](https://codesandbox.io/s/chakra-react-select-single-react-hook-form-with-yup-validation-y5kjc1?file=/src/app.js)
10851100
[![CS-TS]](https://codesandbox.io/s/chakra-react-select-single-react-hook-form-with-yup-validation-typescript-phmv0u?file=/app.tsx)
10861101

1102+
---
1103+
10871104
#### Multi select with [`zod`](https://github.com/colinhacks/zod) validation (advanced example)
10881105

10891106
[![CS-JS]](https://codesandbox.io/s/chakra-react-select-react-hook-form-with-zod-validation-cu0rku?file=/src/app.js)
10901107
[![CS-TS]](https://codesandbox.io/s/chakra-react-select-react-hook-form-with-zod-validation-typescript-5fyhfh?file=/app.tsx)
10911108

1109+
---
1110+
10921111
#### Single select with [`zod`](https://github.com/colinhacks/zod) validation (advanced example)
10931112

10941113
[![CS-JS]](https://codesandbox.io/s/chakra-react-select-single-react-hook-form-with-zod-validation-jd588n?file=/src/app.js)
10951114
[![CS-TS]](https://codesandbox.io/s/chakra-react-select-single-react-hook-form-with-zod-validation-typescript-m1dqme?file=/app.tsx)
10961115

1116+
---
1117+
10971118
### [`formik`](https://formik.org/)
10981119

1099-
See this issue for some discussion about using this package with `formik`:
1100-
https://github.com/csandman/chakra-react-select/issues/23
1120+
See this discussion for some examples of using this package with `formik`:
1121+
https://github.com/csandman/chakra-react-select/discussions/111
11011122

11021123
#### Single select with built-in validation
11031124

0 commit comments

Comments
 (0)