Skip to content

Conversation

@tenphi
Copy link
Member

@tenphi tenphi commented Sep 2, 2025

Note

Unifies padding and margin style handling with a predictable priority system, removes separate block/inline handlers, and adds comprehensive tests.

  • Styles:
    • Unified handlers: Consolidate logic into src/tasty/styles/padding.ts and src/tasty/styles/margin.ts with support for string | number | boolean across padding*/margin* props.
    • Priority system: Apply styles in order padding|margin < paddingBlock|Inline/marginBlock|Inline < individual sides, including directional values (e.g., "2x top").
    • Expanded parsing: Handle numeric, boolean, negative, multi-value, and auto values; return CSS object consistently.
    • Cleanup: Remove paddingBlock.ts, paddingInline.ts, marginBlock.ts, marginInline.ts and their registrations from predefined.ts.
  • Tests:
    • Add comprehensive unit tests in src/tasty/styles/padding.test.ts and src/tasty/styles/margin.test.ts covering base cases, directional logic, priority overrides, and edge cases.
  • Release:
    • Changeset: @cube-dev/ui-kit patch – improve predictability of padding/margin style application.

Written by Cursor Bugbot for commit c45d10c. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Sep 2, 2025

🦋 Changeset detected

Latest commit: c45d10c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cube-dev/ui-kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Sep 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
cube-ui-kit Ready Ready Preview Comment Oct 7, 2025 1:45pm
cube-ui-kit-cursor Ready Ready Preview Comment Oct 7, 2025 1:45pm

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2025

📦 NPM canary release

Deployed canary version 0.0.0-canary-a00da22.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2025

🏋️ Size limit report

Name Size Passed?
All 299.52 KB (-0.01% 🔽👏) Yes 🎉
Tree shaking (just a Button) 32.07 KB (0% 🟰) Yes 🎉
Tree shaking (just an Icon) 19.39 KB (-0.04% 🔽👏) Yes 🎉

Click here if you want to find out what is changed in this build

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2025

🧪 Storybook is successfully deployed!

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 consolidates padding and margin style utilities by removing separate paddingBlock, paddingInline, marginBlock, and marginInline style modules and integrating their functionality directly into the main padding and margin style functions. This refactoring creates a unified API with proper priority handling for CSS logical properties.

Key changes:

  • Removed dedicated modules for logical padding/margin properties and integrated their functionality into main style functions
  • Implemented a priority system where individual directions override logical properties, which override general padding/margin
  • Added comprehensive test coverage for all padding and margin functionality including edge cases

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/tasty/styles/predefined.ts Removed imports and registrations for dedicated logical property modules
src/tasty/styles/paddingInline.ts Deleted dedicated paddingInline style module
src/tasty/styles/paddingBlock.ts Deleted dedicated paddingBlock style module
src/tasty/styles/padding.ts Refactored to handle all padding properties with priority system and helper functions
src/tasty/styles/padding.test.ts Added comprehensive test coverage for unified padding functionality
src/tasty/styles/marginInline.ts Deleted dedicated marginInline style module
src/tasty/styles/marginBlock.ts Deleted dedicated marginBlock style module
src/tasty/styles/margin.ts Refactored to handle all margin properties with priority system and helper functions
src/tasty/styles/margin.test.ts Added comprehensive test coverage for unified margin functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

cursor[bot]

This comment was marked as outdated.

@tenphi tenphi merged commit 3f8c4b7 into main Oct 7, 2025
14 checks passed
@tenphi tenphi deleted the refactor-padding-margin-styles branch October 7, 2025 13:53
@github-actions github-actions bot mentioned this pull request Oct 7, 2025
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.

2 participants