Skip to content

Commit

Permalink
Merge branch 'canary' into feat/date-picker-input-styling
Browse files Browse the repository at this point in the history
  • Loading branch information
ryo-manba committed Jun 8, 2024
2 parents 299f10d + a06422f commit 28b1caa
Show file tree
Hide file tree
Showing 34 changed files with 264 additions and 109 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-mice-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/pagination": patch
---

Fixed pagination missing animation (#3138)
5 changes: 5 additions & 0 deletions .changeset/giant-maps-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/shared-icons": patch
---

avoid passing non-DOM attributes to svg (#3184)
5 changes: 5 additions & 0 deletions .changeset/grumpy-scissors-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/tabs": patch
---

Fixed incorrect content in tab panel (#3159)
5 changes: 5 additions & 0 deletions .changeset/lazy-comics-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/select": patch
---

Add missing `data-invalid` attribute (#3149)
5 changes: 5 additions & 0 deletions .changeset/thirty-timers-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/select": patch
---

set empty string instead of undefined for unsetting value (#3156)
5 changes: 5 additions & 0 deletions .changeset/tough-peaches-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/autocomplete": patch
---

Fix maximum update depth exceeded on Autocomplete component (#3094)
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Hello!, I am very excited that you are interested in contributing with Next UI.
### Tooling

- [PNPM](https://pnpm.io/) to manage packages and dependencies
- [Tsup](https://tsup.egoist.sh/) to bundle packages
- [Tsup](https://tsup.egoist.dev/) to bundle packages
- [Storybook](https://storybook.js.org/) for rapid UI component development and
testing
- [Testing Library](https://testing-library.com/) for testing components and
Expand Down
3 changes: 2 additions & 1 deletion apps/docs/config/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@
"key": "checkbox",
"title": "Checkbox",
"keywords": "checkbox, binary choice, selection control, toggle",
"path": "/docs/components/checkbox.mdx"
"path": "/docs/components/checkbox.mdx",
"updated": true
},
{
"key": "checkbox-group",
Expand Down
16 changes: 15 additions & 1 deletion apps/docs/content/blog/v2.4.0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ The disabled option(s) will be displayed in the bottom of the list.

### Doctor Command add peerDependencies check

The `doctor` command now checks for peerDependencies and displays the incorrect peerDependencies, relation: [nextui-org/nextui#2954](https://github.com/nextui-org/nextui/issues/2954).
The `doctor` command now checks for peerDependencies and displays the incorrect peerDependencies. (See [nextui-org/nextui#2954](https://github.com/nextui-org/nextui/issues/2954) for more).

<Spacer y={4} />

Expand Down Expand Up @@ -268,6 +268,20 @@ you need to update the import as follows:

<Spacer y={4} />

### Validation Behavior

Since v2.4.0, we've changed the default validation behavior to `aria` which means no native validation is applied. If you wish to use the native validation, you can set `validationBehavior` to `native` to the input components or set it to the Provider as stated above.

For those who use `validationBehavior="aria"`, `validate` will be no longer applied since it is only for native validation. Therefore, you need to switch to use `isInvalid` prop instead.

```tsx
<form onSubmit={onSubmit}>
<Input errorMessage={formErrors?.field1} isInvalid={!!formErrors?.field1} name="field1" />
<Button type="submit">Submit</Button>
</form>
```

<Spacer y={4} />

## Other Changes

Expand Down
19 changes: 9 additions & 10 deletions apps/docs/content/components/checkbox/custom-check-icon.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
const HeartIcon = `export const HeartIcon = ({
filled,
size,
height,
width,
label,
...props
}) => {
const HeartIcon = `export const HeartIcon = ({ size, height, width, ...props }) => {
// avoid passing non-DOM attributes to svg
const {isSelected, isIndeterminate, disableAnimation, ...otherProps} = props;
return (
<svg
width={size || width || 24}
height={size || height || 24}
viewBox="0 0 24 24"
fill='fill'
xmlns="http://www.w3.org/2000/svg"
{...props}
{...otherProps}
>
<path
d="M12.62 20.81c-.34.12-.9.12-1.24 0C8.48 19.82 2 15.69 2 8.69 2 5.6 4.49 3.1 7.56 3.1c1.82 0 3.43.88 4.44 2.24a5.53 5.53 0 0 1 4.44-2.24C19.51 3.1 22 5.6 22 8.69c0 7-6.48 11.13-9.38 12.12Z"
Expand All @@ -25,14 +21,17 @@ const HeartIcon = `export const HeartIcon = ({
`;

const PlusIcon = `export const PlusIcon = ({ size, height, width, ...props }) => {
// avoid passing non-DOM attributes to svg
const {isSelected, isIndeterminate, disableAnimation, ...otherProps} = props;
return (
<svg
width={size || width || 24}
height={size || height || 24}
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...props}
{...otherProps}
>
<path
d="M6 12H18"
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/components/date-range-picker/presets.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const App = `import {DateRangePicker, Radio, RadioGroup, Button, ButtonGroup, cn} from "@nextui-org/react";
import {today, startOfWeek, startOfMonth, endOfWeek, endOfMonth, useDateFormatter, getLocalTimeZone} from "@internationalized/date";
import {useLocale} from "@react-aria/i18n";
import {today, startOfWeek, startOfMonth, endOfWeek, endOfMonth, getLocalTimeZone} from "@internationalized/date";
import {useLocale, useDateFormatter} from "@react-aria/i18n";
export default function App() {
let defaultDate = {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/components/autocomplete.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ The following example uses the `defaultFilter` prop to filter the list of option

### Asynchronous Filtering

Autocomplete supports asynchronous filtering, in the example below we are using the [useAyncList](https://react-spectrum.adobe.com/react-stately/useAsyncList.html) function
Autocomplete supports asynchronous filtering, in the example below we are using the [useAsyncList](https://react-spectrum.adobe.com/react-stately/useAsyncList.html) function
from [react-aria](https://react-spectrum.adobe.com) to handle asynchronous loading and filtering of data from a server.

<PackageManagers
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/components/checkbox-group.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ In case you need to customize the checkbox even further, you can use the `useChe
| validationState | `valid` \| `invalid` | Whether the inputs should display its "valid" or "invalid" visual styling. (**Deprecated**) use **isInvalid** instead. | - |
| description | `ReactNode` | The checkbox group description. | - |
| errorMessage | `ReactNode` \| `((v: ValidationResult) => ReactNode)` | The checkbox group error message. | - |
| validate | `(value: string[]) => ValidationError | true | null | undefined` | Validate input values when committing (e.g. on blur), and return error messages for invalid values. | - |
| validate | `(value: string[]) => ValidationError | true | null | undefined` | Validate input values when committing (e.g. on blur), returning error messages for invalid values. Validation errors are displayed upon form submission if `validationBehavior` is set to `native`. For real-time validation, use the `isInvalid` prop.| - |
| validationBehavior | `native` \| `aria` | Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.| `aria` |
| isDisabled | `boolean` | Whether the checkbox group is disabled. | `false` |
| isRequired | `boolean` | Whether user checkboxes are required on the input before form submission. | `false` |
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/components/checkbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Checkboxes allow users to select multiple items from a list of individual items,

---



## Installation

<PackageManagers
Expand Down Expand Up @@ -70,6 +68,8 @@ The `isIndeterminate` prop sets a `Checkbox` to an indeterminate state, overridi

### Custom Check Icon

> By default, `IconProps` will be passed to your icon component. Please make sure that `isSelected`, `isIndeterminate`, and `disableAnimation` are not passed to a DOM element.
<CodeDemo title="Custom Check Icon" files={checkboxContent.customCheckIcon} />

### Controlled
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/components/date-input.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ import {parseZonedDateTime} from "@internationalized/date";
| locale | `string` | The locale to display and edit the value according to. | - |
| description | `ReactNode` | A description for the date input. Provides a hint such as specific requirements for what to choose. | - |
| errorMessage | `ReactNode \| (v: ValidationResult) => ReactNode` | An error message for the date input. | - |
| validate | `(value: MappedDateValue<DateValue>) => ValidationError | true | null | undefined` | Validate input values when committing (e.g., on blur), and return error messages for invalid values. | - |
| validate | `(value: MappedDateValue<DateValue>) => ValidationError | true | null | undefined` | Validate input values when committing (e.g. on blur), returning error messages for invalid values. Display validation errors upon form submission if `validationBehavior` is set to `native`. For real-time validation, use the `isInvalid` prop.| - |
| validationBehavior | `native` \| `aria` | Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.| `aria` |
| startContent | `ReactNode` | Element to be rendered in the left side of the date input. | - |
| endContent | `ReactNode` | Element to be rendered in the right side of the date input. | - |
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/components/date-picker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ import {I18nProvider} from "@react-aria/i18n";
| placeholderValue | `ZonedDateTime` \| `CalendarDate` \| `CalendarDateTime` \| `undefined` \| `null` | The placeholder of the date-picker. | - |
| description | `ReactNode` | A description for the date-picker. Provides a hint such as specific requirements for what to choose. | - |
| errorMessage | `ReactNode \| (v: ValidationResult) => ReactNode` | An error message for the date input. | - |
| validate | `(value: MappedDateValue<DateValue>) => ValidationError | true | null | undefined` | Validate input values when committing (e.g., on blur), and return error messages for invalid values. | - |
| validate | `(value: MappedDateValue<DateValue>) => ValidationError | true | null | undefined` | Validate input values when committing (e.g. on blur), returning error messages for invalid values. Display validation errors upon form submission if `validationBehavior` is set to `native`. For real-time validation, use the `isInvalid` prop.| - |
| validationBehavior | `native` \| `aria` | Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.| `aria` |
| startContent | `ReactNode` | Element to be rendered in the left side of the date-picker. | - |
| endContent | `ReactNode` | Element to be rendered in the right side of the date-picker. | - |
Expand Down
6 changes: 2 additions & 4 deletions apps/docs/content/docs/components/date-range-picker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,11 @@ in multiple formats into `ZonedDateTime` objects.
import {
DateValue,
now,
useLocale,
startOfWeek,
startOfMonth,
useDateFormatter,
getLocalTimeZone,
} from "@internationalized/date";
import {I18nProvider} from "@react-aria/i18n";
import {useLocale, useDateFormatter} from "@react-aria/i18n";
```

<CodeDemo title="Presets" files={dateRangePickerContent.presets} />
Expand Down Expand Up @@ -354,7 +352,7 @@ import {I18nProvider} from "@react-aria/i18n";
| placeholderValue | `ZonedDateTime` \| `CalendarDate` \| `CalendarDateTime` \| `undefined` \| `null` | The placeholder of the date-range-picker. | - |
| description | `ReactNode` | A description for the date-range-picker. Provides a hint such as specific requirements for what to choose. | - |
| errorMessage | `ReactNode \| (v: ValidationResult) => ReactNode` | An error message for the date input. | - |
| validate | `(value: RangeValue<MappedDateValue<DateValue>>) => ValidationError | true | null | undefined` | Validate input values when committing (e.g., on blur), and return error messages for invalid values. | - |
| validate | `(value: RangeValue<MappedDateValue<DateValue>>) => ValidationError | true | null | undefined` | Validate input values when committing (e.g. on blur), returning error messages for invalid values. Display validation errors upon form submission if `validationBehavior` is set to `native`. For real-time validation, use the `isInvalid` prop.| - |
| validationBehavior | `native` \| `aria` | Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA. | `aria` |
| startContent | `ReactNode` | Element to be rendered in the left side of the date-range-picker. | - |
| endContent | `ReactNode` | Element to be rendered in the right side of the date-range-picker. | - |
Expand Down
Loading

0 comments on commit 28b1caa

Please sign in to comment.