Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V6 (Chakra UI V3) #341

Draft
wants to merge 45 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
266e44d
Initial commit of v6
csandman Oct 11, 2024
9bddbd2
6.0.0-next.0
csandman Oct 11, 2024
5362cab
Replace chakra.span with Span
csandman Oct 12, 2024
4ba519c
Fix subtle styling
csandman Oct 12, 2024
fda76e5
Make the default size getter not fail without a value
csandman Oct 12, 2024
23e8cdd
Remove unused eslint rule
csandman Oct 12, 2024
f6f09e6
Merge remote-tracking branch 'origin' into v6
csandman Oct 12, 2024
cd27be2
Add `next` tag to the publish config
csandman Oct 14, 2024
c0d7203
6.0.0-next.1
csandman Oct 14, 2024
20dce2e
Merge remote-tracking branch 'origin' into v6
csandman Oct 23, 2024
b11ecfb
Upgrade to real Chakra v3
csandman Oct 23, 2024
09520e3
Bump up to official Chakra v3
csandman Oct 23, 2024
f145a7e
Update dependencies
csandman Oct 23, 2024
7deee8d
Clean up size prop again
csandman Oct 23, 2024
0de3a12
A little more cleanup
csandman Oct 23, 2024
2f65639
Add an invalid example
csandman Oct 23, 2024
c4d789c
Fix placeholder color
csandman Oct 23, 2024
6e756c4
Remove default cursors
csandman Oct 23, 2024
be063f9
6.0.0-next.2
csandman Oct 23, 2024
d412de1
Move cursors to correct location
csandman Oct 23, 2024
29ab844
Remove extra multi-value styles
csandman Oct 23, 2024
ba8e112
Add other size examples
csandman Oct 23, 2024
6d5cf25
Fix clear button height
csandman Oct 23, 2024
35818c6
Fix clear indicator sizing
csandman Oct 23, 2024
b79ddbe
Remove duplicate aria-label
csandman Oct 23, 2024
12e0c98
Add note about clear indicator
csandman Oct 23, 2024
b665da6
Remove redundant duplicate styles from the control
csandman Oct 23, 2024
e71065b
Make the clear indicator icon slightly larger
csandman Oct 23, 2024
d524a2c
5.0.2
csandman Nov 1, 2024
c3c9c96
Merge branch 'main' into v6
csandman Nov 1, 2024
dd7b041
Update prop typing comments, and reorganize useChakraSelectProps
csandman Nov 1, 2024
ec0a118
Update demo
csandman Nov 1, 2024
6fed488
Remove theme color palette
csandman Nov 1, 2024
a4b75ad
Fix tags postpublish script
csandman Nov 13, 2024
c083adb
Clean up ignore files
csandman Nov 13, 2024
dfdca9c
Remove extra variant
csandman Nov 13, 2024
bbdc8eb
Update demo a little
csandman Nov 13, 2024
58616ad
Remove `react-dom` as a peer dependency
csandman Nov 13, 2024
c402bd1
6.0.0-next.3
csandman Nov 13, 2024
724a69e
Start working on updating the docs
csandman Nov 14, 2024
616826b
Generalize `next-themes` peer dep version
csandman Nov 14, 2024
9ca9948
6.0.0-next.4
csandman Nov 14, 2024
0d5f5cd
Add proper handling for no `Field.Root` wrapper
csandman Nov 19, 2024
dd40ff2
6.0.0-next.5
csandman Nov 19, 2024
a645027
Fix the typing on the `useFieldContext` return
csandman Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Core files
node_modules/
dist/
tmp/

# Codemod generated files
codemod/**/*.js
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,3 @@ dist
.tern-port

.DS_Store

tmp/
2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
dist/
tmp/
tmp/
86 changes: 27 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ Check out the demo here:
- [Usage](#usage)
- [Extra Props](#extra-props)
- [`size`](#size--options-responsivevaluesm--md--lg--default-md)
- [`tagColorScheme`](#tagcolorscheme)
- [`tagColorPalette`](#tagcolorpalette)
- [`tagVariant`](#tagvariant--options-subtle--solid--outline--default-subtle)
- [`isInvalid` / `isReadOnly`](#isinvalid--default-false--isreadonly---default-false)
- [`focusBorderColor` / `errorBorderColor`](#focusbordercolor--default-blue500--errorbordercolor--default-red500)
- [`invalid` / `readOnly`](#invalid--default-false--readonly---default-false)
- [`selectedOptionStyle`](#selectedoptionstyle--options-color--check--default-color)
- [`selectedOptionColorScheme`](#selectedoptioncolorscheme--default-blue)
- [`selectedOptionColorPalette`](#selectedoptioncolorpalette--default-blue)
- [`variant`](#variant--options-outline--filled--flushed--unstyled--default-outline)
- [`useBasicStyles` (removed)](#usebasicstyles-removed)
- [Styling](#styling)
Expand Down Expand Up @@ -176,33 +175,28 @@ return (

---

#### `tagColorScheme`
#### `tagColorPalette`

> [!NOTE]
>
> Renamed from `colorScheme` in
> [`v5.0.0`](https://github.com/csandman/chakra-react-select/releases/tag/v5.0.0)

You can pass the `tagColorScheme` prop to the select component to change all of
You can pass the `tagColorPalette` prop to the select component to change all of
the selected options tags' colors. You can view the whole list of available
color schemes in
[the Chakra docs](https://v2.chakra-ui.com/docs/components/tag/props), or if you
have a custom color palette, any of the custom color names in that will be
available instead.

Alternatively, you can add the `colorScheme` key to any of your options objects
Alternatively, you can add the `colorPalette` key to any of your options objects
and it will only style that option when selected.

```tsx
return (
<Select
{/* The global tag color scheme */}
tagColorScheme="purple"
tagColorPalette="purple"
options={[
{
label: "I am red",
value: "i-am-red",
colorScheme: "red", // The option color scheme overrides the global
colorPalette: "red", // The option color scheme overrides the global
},
{
label: "I fallback to purple",
Expand Down Expand Up @@ -257,29 +251,29 @@ return (

---

#### `isInvalid` — Default: `false` | `isReadOnly` - Default: `false`
#### `invalid` — Default: `false` | `readOnly` - Default: `false`

You can pass `isInvalid` to the select component to style it like the Chakra
You can pass `invalid` to the select component to style it like the Chakra
`Input` is styled when it receives the same prop. Alternatively, you can pass
`isReadOnly` to make the component non-interactive in the same way Chakra's
`readOnly` to make the component non-interactive in the same way Chakra's
`Input` does.

You can pass also pass `isInvalid`, `isDisabled`, or `isReadOnly` into a
wrapping `<FormControl />` to achieve the same result as passing these props
into the `Select` component.
You can pass also pass `invalid`, `disabled`, or `readOnly` into a wrapping
`<FormControl />` to achieve the same result as passing these props into the
`Select` component.

```tsx
return (
<>
{/* This will show up with a red border */}
<Select isInvalid />
<Select invalid />

{/* This will show up normally but will not be interactive */}
<Select isReadOnly />
<Select readOnly />

{/* This will show up grayed out and will not be interactive */}
{/* Additionally, it will have a red border and the error message will be shown */}
<FormControl isInvalid isDisabled>
<FormControl invalid disabled>
<FormLabel>Invalid & Disabled Select</FormLabel>
<Select />
<FormErrorMessage>
Expand All @@ -296,27 +290,6 @@ return (

---

#### `focusBorderColor` — Default: `blue.500` | `errorBorderColor` — Default: `red.500`

The props `focusBorderColor` and `errorBorderColor` can be passed with Chakra
color strings which will emulate the respective props being passed to
[Chakra's `<Input />` component](https://v2.chakra-ui.com/docs/components/input#changing-the-focus-and-error-border-colors).

```tsx
return (
<>
<Select errorBorderColor="orange.500" isInvalid />
<Select focusBorderColor="green.500" />
</>
);
```

![Orange errorBorderColor](./.github/images/custom-borders.png)

[![SB-TS]](https://stackblitz.com/edit/vitejs-vite-vhcvmv?file=src%2Fapp.tsx)

---

#### `selectedOptionStyle` — Options: `color` | `check` — Default: `color`

As of `v1.3.0` you can pass the prop `selectedOptionStyle` with either `"color"`
Expand Down Expand Up @@ -346,13 +319,13 @@ return (

---

#### `selectedOptionColorScheme` — Default: `blue`
#### `selectedOptionColorPalette` — Default: `blue`

If you choose to stick with the default `selectedOptionStyle="color"`, you have
one additional styling option. If you do not like the default of blue for the
highlight color, you can pass the `selectedOptionColorScheme` prop to change it.
This prop will accept any named color from your theme's color palette, and it
will use the `500` value in light mode or the `300` value in dark mode.
highlight color, you can pass the `selectedOptionColorPalette` prop to change
it. This prop will accept any named color from your theme's color palette, and
it will use the `500` value in light mode or the `300` value in dark mode.

> [!NOTE]
>
Expand All @@ -362,17 +335,12 @@ will use the `500` value in light mode or the `300` value in dark mode.
> to customize it (see
> [#99](https://github.com/csandman/chakra-react-select/discussions/99) for an
> example).
>
> Prior to
> [`v4.6.0`](https://github.com/csandman/chakra-react-select/releases/tag/v4.6.0)
> this prop was named `selectedOptionColor`, and it was renamed to prevent
> confusion about its purpose.

```tsx
return (
<>
<Select selectedOptionColorScheme="blue" /> {/* Default */}
<Select selectedOptionColorScheme="purple" />
<Select selectedOptionColorPalette="blue" /> {/* Default */}
<Select selectedOptionColorPalette="purple" />
</>
);
```
Expand Down Expand Up @@ -420,7 +388,7 @@ One thing to note is that the default styling for `variant="filled"` and
background color when the select is not focused. The easiest solution for this
is to pass the
[`tagVariant`](#tagvariant--options-subtle--solid--outline--default-subtle) or
[`colorScheme`](#colorscheme) prop to add some contrast between the two
[`colorPalette`](#colorscheme) prop to add some contrast between the two
elements.

![filled variant](./.github/images/filled-variant.png)
Expand Down Expand Up @@ -835,8 +803,8 @@ import { GroupBase, OptionBase, Select } from "chakra-react-select";
* ```
* interface OptionBase {
* variant?: string;
* colorScheme?: string;
* isDisabled?: boolean;
* colorPalette?: string;
* disabled?: boolean;
* };
* ```
*/
Expand All @@ -849,7 +817,7 @@ const colorOptions = [
{
label: "Red",
value: "red",
colorScheme: "red", // This is allowed because of the key in the `OptionBase` type
colorPalette: "red", // This is allowed because of the key in the `OptionBase` type
},
{
label: "Blue",
Expand Down
Loading
Loading