-
Notifications
You must be signed in to change notification settings - Fork 4
NRP-3193 Multiselect #124
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
Open
stavros-tomas
wants to merge
51
commits into
main
Choose a base branch
from
NRP-3193-multiselect
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
NRP-3193 Multiselect #124
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
6c31578
chore: add debug-storybook to the list of git ignored files
stavros-tomas 14188f3
chore: pick stories from inside the src folder
stavros-tomas 5181f14
chore: reorder stuff
stavros-tomas 1050fc6
chore: remove whitespace
stavros-tomas 0a775ca
chore: imports
stavros-tomas 23c040b
feat: multiselect label
stavros-tomas a2ede79
feat: multiselect trigger
stavros-tomas b7b71fe
feat: multiselect trigger formatting
stavros-tomas 04082bf
feat: multiselect list item
stavros-tomas 27f3190
feat: multiselect list
stavros-tomas fc25b38
fix: multiselect list and label fixes
stavros-tomas 8586428
feat: multiselect
stavros-tomas 2742f1c
docs: added stories
stavros-tomas 1788c0c
feat: add chromatic
stavros-tomas 5a0af29
fix: action
stavros-tomas 48dd8aa
fix: pr write permission
stavros-tomas 3a7ee14
fix: storybook link
stavros-tomas f0e6ad3
chore: various styles changes
stavros-tomas e514122
chore: remove modal
stavros-tomas ddf7665
feat: introduce rtl and vitest to quui
stavros-tomas 23e8047
test: multiselect
stavros-tomas 199c6b3
ci: run unit tests on new commits
stavros-tomas fb00458
chore: trigger prerelease
stavros-tomas 648c311
chore: pr comment
stavros-tomas 527ccdb
Merge branch 'main' into NRP-3193-multiselect
stavros-tomas aca7484
chore: update pnpm-lock
stavros-tomas 8083151
fix: ci
stavros-tomas 7d05f8a
fix: ci
stavros-tomas e6f62ff
Merge branch 'main' into NRP-3193-multiselect
stavros-tomas 880ca51
Merge branch 'main' into NRP-3193-multiselect
stavros-tomas ee0d2b2
chore: remove release
stavros-tomas 6942e31
Merge branch 'main' into NRP-3193-multiselect
stavros-tomas a1168f0
fix: change the types paths
stavros-tomas f102062
Merge branch 'NRP-3193-multiselect' of github.com:Quantinuum/quantinu…
stavros-tomas 25d8571
fix: widths
stavros-tomas e04f71e
chore: update snapshot
stavros-tomas 35b98fb
feat: client search
stavros-tomas a62f4e7
feat: selected label
stavros-tomas 3f9cc35
fix: paddings
stavros-tomas 21416c0
Merge branch 'main' into NRP-3193-multiselect
stavros-tomas 29d21a3
chore: add tinyexec to trust policy exclude
stavros-tomas 736cfdb
chore: add permission to chromatic for write issues
stavros-tomas d31e505
chore: past gh token
stavros-tomas d4db262
feat: add pnpm cache
stavros-tomas f6faa58
chore: move pnpm
stavros-tomas 49c219a
chore: move storybook container to use omit
stavros-tomas abeae8f
chore: move pnpm
stavros-tomas 173130c
chore: remove package-lock
stavros-tomas f248927
chore: add package-json to git ignore
stavros-tomas d38d8eb
chore: bd radius and spacing
stavros-tomas 8228a38
chore: add muted accent
stavros-tomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Chromatic PR Preview | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| chromatic: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| issues: write | ||
| pull-requests: write | ||
| contents: read | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Enable pnpm via corepack | ||
| uses: pnpm/action-setup@v6 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: "pnpm" | ||
| cache-dependency-path: "pnpm-lock.yaml" | ||
|
|
||
| - run: pnpm i --frozen-lockfile | ||
|
|
||
| - name: Build Storybook | ||
| run: pnpm run build-storybook | ||
|
|
||
| - name: Run Chromatic | ||
| id: chromatic | ||
| uses: chromaui/action@latest | ||
| with: | ||
| projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
| storybookBuildDir: storybook-static | ||
| exitZeroOnChanges: true | ||
|
|
||
| - name: Post Storybook link as PR comment | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| await github.rest.issues.createComment({ | ||
| issue_number: context.issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: `📚 **Storybook Preview**: ${{ steps.chromatic.outputs.storybookUrl }}` | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Enable pnpm via corepack | ||
| run: corepack enable pnpm | ||
|
|
||
| - run: pnpm i --frozen-lockfile | ||
| - run: pnpm run lint | ||
| - run: pnpm test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| node_modules | ||
| .mypy_cache | ||
| .vscode | ||
| build | ||
| dist | ||
| node_modules | ||
| storybook.log | ||
| storybook-static | ||
| .mypy_cache | ||
| .vscode | ||
| debug-storybook.log | ||
| package-lock.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| allowBuilds: | ||
| esbuild: true | ||
| esbuild: false | ||
|
stavros-tomas marked this conversation as resolved.
|
||
| unrs-resolver: false | ||
| minimumReleaseAge: 20160 # 14 days | ||
| minimumReleaseAgeStrict: true | ||
| trustPolicy: no-downgrade | ||
| trustPolicyIgnoreAfter: 43200 # 30 days, See https://pnpm.io/settings#trustpolicyignoreafter | ||
| trustPolicyExclude: | ||
| - "tinyexec@1.2.2" | ||
69 changes: 69 additions & 0 deletions
69
src/custom/multi-select/__snapshots__/multi-select.test.tsx.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
|
||
| exports[`MultiSelect > Props > should render as expected 1`] = ` | ||
| <div | ||
| class="flex flex-col gap-1.5 min-w-52 max-w-3xl w-full" | ||
| > | ||
| <div | ||
| class="" | ||
| > | ||
| <div | ||
| class="flex items-center gap-1.5" | ||
| > | ||
| <label | ||
| class="text-sm font-medium leading-none text-muted-foreground" | ||
| for=":r0:" | ||
| > | ||
| Team Members | ||
| </label> | ||
| </div> | ||
| </div> | ||
| <div | ||
| class="w-full" | ||
| > | ||
| <button | ||
| aria-controls="radix-:r1:" | ||
| aria-describedby=":r0:-message" | ||
| aria-expanded="false" | ||
| aria-haspopup="dialog" | ||
| class="flex min-h-9 w-full items-center gap-2 rounded-md border bg-transparent px-3 py-1.5 text-sm shadow-sm ring-offset-background hover:bg-muted focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 border-input" | ||
| data-state="closed" | ||
| id=":r0:" | ||
| role="combobox" | ||
| type="button" | ||
| > | ||
| <div | ||
| class="flex-1 text-left text-muted-foreground" | ||
| > | ||
| Select members... | ||
| </div> | ||
| <div | ||
| class="ml-auto shrink-0" | ||
| > | ||
| <svg | ||
| class="lucide lucide-chevron-down h-4 w-4 opacity-50" | ||
| fill="none" | ||
| height="24" | ||
| stroke="currentColor" | ||
| stroke-linecap="round" | ||
| stroke-linejoin="round" | ||
| stroke-width="2" | ||
| viewBox="0 0 24 24" | ||
| width="24" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <path | ||
| d="m6 9 6 6 6-6" | ||
| /> | ||
| </svg> | ||
| </div> | ||
| </button> | ||
| <p | ||
| class="text-sm text-muted-foreground" | ||
| id=":r0:-message" | ||
| > | ||
| Choose one or more | ||
| </p> | ||
| </div> | ||
| </div> | ||
| `; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { MultiSelect } from "./multi-select" | ||
| export type { MultiSelectItem, MultiSelectProps } from "./types" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| "use client" | ||
|
|
||
| import { Info } from "lucide-react" | ||
| import { Tooltip, TooltipContent, TooltipTrigger } from "../../shadcn/ui/tooltip" | ||
| import { cn } from "../../utils/cn" | ||
| import type { MultiSelectLabelProps } from "./types" | ||
|
|
||
| export const MultiSelectLabel = ({ | ||
| htmlFor, | ||
| label, | ||
| tooltip, | ||
| position = "top", | ||
| icon: Icon, | ||
| }: MultiSelectLabelProps) => { | ||
| return ( | ||
| <div className={cn("flex items-center gap-1.5", position === "left" && "whitespace-nowrap")}> | ||
| {Icon && <Icon className="h-4 w-4 shrink-0" />} | ||
| <label htmlFor={htmlFor} className="text-sm font-medium leading-none text-muted-foreground"> | ||
| {label} | ||
| </label> | ||
| {tooltip && ( | ||
| <Tooltip> | ||
| <TooltipTrigger asChild> | ||
| <Info className="h-4 w-4 shrink-0 cursor-help text-muted-foreground" /> | ||
| </TooltipTrigger> | ||
| <TooltipContent>{tooltip}</TooltipContent> | ||
| </Tooltip> | ||
| )} | ||
| </div> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { Checkbox } from "../../shadcn/ui/checkbox" | ||
| import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../shadcn/ui/tooltip" | ||
| import { cn } from "../../utils/cn" | ||
|
|
||
| import type { MultiSelectListItemProps } from "./types" | ||
|
|
||
| export const MultiSelectListItem = ({ | ||
| item, | ||
| isSelected, | ||
| isDisabled, | ||
| disabledTooltip, | ||
| renderItem, | ||
| }: MultiSelectListItemProps) => { | ||
| const itemContent = ( | ||
| <div className={cn("flex items-start gap-2 w-full", isDisabled && "opacity-50 cursor-not-allowed")}> | ||
| <Checkbox | ||
| checked={isSelected} | ||
| disabled={isDisabled} | ||
| className="mr-2 shrink-0 mt-0.5 pointer-events-none" | ||
| /> | ||
|
|
||
| <div className="flex flex-wrap items-center gap-2 flex-1"> | ||
| {renderItem ? ( | ||
| renderItem(item) | ||
| ) : ( | ||
| <> | ||
| {item.icon && <item.icon className="h-4 w-4 text-muted-foreground shrink-0" />} | ||
| <span className="text-sm leading-5">{item.label}</span> | ||
| </> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ) | ||
|
|
||
| if (isDisabled) { | ||
| return ( | ||
| <TooltipProvider> | ||
| <Tooltip disableHoverableContent> | ||
| <TooltipTrigger asChild>{itemContent}</TooltipTrigger> | ||
| <TooltipContent align="start">{disabledTooltip}</TooltipContent> | ||
| </Tooltip> | ||
| </TooltipProvider> | ||
| ) | ||
| } | ||
|
|
||
| return itemContent | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.