Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/canary' into fix/dropdown-close-…
Browse files Browse the repository at this point in the history
…on-select
  • Loading branch information
gtoxlili committed May 6, 2024
2 parents 6d1df63 + 633f9d2 commit 0f24d08
Show file tree
Hide file tree
Showing 194 changed files with 2,097 additions and 999 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"baseBranch": "canary",
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
Expand Down
9 changes: 9 additions & 0 deletions .changeset/dull-experts-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@nextui-org/autocomplete": patch
"@nextui-org/calendar": patch
"@nextui-org/date-input": patch
"@nextui-org/date-picker": patch
"@nextui-org/use-intersection-observer": patch
---

Update React Aria packages
5 changes: 5 additions & 0 deletions .changeset/eighty-kids-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/theme": patch
---

Revise slider styles (#2880)
7 changes: 7 additions & 0 deletions .changeset/few-oranges-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@nextui-org/system": patch
"@nextui-org/system-rsc": patch
"@nextui-org/theme": patch
---

The `cn` utility was moved the `theme` package and updated to support NextUI custom classes.
6 changes: 6 additions & 0 deletions .changeset/nasty-pillows-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@nextui-org/calendar": patch
"@nextui-org/theme": patch
---

Fixed hiding of unavailable dates in RangeCalendar (#2890)
5 changes: 5 additions & 0 deletions .changeset/rotten-zoos-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/switch": patch
---

Fixed react-hook-form uncontrolled switch component
5 changes: 5 additions & 0 deletions .changeset/swift-trains-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/date-picker": patch
---

keep date picker style consistent for different variants (#2901)
5 changes: 5 additions & 0 deletions .changeset/thick-plants-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/table": patch
---

Add missing export of `TableRowProps` type (#2584)
5 changes: 5 additions & 0 deletions .changeset/witty-birds-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/theme": patch
---

Fixed incorrect margin on labels for RTL required inputs. (#2780)
2 changes: 1 addition & 1 deletion .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ reviews:
drafts: false
base_branches:
- "main"
- "develop"
- "canary"
- "fix/.*"
- "chore/.*"
- "feat/.*"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/QA.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: QA
on:
pull_request:
branches:
- main
- canary

jobs:
build:
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- ".changeset/**"
- "packages/**"
branches:
- main
- canary

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -41,12 +41,21 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create @dev release
- name: Sync files from canary to main branch if a publish happens
if: steps.changesets.outputs.published == 'true'
run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/owner/repo/dispatches \
-d '{"event_type":"sync-canary-to-main"}'
- name: Create canary release
if: steps.changesets.outputs.published != 'true'
run: |
git checkout main
pnpm version:dev
pnpm release:dev
git checkout canary
pnpm version:canary
pnpm release:canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/sync-canary-to-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Sync Canary to Main

on:
# triggered manually in Github
workflow_dispatch:
# triggered by the type "sync-canary-to-main" (e.g. from release action after publishing)
repository_dispatch:
types: [sync-canary-to-main]

jobs:
create_pull_request:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure all history is fetched

- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: "canary"
destination_branch: "main"
pr_title: "Auto-sync Canary to Main"
pr_body: |
## Automated: Sync from Canary to Main
This Pull Request is automatically generated to sync the changes from the Canary branch to the Main branch. Below are the included updates:
### Triggered by a Direct Push to Canary:
- Please check the recent commits on the Canary branch directly as this sync may include multiple changes.
### Triggered by a Pull Request Merge:
- Merged Pull Request: [PR#${{ github.event.pull_request.number }}](${{ github.event.pull_request.html_url }}) - ${{ github.event.pull_request.title }}
- PR Description: ${{ github.event.pull_request.body }}
- Merged by: ${{ github.event.pull_request.merged_by.login }}
### Action Required:
- Please review the changes carefully.
- Approve and merge the Pull Request if everything is in order.
Thank you for maintaining the Main branch updated and clean.
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ https://www.conventionalcommits.org/ or check out the

## Pull Request Guidelines

- The `main` branch is basically a snapshot of the latest stable version. All development must be done in dedicated branches.
- The `main` branch is basically a snapshot of the latest production version. All development must be done in dedicated branches and will be merged to `canary` branch.
- Make sure that Github Actions are green
- It is good to have multiple small commits while working on the PR. We'll let GitHub squash it automatically before the merge.
- If you add a new feature:
Expand All @@ -73,14 +73,14 @@ https://www.conventionalcommits.org/ or check out the

1. Fork of the nextui repository and clone your fork

2. Create a new branch out of the `main` branch. We follow the convention
2. Create a new branch out of the `canary` branch. We follow the convention
`[type/scope]`. For example `fix/dropdown-hook` or `docs/menu-typo`. `type`
can be either `docs`, `fix`, `feat`, `build`, or any other conventional
commit type. `scope` is just a short id that describes the scope of work.

3. Make and commit your changes following the
[commit convention](https://github.com/nextui-org/nextui/blob/main/CONTRIBUTING.md#commit-convention).
As you develop, you can run `pnpm build --filter=<module>` and
As you canary, you can run `pnpm build --filter=<module>` and
`pnpm test packages/<module>/<pkg>` e.g. `pnpm build --filter=avatar & pnpm test packages/components/avatar` to make sure everything works as expected.

> To know more about the `--filter` option, please check the turborepo [docs](https://turborepo.org/docs/core-concepts/filtering).
Expand Down Expand Up @@ -200,9 +200,9 @@ npm run build
6. Send your pull request:

- Send your pull request to the `main` branch
- Send your pull request to the `canary` branch
- Your pull request will be reviewed by the maintainers and the maintainers will decide if it is accepted or not
- Once the pull request is accepted, the maintainers will merge it to the `main` branch
- Once the pull request is accepted, the maintainers will merge it to the `canary` branch

## Visual Changes

Expand Down
20 changes: 20 additions & 0 deletions apps/docs/components/cmdk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ export const Cmdk: FC<{}> = () => {
}
};

const prioritizeFirstLevelItems = (a: SearchResultItem, b: SearchResultItem) => {
if (a.type === "lvl1") {
return -1;
} else if (b.type === "lvl1") {
return 1;
}

return 0;
};

const results = useMemo<SearchResultItem[]>(
function getResults() {
if (query.length < 2) return [];
Expand All @@ -165,12 +175,22 @@ export const Cmdk: FC<{}> = () => {
if (words.length === 1) {
return matchSorter(data, query, {
keys: MATCH_KEYS,
sorter: (matches) => {
matches.sort((a, b) => prioritizeFirstLevelItems(a.item, b.item));

return matches;
},
}).slice(0, MAX_RESULTS);
}

const matchesForEachWord = words.map((word) =>
matchSorter(data, word, {
keys: MATCH_KEYS,
sorter: (matches) => {
matches.sort((a, b) => prioritizeFirstLevelItems(a.item, b.item));

return matches;
},
}),
);

Expand Down
4 changes: 3 additions & 1 deletion apps/docs/components/docs/components/codeblock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ const Codeblock = forwardRef<HTMLPreElement, CodeblockProps>(
style={{
...props.style,
...(highlightStyleToken.some((t) => {
const content = token.content.trim();

const regex = t instanceof RegExp ? t : new RegExp(t);

return regex.test(token.content.trim());
return regex.test(content);
})
? {color: "rgb(var(--code-function))"}
: {}),
Expand Down
8 changes: 4 additions & 4 deletions apps/docs/components/docs/components/import-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ type PackageManager = {
};

const importTabs: PackageManager[] = [
{
key: "main",
name: "Main",
},
{
key: "individual",
name: "Individual",
},
{
key: "main",
name: "Global",
},
];

export interface ImportTabsProps {
Expand Down
93 changes: 53 additions & 40 deletions apps/docs/components/docs/components/package-managers.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import {Tabs, Tab, Snippet} from "@nextui-org/react";
import {Tabs, Tab, Snippet, Code} from "@nextui-org/react";
import {Key, useState} from "react";

import Codeblock from "./codeblock";
import {Blockquote} from "./blockquote";

import {YarnIcon, NpmSmallIcon, PnpmIcon, BunIcon, CLIBoldIcon} from "@/components/icons";

type PackageManagerName = "cli" | "npm" | "yarn" | "pnpm" | "bun";

type PackageManager = {
icon: JSX.Element;
label?: string;
name: PackageManagerName;
label?: string;
};

const packageManagers: PackageManager[] = [
Expand Down Expand Up @@ -39,9 +40,13 @@ const packageManagers: PackageManager[] = [

export interface PackageManagersProps {
commands: Partial<Record<PackageManagerName, React.Key>>;
showGlobalInstallWarning?: boolean;
}

export const PackageManagers = ({commands}: PackageManagersProps) => {
export const PackageManagers = ({
commands,
showGlobalInstallWarning = false,
}: PackageManagersProps) => {
const [selectedManager, setSelectedManager] = useState<PackageManagerName>(
commands.cli ? "cli" : "npm",
);
Expand All @@ -51,44 +56,52 @@ export const PackageManagers = ({commands}: PackageManagersProps) => {
};

return (
<Tabs
aria-label="NextUI installation commands"
classNames={{
base: "group mt-4 min-w-[300px] w-full overflow-x-auto",
tabList: "h-10",
}}
selectedKey={selectedManager}
variant="underlined"
onSelectionChange={handleSelectionChange}
>
{packageManagers.map(({name, label, icon}) => {
if (!commands[name]) return null;
<>
<Tabs
aria-label="NextUI installation commands"
classNames={{
base: "group mt-4 min-w-[300px] w-full overflow-x-auto",
tabList: "h-10",
}}
selectedKey={selectedManager}
variant="underlined"
onSelectionChange={handleSelectionChange}
>
{packageManagers.map(({name, label, icon}) => {
if (!commands[name]) return null;

return (
<Tab
key={name}
title={
<div className="flex items-center space-x-2">
{icon}
<span>{label || name}</span>
</div>
}
>
<Snippet
disableTooltip
fullWidth
hideSymbol
classNames={{
base: "bg-code-background text-code-foreground",
pre: "font-light text-base",
copyButton: "text-lg text-zinc-500 mr-2",
}}
return (
<Tab
key={name}
title={
<div className="flex items-center space-x-2">
{icon}
<span>{label || name}</span>
</div>
}
>
<Codeblock removeIndent codeString={commands[name] as string} language="bash" />
</Snippet>
</Tab>
);
})}
</Tabs>
<Snippet
disableTooltip
fullWidth
hideSymbol
classNames={{
base: "bg-code-background text-code-foreground",
pre: "font-light text-base",
copyButton: "text-lg text-zinc-500 mr-2",
}}
>
<Codeblock removeIndent codeString={commands[name] as string} language="bash" />
</Snippet>
</Tab>
);
})}
</Tabs>
{showGlobalInstallWarning && (
<Blockquote className="my-2">
No need to install this package if <Code>@nextui-org/react</Code> is already installed
globally.
</Blockquote>
)}
</>
);
};

0 comments on commit 0f24d08

Please sign in to comment.