Skip to content

Conversation

snowystinger
Copy link
Member

@snowystinger snowystinger commented Jul 30, 2024

Closes

Added Taggroup Actions as well, it was pretty quick and small change

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot
Copy link

rspbot commented Aug 1, 2024

@rspbot
Copy link

rspbot commented Aug 1, 2024

@rspbot
Copy link

rspbot commented Aug 1, 2024

@snowystinger snowystinger force-pushed the s2-taggroup-collapse branch from bb3c904 to ced16b3 Compare August 2, 2024 01:33
@rspbot
Copy link

rspbot commented Aug 2, 2024

@rspbot
Copy link

rspbot commented Aug 2, 2024

@rspbot
Copy link

rspbot commented Aug 3, 2024

@snowystinger snowystinger marked this pull request as ready for review August 5, 2024 05:25
@rspbot
Copy link

rspbot commented Aug 5, 2024

@rspbot
Copy link

rspbot commented Aug 5, 2024

@rspbot
Copy link

rspbot commented Aug 6, 2024

@rspbot
Copy link

rspbot commented Aug 6, 2024

Copy link
Member

@reidbarber reidbarber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Behavior looks good to me, but looks like there is a conflict with main.

# Conflicts:
#	packages/@react-spectrum/s2/src/TagGroup.tsx
@rspbot
Copy link

rspbot commented Aug 12, 2024

@rspbot
Copy link

rspbot commented Aug 13, 2024

reidbarber
reidbarber previously approved these changes Aug 13, 2024
Copy link
Member

@reidbarber reidbarber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rspbot
Copy link

rspbot commented Aug 15, 2024

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed that if you expand the taggroup wide enough when there is a max rows set that the "collapse" button and the group action button disappear, digging

EDIT: Ah it makes sense that the collapse/expand button disappear but the group action button shouldn't


return {
visibleTagCount: Math.max(index, 1),
showCollapseButton: index < collection.size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the Collapse/Expand button and the groupAction button are in the same group, this logic makes combined with tagState.visibleTagCount < collection.size means that the groupAction button will be removed along side the collaspe/expand button if all the tags are visible.

Perhaps the group should always be rendered and showActions should instead hide the expand/collapse button from inside the group?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed a fix

@rspbot
Copy link

rspbot commented Aug 15, 2024

@rspbot
Copy link

rspbot commented Aug 15, 2024

@rspbot
Copy link

rspbot commented Aug 15, 2024

@rspbot
Copy link

rspbot commented Aug 15, 2024

@rspbot
Copy link

rspbot commented Aug 15, 2024

ktabors
ktabors previously approved these changes Aug 15, 2024
…up-collapse

# Conflicts:
#	packages/@react-spectrum/s2/src/TagGroup.tsx
@rspbot
Copy link

rspbot commented Aug 15, 2024

@rspbot
Copy link

rspbot commented Aug 15, 2024

@rspbot
Copy link

rspbot commented Aug 15, 2024

## API Changes

@react-spectrum/s2

TagGroup

 TagGroup <T extends {}> {
   UNSAFE_className?: string
   UNSAFE_style?: CSSProperties
   aria-describedby?: string
   aria-details?: string
   aria-label?: string
   aria-labelledby?: string
   children?: ReactNode | (T) => ReactNode
   contextualHelp?: ReactNode
   defaultSelectedKeys?: 'all' | Iterable<Key>
   description?: ReactNode
   disabledKeys?: Iterable<Key>
   disallowEmptySelection?: boolean
   errorMessage?: ReactNode
+  groupActionLabel?: string
   id?: string
   isEmphasized?: boolean
   isInvalid?: boolean
   items?: Iterable<T>
   label?: ReactNode
   labelAlign?: Alignment = 'start'
   labelPosition?: LabelPosition = 'top'
+  maxRows?: number
+  onGroupAction?: () => void
   onRemove?: (Set<Key>) => void
   onSelectionChange?: (Selection) => void
   renderEmptyState?: () => ReactNode
   selectedKeys?: 'all' | Iterable<Key>
   selectionMode?: SelectionMode
   size?: 'S' | 'M' | 'L' = 'M'
   slot?: string | null
   styles?: StylesProp
 }

TagGroupProps

 TagGroupProps <T> {
   UNSAFE_className?: string
   UNSAFE_style?: CSSProperties
   aria-describedby?: string
   aria-details?: string
   aria-label?: string
   aria-labelledby?: string
   children?: ReactNode | (T) => ReactNode
   contextualHelp?: ReactNode
   defaultSelectedKeys?: 'all' | Iterable<Key>
   description?: ReactNode
   disabledKeys?: Iterable<Key>
   disallowEmptySelection?: boolean
   errorMessage?: ReactNode
+  groupActionLabel?: string
   id?: string
   isEmphasized?: boolean
   isInvalid?: boolean
   items?: Iterable<T>
   label?: ReactNode
   labelAlign?: Alignment = 'start'
   labelPosition?: LabelPosition = 'top'
+  maxRows?: number
+  onGroupAction?: () => void
   onRemove?: (Set<Key>) => void
   onSelectionChange?: (Selection) => void
   renderEmptyState?: () => ReactNode
   selectedKeys?: 'all' | Iterable<Key>
   selectionMode?: SelectionMode
   size?: 'S' | 'M' | 'L' = 'M'
   slot?: string | null
   styles?: StylesProp
 }

@devongovett devongovett merged commit 16176b8 into main Aug 15, 2024
29 checks passed
@devongovett devongovett deleted the s2-taggroup-collapse branch August 15, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants