Skip to content

Commit 0c0cdbc

Browse files
authored
Merge pull request #161 from csandman/create-styles-context
Create styles context
2 parents 49543dc + fc4c578 commit 0c0cdbc

File tree

12 files changed

+1249
-2552
lines changed

12 files changed

+1249
-2552
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ The API for an individual style function looks like this:
307307

308308
```js
309309
/**
310-
* @param {SystemStyleObject} provided -- The component's default Chakra styles
310+
* @param {CSSObject} provided -- The component's default Chakra styles
311311
* @param {Object} state -- The component's current state e.g. `isFocused` (this gives all of the same props that are passed into the component)
312-
* @returns {SystemStyleObject} An output style object which is forwarded to the component's `sx` prop
312+
* @returns {CSSObject} An output style object which is forwarded to the component's `sx` prop
313313
*/
314314
function option(provided, state) {
315315
return {
@@ -502,7 +502,7 @@ This package has always supported typescript, however until `3.0.0` none of the
502502
503503
This package exports all of the named module members of the original `react-select` in case you need their built in types in any of your variable declarations. The root select `Props` type that is exported by `react-select` has been extended using module augmentation,<sup>[[1]](https://react-select.com/typescript#custom-select-props)</sup><sup>[[2]](https://github.com/JedWatson/react-select/issues/4804#issuecomment-927223471)</sup> so if you import that type it will include all of the extra props offered. This package also exports a few custom types that are specific to the custom props offered by this package:
504504
505-
- `ChakraStylesConfig` — The type for the prop `chakraStyles` that can be passed to customize the component styles. This is almost identical to the built in `StylesConfig` type, however it uses Chakra's `SystemStyleObject` type instead of react-select's emotion styles.
505+
- `ChakraStylesConfig` — The type for the prop `chakraStyles` that can be passed to customize the component styles. This is almost identical to the built in `StylesConfig` type, however it uses Chakra's [`CSSObject`](https://github.com/chakra-ui/chakra-ui/blob/790d2417a3f5d59e2d69229a027af671c2dc0cbc/packages/styled-system/src/system.types.ts#L81) type instead of react-select's emotion styles.
506506
- `OptionBase` — A type for your individual select options that includes the custom props for styling each of your selected options. This type is made to give you a base to extend off of and pass in as a generic to the root `Select` component.
507507
- Each of the four Select components has a type exported with it:
508508
- `SelectComponent`
@@ -746,37 +746,37 @@ See this issue for some discussion about using this package with `react-hook-for
746746

747747
By default, `react-hook-form` uses [uncontrolled components](https://reactjs.org/docs/uncontrolled-components.html) to reduced input renders however this only works for native HTML inputs. Because chakra-react-select is not a native HTML input, you'll need to use react-hook-form's [`Controller`](https://react-hook-form.com/api/usecontroller/controller) component or [`useController`](https://react-hook-form.com/api/usecontroller) hook in order to keep the value(s) tracked in `react-hook-form`'s state. Here are some examples using each:
748748

749-
`Controller` multi select with built-in validation
749+
#### `Controller` multi select with built-in validation
750750

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

754-
`useController` multi select with built-in validation
754+
#### `useController` multi select with built-in validation
755755

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

759-
`useController` single select
759+
#### `useController` single select
760760

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

764-
Multi select with [`yup`](https://github.com/jquense/yup) validation (advanced example)
764+
#### Multi select with [`yup`](https://github.com/jquense/yup) validation (advanced example)
765765

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

769-
Single select with [`yup`](https://github.com/jquense/yup) validation (advanced example)
769+
#### Single select with [`yup`](https://github.com/jquense/yup) validation (advanced example)
770770

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

774-
Multi select with [`zod`](https://github.com/colinhacks/zod) validation (advanced example)
774+
#### Multi select with [`zod`](https://github.com/colinhacks/zod) validation (advanced example)
775775

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

779-
Single select with [`zod`](https://github.com/colinhacks/zod) validation (advanced example)
779+
#### Single select with [`zod`](https://github.com/colinhacks/zod) validation (advanced example)
780780

781781
[![CS-JS]](https://codesandbox.io/s/chakra-react-select-single-react-hook-form-with-zod-validation-jd588n?file=/src/app.js)
782782
[![CS-TS]](https://codesandbox.io/s/chakra-react-select-single-react-hook-form-with-zod-validation-typescript-m1dqme?file=/app.tsx)
@@ -785,17 +785,17 @@ Single select with [`zod`](https://github.com/colinhacks/zod) validation (advanc
785785

786786
See this issue for some discussion about using this package with `formik`: https://github.com/csandman/chakra-react-select/issues/23
787787

788-
Single select with built in validation
788+
#### Single select with built in validation
789789

790790
- Vanilla JS: _coming soon_
791791
- TypeScript: _coming soon_
792792

793-
Multi select with built in validation
793+
#### Multi select with built in validation
794794

795795
- Vanilla JS: _coming soon_
796796
- TypeScript: _coming soon_
797797

798-
Multi select with `yup` validation
798+
#### Multi select with `yup` validation
799799

800800
- Vanilla JS: _coming soon_
801801
- TypeScript: _coming soon_

0 commit comments

Comments
 (0)