-
Notifications
You must be signed in to change notification settings - Fork 460
feat: add label support to boolean toggle widgets #7767
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
csongorczezar
wants to merge
25
commits into
main
Choose a base branch
from
feat-widget-label-props
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
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
4fa21b5
feat: add label support to boolean toggle widgets
csongorczezar b16202e
fix: render wrapper dynamically
csongorczezar 5fb3fc5
fix: used generic typing
csongorczezar 795962f
fix: added fallback labels
csongorczezar 035a0f2
feat: add ToggleGroup support for labeled boolean widgets
csongorczezar dd435f8
fix: aligned colors and positions
csongorczezar 0e25a2f
fix: adding i18n keys for the fallback strings
csongorczezar 9614107
fix: disable vue/no-unused-properties for shadcn-vue forwarded props
csongorczezar 81e4f3c
fix: removed unused imports and dependencies
csongorczezar a1d4e62
[automated] Apply ESLint and Prettier fixes
actions-user 5d94466
fix: use cva from catalog instead of class-variance-authority
csongorczezar dbf4a4c
feat: added primary togglegroup buttton styles
csongorczezar c8f52cb
fix: removing unused types
csongorczezar 9bb16f6
[automated] Apply ESLint and Prettier fixes
actions-user d94476a
feat: added secondary and inverted styles
csongorczezar 03186ce
fix: default variant changed and truncation added
csongorczezar e67d1bd
fix: downgrade pinia to 2.2.2 to match main and fix test failures
csongorczezar b6c7770
add conflict metadata to node requirements system
csongorczezar fd60f4e
chore: trigger CI re-run after dependency cleanup
csongorczezar 43fce00
Merge remote-tracking branch 'origin/main' into feat-widget-label-props
csongorczezar b6ef7b8
fix: resolve coding guideline violations
csongorczezar f13e35c
Merge remote-tracking branch 'origin/main' into feat-widget-label-props
csongorczezar e4f87a9
fix: label aligned with button group
csongorczezar c33b30d
chore: merge latest main to sync dependencies
csongorczezar 9592e0b
fix: update pnpm-lock.yaml to match main and resolve knip issues
csongorczezar 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
Some comments aren't visible on the classic Files Changed page.
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,39 @@ | ||
| <script setup lang="ts"> | ||
| /* eslint-disable vue/no-unused-properties */ | ||
| import { reactiveOmit } from '@vueuse/core' | ||
| import type { ToggleGroupRootEmits, ToggleGroupRootProps } from 'reka-ui' | ||
| import { ToggleGroupRoot, useForwardPropsEmits } from 'reka-ui' | ||
| import type { HTMLAttributes } from 'vue' | ||
| import { provide } from 'vue' | ||
|
|
||
| import { cn } from '@/utils/tailwindUtil' | ||
|
|
||
| import { toggleGroupVariants } from './toggleGroup.variants' | ||
| import type { ToggleGroupItemVariants } from './toggleGroup.variants' | ||
|
|
||
| const props = defineProps< | ||
| ToggleGroupRootProps & { | ||
| class?: HTMLAttributes['class'] | ||
| variant?: ToggleGroupItemVariants['variant'] | ||
| } | ||
| >() | ||
| const emits = defineEmits<ToggleGroupRootEmits>() | ||
|
|
||
| provide('toggleGroup', { | ||
| variant: props.variant | ||
| }) | ||
|
|
||
| const delegatedProps = reactiveOmit(props, 'class') | ||
|
|
||
| const forwarded = useForwardPropsEmits(delegatedProps, emits) | ||
| </script> | ||
|
|
||
| <template> | ||
| <ToggleGroupRoot | ||
| v-slot="slotProps" | ||
| v-bind="forwarded" | ||
| :class="cn(toggleGroupVariants(), props.class)" | ||
| > | ||
| <slot v-bind="slotProps" /> | ||
| </ToggleGroupRoot> | ||
| </template> | ||
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 @@ | ||
| <script setup lang="ts"> | ||
| /* eslint-disable vue/no-unused-properties */ | ||
csongorczezar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import { reactiveOmit } from '@vueuse/core' | ||
| import type { ToggleGroupItemProps } from 'reka-ui' | ||
| import { ToggleGroupItem, useForwardProps } from 'reka-ui' | ||
| import type { HTMLAttributes } from 'vue' | ||
| import { inject } from 'vue' | ||
| import { cn } from '@/utils/tailwindUtil' | ||
| import { toggleGroupItemVariants } from './toggleGroup.variants' | ||
| import type { ToggleGroupItemVariants } from './toggleGroup.variants' | ||
| const props = defineProps< | ||
| ToggleGroupItemProps & { | ||
| class?: HTMLAttributes['class'] | ||
| variant?: ToggleGroupItemVariants['variant'] | ||
| } | ||
| >() | ||
| const context = inject<{ variant?: ToggleGroupItemVariants['variant'] }>( | ||
| 'toggleGroup' | ||
| ) | ||
| const delegatedProps = reactiveOmit(props, 'class', 'variant') | ||
| const forwardedProps = useForwardProps(delegatedProps) | ||
| </script> | ||
|
|
||
| <template> | ||
| <ToggleGroupItem | ||
| v-slot="slotProps" | ||
| v-bind="forwardedProps" | ||
| :class=" | ||
| cn( | ||
| toggleGroupItemVariants({ | ||
| variant: context?.variant || variant | ||
| }), | ||
| props.class | ||
| ) | ||
| " | ||
| > | ||
| <span class="truncate min-w-0"> | ||
| <slot v-bind="slotProps" /> | ||
| </span> | ||
| </ToggleGroupItem> | ||
| </template> | ||
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,36 @@ | ||
| import type { VariantProps } from 'cva' | ||
| import { cva } from 'cva' | ||
|
|
||
| export const toggleGroupVariants = cva({ | ||
| base: 'flex gap-[var(--primitive-padding-padding-1,4px)] p-[var(--primitive-padding-padding-1,4px)] rounded-[var(--primitive-border-radius-rounded-sm,4px)] bg-component-node-widget-background' | ||
| }) | ||
|
|
||
| export const toggleGroupItemVariants = cva({ | ||
| base: 'flex-1 inline-flex items-center justify-center border-0 rounded-[var(--primitive-border-radius-rounded-sm,4px)] px-[var(--primitive-padding-padding-2,8px)] py-[var(--primitive-padding-padding-1,4px)] text-xs font-inter font-normal transition-colors cursor-pointer overflow-hidden', | ||
| variants: { | ||
| variant: { | ||
| primary: [ | ||
| 'data-[state=off]:bg-transparent data-[state=off]:text-muted-foreground', | ||
| 'data-[state=off]:hover:bg-component-node-widget-background-hovered data-[state=off]:hover:text-white', | ||
| 'data-[state=on]:bg-primary-background data-[state=on]:text-white' | ||
| ], | ||
| secondary: [ | ||
| 'data-[state=off]:bg-transparent data-[state=off]:text-muted-foreground', | ||
| 'data-[state=off]:hover:bg-component-node-widget-background-hovered data-[state=off]:hover:text-white', | ||
| 'data-[state=on]:bg-component-node-widget-background-selected data-[state=on]:text-base-foreground' | ||
| ], | ||
| inverted: [ | ||
| 'data-[state=off]:bg-transparent data-[state=off]:text-muted-foreground', | ||
| 'data-[state=off]:hover:bg-component-node-widget-background-hovered data-[state=off]:hover:text-white', | ||
| 'data-[state=on]:bg-white data-[state=on]:text-base-background' | ||
| ] | ||
| } | ||
| }, | ||
| defaultVariants: { | ||
| variant: 'secondary' | ||
| } | ||
| }) | ||
|
|
||
| export type ToggleGroupItemVariants = VariantProps< | ||
| typeof toggleGroupItemVariants | ||
| > |
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
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
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.