Skip to content

Conversation

@gdostie
Copy link
Collaborator

@gdostie gdostie commented Dec 31, 2025

Proposed Changes

This pull request updates the Collection component in the Mantine package to improve its flexibility and simplify its usage, especially in Storybook stories. The main changes include making the newItem and allowAdd props more flexible, updating the logic for adding new items, and refactoring the Storybook stories for better maintainability and demonstration.

Component API improvements:

  • The newItem prop in CollectionProps now accepts either a value or a function that returns a value, allowing for dynamic creation of new items.
  • The allowAdd prop in CollectionProps can now be a boolean or a function, providing more control over when items can be added.
  • The logic for adding new items in the Collection component was updated to support the new newItem signature, ensuring correct item creation at runtime.

Styling update:

  • The .item class in the Collection.module.css file now uses flex-wrap: nowrap; to prevent items from wrapping, improving layout consistency.

Storybook refactor and simplification:

  • The Storybook stories for Collection were refactored to use a simplified demo with dynamic item creation, removal of unused imports, and a new placeholder item component, making the stories easier to maintain and understand.

Potential Breaking Changes

Acceptance Criteria

  • The proposed changes are covered by unit tests
  • The potential breaking changes are clearly identified
  • README.md is adjusted to reflect the proposed changes (if relevant)

@github-actions
Copy link

@github-actions
Copy link

@gdostie gdostie marked this pull request as ready for review December 31, 2025 18:47
@gdostie gdostie requested a review from a team as a code owner December 31, 2025 18:47
@gdostie gdostie requested review from FelixBlaisThon and GermainBergeron and removed request for a team December 31, 2025 18:47
@gdostie gdostie force-pushed the DS-31-collection branch 2 times, most recently from d6cf7a3 to 3498637 Compare December 31, 2025 19:10
Base automatically changed from DS-41-connect-TextInput to master January 5, 2026 20:14
Copilot AI review requested due to automatic review settings January 6, 2026 16:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the Collection component to provide more flexibility in creating new items and controlling when items can be added. The changes include making the newItem prop accept either a static value or a function for dynamic item generation, extending allowAdd to accept boolean values in addition to functions, and refactoring the Storybook stories for better demonstration and maintainability.

Key changes:

  • Enhanced newItem prop to support both static values and factory functions for dynamic item creation
  • Extended allowAdd prop to accept boolean values for simpler enable/disable logic
  • Refactored Storybook stories to use a simplified demo with dynamic item generation

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
packages/mantine/src/components/Collection/Collection.tsx Enhanced newItem and allowAdd props to support additional type signatures, updated item creation logic, repositioned error display
packages/mantine/src/components/Collection/Collection.module.css Added flex-wrap: nowrap to prevent item wrapping
packages/storybook/src/form/Collection.stories.tsx Simplified stories by replacing complex form examples with a minimal demo using placeholder items
packages/figma/src/Collection.figma.tsx Updated Figma code connect configuration with proper prop mappings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

refactor(figma): remove CodeConnectBS in Collection
Copy link
Contributor

Copilot AI commented Jan 6, 2026

@gdostie I've opened a new pull request, #4281, to work on those changes. Once the pull request is ready, I'll request review from you.

@gdostie gdostie merged commit 38fbf50 into master Jan 6, 2026
9 checks passed
@gdostie gdostie deleted the DS-31-collection branch January 6, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants