Skip to content

Conversation

@Agilulfo1820
Copy link
Member

@Agilulfo1820 Agilulfo1820 commented Dec 10, 2025

modal?: {
     ...
        backdropFilter?: string; // Backdrop filter for modal dialog (e.g., "blur(10px)")
        borderRadius?: string; // Modal dialog border radius (e.g., "24px", "1rem") - deprecated, use rounded instead
        rounded?: string | number; // Border radius (Chakra UI rounded prop: "sm", "md", "lg", "xl", "2xl", "3xl", "full", or number)
    };

buttons?: {
        secondaryButton?: {
        ...
            backdropFilter?: string; // Optional backdrop filter (e.g., "blur(10px)")
            rounded?: string | number; // Border radius (Chakra UI rounded prop: "sm", "md", "lg", "xl", "2xl", "3xl", "full", or number)
        };
        primaryButton?: {
...
            backdropFilter?: string; // Optional backdrop filter (e.g., "blur(10px)")
            rounded?: string | number; // Border radius (Chakra UI rounded prop: "sm", "md", "lg", "xl", "2xl", "3xl", "full", or number)
        };
        tertiaryButton?: {
...
            backdropFilter?: string; // Optional backdrop filter (e.g., "blur(10px)")
            rounded?: string | number; // Border radius (Chakra UI rounded prop: "sm", "md", "lg", "xl", "2xl", "3xl", "full", or number)
        };
        loginButton?: {
...
            backdropFilter?: string; // Optional backdrop filter (e.g., "blur(10px)")
            rounded?: string | number; // Border radius (Chakra UI rounded prop: "sm", "md", "lg", "xl", "2xl", "3xl", "full", or number)
        };
        

Summary by CodeRabbit

  • New Features
    • Enhanced modal customization with new rounded corner and backdrop filter styling options
    • Extended button styling configuration with rounded corner and backdrop filter properties
    • Added new theme tokens for improved design flexibility across modal and button components

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 10, 2025

Walkthrough

This pull request extends the theme system to support modal styling configuration and enhances button component styling. Changes include replacing borderRadius with rounded properties, adding backdropFilter support to buttons and modals, introducing modal-specific sizing tokens, and implementing token derivation logic with precedence-based fallbacks for backdrop filters.

Changes

Cohort / File(s) Summary
Button Styling Updates
packages/vechain-kit/src/theme/button.ts
Replaces borderRadius with rounded property across loginIn, vechainKitPrimary, vechainKitSecondary, and vechainKitTertiary button variants, using variant-specific rounded token values as fallback. Adds backdropFilter property sourced from corresponding button-specific tokens to each variant.
Modal Styling Updates
packages/vechain-kit/src/theme/modal.ts
Replaces borderRadius with rounded in the modal dialog variant and introduces nullish coalescing fallback to tokens.borders.radius.modal.
Token System Extensions
packages/vechain-kit/src/theme/tokens.ts
Extends ThemeTokens interface to add backdropFilter and rounded properties to button variants, introduces modal-specific sizing and radius tokens, and expands VechainKitThemeConfig with modal configuration options. Enhances convertThemeConfigToTokens to derive modal tokens with precedence-based backdrop filter selection and implement size-to-rem conversion. Adds customTokens.sizes merging support in mergeTokens.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • tokens.ts requires careful review of the precedence logic for modalBackdropFilter derivation and the new size-to-rem conversion helper
  • Verify that nullish coalescing fallbacks in button and modal variants correctly chain to the expected token values
  • Confirm that the interface extensions to VechainKitThemeConfig for button-specific backdropFilter and rounded properties align with the intended configuration API

Poem

🐰 Modal windows now dress with grace,
With rounded edges, backdrop in place,
Buttons sparkle with filters so fine,
Token chains pull the styling line,
A fuzzy refactor—simply divine! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides code examples and technical details but lacks a proper summary and fails to follow the template structure with missing issue reference and explanation context. Add a concise summary section explaining the purpose of these additions and include a 'Closes #(issue)' reference as specified in the template.
Title check ❓ Inconclusive The title 'feat: added style options' is vague and generic, using non-descriptive language that doesn't convey what specific style options or components are affected by the changes. Revise the title to be more specific, such as 'feat: add modal and button style configuration options' to clearly describe which components are being enhanced.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/more-style

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 42467a0 and 81bce86.

📒 Files selected for processing (1)
  • packages/vechain-kit/src/theme/tokens.ts (13 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/migration-guide-to-v2.mdc)

**/*.{ts,tsx}: In VeChain Kit Version 2, use useThor instead of useConnex for contract interactions
For single contract read operations, use the useCallClause hook with the pattern: import dependencies, define ABI and method as const, create query key function using getCallClauseQueryKeyWithArgs, and wrap with useCallClause including data transformation in the select option
For multiple parallel contract calls, use the executeMultipleClausesCall utility wrapped in a useQuery hook with the pattern: define query key function, use executeMultipleClausesCall in queryFn mapping items to clause objects, and transform results
For transaction building and sending, use the useBuildTransaction hook with a clauseBuilder function that returns an array of clauses with optional comment fields describing the transaction action
Always provide an arguments array for contract calls, even when no parameters are required - use an empty array for parameter-less functions to enable TypeScript type checking
Always conditionally enable queries using the enabled property to prevent unnecessary contract calls, checking for all required parameters: enabled: !!requiredParam && !!otherRequiredParam
Use the select option in useCallClause or transform data in queryFn to handle data transformation, particularly for converting BigInt values to strings and normalizing contract return data
Maintain consistent query key patterns: use getCallClauseQueryKeyWithArgs for contract calls with arguments and getCallClauseQueryKey for calls without arguments to ensure proper caching and invalidation
Use TypeScript as const assertions for method names and as 0x${string}`` assertions for Ethereum addresses to ensure type safety in contract interactions

Files:

  • packages/vechain-kit/src/theme/tokens.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Lint & Build
  • GitHub Check: e2e-test
  • GitHub Check: build-size-check
  • GitHub Check: deploy
🔇 Additional comments (8)
packages/vechain-kit/src/theme/tokens.ts (8)

43-66: LGTM! Well-structured type additions.

The new backdropFilter and rounded properties are properly typed as optional and consistently applied across all button variants. The JSDoc comments clearly explain the expected values.


102-107: LGTM! Dual modal radius tokens support backward compatibility.

The addition of both borders.radius.modal and modal.rounded provides flexibility for consumers, with the newer modal.rounded property offering Chakra UI rounded prop support while maintaining the traditional border radius path.


124-157: LGTM! Clear deprecation path and consistent API.

The deprecation of modal.borderRadius in favor of modal.rounded is well-documented, and the addition of per-button backdropFilter and rounded properties provides granular styling control. The Chakra UI rounded prop values are clearly documented in comments.


318-456: LGTM! Button derivation functions correctly propagate new properties.

All button derivation functions consistently handle the new backdropFilter and rounded properties, properly propagating them from custom configurations to the token objects.


595-600: LGTM! Sensible default values.

The default modal radius of "24px" and undefined modal.rounded provide reasonable defaults while allowing configuration overrides.

Also applies to: 688-693


945-948: LGTM! Modal token initialization ensures consistent structure.

Creating the tokens.modal object unconditionally ensures consumers can safely access this property even when no custom rounded value is provided.


972-978: LGTM! Clear precedence chain for modal backdropFilter.

The priority chain (modal-specific → effects config → glass settings → default) provides sensible fallback behavior and allows configuration at multiple levels of specificity.


1044-1053: LGTM! Consistent backdropFilter handling in else branch.

Properly respects config.modal?.backdropFilter even when no effects configuration is provided, maintaining consistent behavior across code paths.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
packages/vechain-kit/src/theme/tokens.ts (2)

28-39: Regex may not match all valid CSS size formats.

The regex ^\d+(\.\d+)?(rem|px|%|em|vw|vh|ch|ex)$/i requires a numeric prefix, which misses valid CSS values like calc(...), CSS variables (var(--width)), and unitless 0. Consider expanding to handle these cases or pass through unrecognized patterns as-is (which the fallback already does).

Current fallback behavior returns the original value if not matched, which is acceptable. However, the comment suggests it validates CSS sizes, which may mislead developers.

 function convertChakraSizeToRem(size: string | undefined): string | undefined {
     if (!size) return undefined;
 
-    // If it's already a valid CSS size (contains rem, px, %, em, vw, vh, etc.), return as-is
-    if (/^\d+(\.\d+)?(rem|px|%|em|vw|vh|ch|ex)$/i.test(size.trim())) {
+    // If it looks like a CSS length value (number with unit, calc, var, etc.), return as-is
+    const trimmed = size.trim();
+    if (/^\d+(\.\d+)?(rem|px|%|em|vw|vh|ch|ex)$/i.test(trimmed) ||
+        trimmed.startsWith('calc(') ||
+        trimmed.startsWith('var(') ||
+        trimmed === '0') {
         return size;
     }

162-166: Consider using JSDoc @deprecated for better IDE support.

The deprecation notice in the inline comment won't trigger IDE warnings. Adding a proper JSDoc annotation would improve developer experience.

     modal?: {
         backgroundColor?: string; // Base background color for modal (used to derive card, stickyHeader, etc. via opacity)
         border?: string; // Full CSS border string for modal dialog (e.g., "1px solid rgba(255, 255, 255, 0.1)")
         backdropFilter?: string; // Backdrop filter for modal dialog (e.g., "blur(10px)")
         width?: string; // Modal dialog width (e.g., "22rem", "400px")
+        /** @deprecated Use `rounded` instead */
         borderRadius?: string; // Modal dialog border radius (e.g., "24px", "1rem") - deprecated, use rounded instead
         rounded?: string | number; // Border radius (Chakra UI rounded prop: "sm", "md", "lg", "xl", "2xl", "3xl", "full", or number)
     };
packages/vechain-kit/src/components/common/BaseModal.tsx (1)

43-55: Duplicate useVechainKitThemeConfig() call.

The hook is called twice (lines 43 and 50). Consolidate into a single destructuring call for cleaner code and to avoid redundant hook invocations.

     const [isDesktop] = useMediaQuery('(min-width: 768px)');
-    const { portalRootRef } = useVechainKitThemeConfig();
+    const { portalRootRef, tokens } = useVechainKitThemeConfig();
 
     // Use semantic tokens for modal and overlay colors
     const modalBg = useToken('colors', 'vechain-kit-modal');
     const overlayBg = useToken('colors', 'vechain-kit-overlay');
 
     // Get backdrop filter and modal width from tokens context
-    const { tokens } = useVechainKitThemeConfig();
     const defaultBackdropFilter = tokens?.effects?.backdropFilter?.overlay;
packages/vechain-kit/src/utils/cssVariables.ts (2)

55-65: Token-driven modal width for DAppKit looks good; consider a defensive fallback

Using tokens.sizes.modal for --vdk-modal-width is a nice move toward fully tokenized sizing and keeps DAppKit aligned with the theme system.

If there’s any chance a consumer can omit sizes.modal in a custom theme, you may want a small fallback to avoid undefined leaking into CSS:

-        '--vdk-modal-width': tokens.sizes.modal,
+        '--vdk-modal-width': tokens.sizes.modal ?? '22rem',

If ThemeTokens guarantees sizes.modal is always set, then the current version is fine.


273-325: Privy modal modalWidth wiring is sound; minor behavior nuance worth noting

The new modalWidth?: string parameter and conditional CSS block correctly:

  • Keep the function signature backward compatible (optional param added last).
  • Scope width/max-width only to the content element ([data-privy-dialog-content], .privy-dialog-content).
  • Avoid injecting CSS when modalWidth is falsy.

Two optional considerations:

  1. Style clearing semantics – If applyPrivyCSSVariables is later called without modalWidth (and without other style args), cssRules.length will be 0, so styleElement.textContent is not updated and old width rules remain. That’s pre-existing behavior for other options, but now it also affects modal width; if you ever need to “reset” to Privy defaults, you might want:

    if (cssRules.length > 0) {
        styleElement.textContent = cssRules.join('\n');
  • } else {
  •  styleElement.textContent = '';
    
    }
    
    
  1. Consistency with DAppKit – Ensure the caller passes the same source (e.g., tokens.sizes.modal) here so Privy and DAppKit modals stay visually aligned in width.

Otherwise, the implementation looks solid.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between deac832 and 42467a0.

📒 Files selected for processing (6)
  • packages/vechain-kit/src/components/common/BaseModal.tsx (1 hunks)
  • packages/vechain-kit/src/providers/VeChainKitProvider.tsx (1 hunks)
  • packages/vechain-kit/src/theme/button.ts (4 hunks)
  • packages/vechain-kit/src/theme/modal.ts (1 hunks)
  • packages/vechain-kit/src/theme/tokens.ts (16 hunks)
  • packages/vechain-kit/src/utils/cssVariables.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/migration-guide-to-v2.mdc)

**/*.{ts,tsx}: In VeChain Kit Version 2, use useThor instead of useConnex for contract interactions
For single contract read operations, use the useCallClause hook with the pattern: import dependencies, define ABI and method as const, create query key function using getCallClauseQueryKeyWithArgs, and wrap with useCallClause including data transformation in the select option
For multiple parallel contract calls, use the executeMultipleClausesCall utility wrapped in a useQuery hook with the pattern: define query key function, use executeMultipleClausesCall in queryFn mapping items to clause objects, and transform results
For transaction building and sending, use the useBuildTransaction hook with a clauseBuilder function that returns an array of clauses with optional comment fields describing the transaction action
Always provide an arguments array for contract calls, even when no parameters are required - use an empty array for parameter-less functions to enable TypeScript type checking
Always conditionally enable queries using the enabled property to prevent unnecessary contract calls, checking for all required parameters: enabled: !!requiredParam && !!otherRequiredParam
Use the select option in useCallClause or transform data in queryFn to handle data transformation, particularly for converting BigInt values to strings and normalizing contract return data
Maintain consistent query key patterns: use getCallClauseQueryKeyWithArgs for contract calls with arguments and getCallClauseQueryKey for calls without arguments to ensure proper caching and invalidation
Use TypeScript as const assertions for method names and as 0x${string}`` assertions for Ethereum addresses to ensure type safety in contract interactions

Files:

  • packages/vechain-kit/src/components/common/BaseModal.tsx
  • packages/vechain-kit/src/providers/VeChainKitProvider.tsx
  • packages/vechain-kit/src/utils/cssVariables.ts
  • packages/vechain-kit/src/theme/button.ts
  • packages/vechain-kit/src/theme/modal.ts
  • packages/vechain-kit/src/theme/tokens.ts
🧬 Code graph analysis (1)
packages/vechain-kit/src/components/common/BaseModal.tsx (1)
packages/vechain-kit/src/providers/VechainKitThemeProvider.tsx (1)
  • useVechainKitThemeConfig (190-198)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Lint & Build
  • GitHub Check: e2e-test
  • GitHub Check: build-size-check
  • GitHub Check: deploy
🔇 Additional comments (7)
packages/vechain-kit/src/theme/tokens.ts (2)

976-995: LGTM! Good backward compatibility pattern.

The nullish coalescing with config.modal?.rounded ?? config.modal?.borderRadius properly handles the deprecation while maintaining backward compatibility. The number-to-pixel conversion is also correctly implemented.


1177-1183: LGTM! Modal width conversion handles edge cases.

The conversion logic correctly uses convertChakraSizeToRem with a fallback to default tokens, ensuring a valid width is always provided.

packages/vechain-kit/src/theme/modal.ts (1)

15-15: LGTM! Proper Chakra UI rounded prop usage with fallback.

The change from borderRadius to rounded aligns with Chakra UI's preferred prop naming, and the nullish coalescing fallback ensures backward compatibility when tokens.modal.rounded is undefined.

packages/vechain-kit/src/providers/VeChainKitProvider.tsx (1)

612-621: LGTM! Proper propagation of modal width token.

The modal width token is correctly passed to applyPrivyCSSVariables and included in the dependency array, ensuring Privy modals update when the theme changes.

packages/vechain-kit/src/components/common/BaseModal.tsx (1)

57-70: LGTM! Modal width application logic is sound.

The conditional logic correctly applies width constraints only when a custom modalWidth is defined, preserving existing behavior otherwise. Setting both width and maxW ensures consistent sizing.

packages/vechain-kit/src/theme/button.ts (2)

19-21: LGTM! Consistent token-driven styling.

The rounded property with nullish coalescing fallback and optional backdropFilter follow a consistent pattern. Chakra UI gracefully handles undefined values for both properties.


71-155: LGTM! All button variants consistently updated.

The vechainKitPrimary, vechainKitSecondary, and vechainKitTertiary variants all follow the same pattern for rounded (with fallback) and backdropFilter (optional). This maintains consistency across the button system.

@github-actions
Copy link

github-actions bot commented Dec 10, 2025

Size Change: -59.2 kB (-1.08%)

Total Size: 5.4 MB

Filename Size Change
packages/vechain-kit/dist/index--hSO7Xv4.d.mts 0 B -5.63 kB (removed) 🏆
packages/vechain-kit/dist/index--hSO7Xv4.d.mts.map 0 B -2.99 kB (removed) 🏆
packages/vechain-kit/dist/index-BD-k_dLp.d.cts 0 B -144 kB (removed) 🏆
packages/vechain-kit/dist/index-BD-k_dLp.d.cts.map 0 B -41.1 kB (removed) 🏆
packages/vechain-kit/dist/index-I8fe7GR2.d.cts 0 B -5.63 kB (removed) 🏆
packages/vechain-kit/dist/index-I8fe7GR2.d.cts.map 0 B -2.99 kB (removed) 🏆
packages/vechain-kit/dist/index-Yl0_Bg1q.d.mts 0 B -144 kB (removed) 🏆
packages/vechain-kit/dist/index-Yl0_Bg1q.d.mts.map 0 B -41.1 kB (removed) 🏆
packages/vechain-kit/dist/index.cjs 572 kB -5.03 kB (-0.87%)
packages/vechain-kit/dist/index.cjs.map 1.73 MB -26.1 kB (-1.48%)
packages/vechain-kit/dist/index.mjs 538 kB -4.88 kB (-0.9%)
packages/vechain-kit/dist/index.mjs.map 1.68 MB -25.9 kB (-1.52%)
packages/vechain-kit/dist/index-BQ0ary2b.d.mts 5.63 kB +5.63 kB (new file) 🆕
packages/vechain-kit/dist/index-BQ0ary2b.d.mts.map 2.99 kB +2.99 kB (new file) 🆕
packages/vechain-kit/dist/index-CygMY-s8.d.mts 145 kB +145 kB (new file) 🆕
packages/vechain-kit/dist/index-CygMY-s8.d.mts.map 41.9 kB +41.9 kB (new file) 🆕
packages/vechain-kit/dist/index-D0cyivl4.d.cts 5.63 kB +5.63 kB (new file) 🆕
packages/vechain-kit/dist/index-D0cyivl4.d.cts.map 2.99 kB +2.99 kB (new file) 🆕
packages/vechain-kit/dist/index-HLGzf4yQ.d.cts 145 kB +145 kB (new file) 🆕
packages/vechain-kit/dist/index-HLGzf4yQ.d.cts.map 41.9 kB +41.9 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
packages/vechain-kit/dist/assets 4.1 kB
packages/vechain-kit/dist/assets-aAdDxPJu.mjs 50.1 kB
packages/vechain-kit/dist/assets-aAdDxPJu.mjs.map 70.2 kB
packages/vechain-kit/dist/assets-DXVXPy3w.cjs 54.8 kB
packages/vechain-kit/dist/assets-DXVXPy3w.cjs.map 71.6 kB
packages/vechain-kit/dist/assets/index.cjs 716 B
packages/vechain-kit/dist/assets/index.d.cts 973 B
packages/vechain-kit/dist/assets/index.d.mts 973 B
packages/vechain-kit/dist/assets/index.mjs 718 B
packages/vechain-kit/dist/index.d.cts 20.1 kB
packages/vechain-kit/dist/index.d.mts 20.1 kB
packages/vechain-kit/dist/utils 4.1 kB
packages/vechain-kit/dist/utils-Bl-JeVTg.cjs 26.2 kB
packages/vechain-kit/dist/utils-Bl-JeVTg.cjs.map 63 kB
packages/vechain-kit/dist/utils-DAs6kMGs.mjs 21.1 kB
packages/vechain-kit/dist/utils-DAs6kMGs.mjs.map 62.7 kB
packages/vechain-kit/dist/utils/index.cjs 1.91 kB
packages/vechain-kit/dist/utils/index.d.cts 2.94 kB
packages/vechain-kit/dist/utils/index.d.mts 2.94 kB
packages/vechain-kit/dist/utils/index.mjs 1.93 kB

compressed-size-action

tokens.colors.warning = defaultTokens.colors.warning;
}

// Handle modal border radius (support both borderRadius for backward compatibility and rounded)

Choose a reason for hiding this comment

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

New modal border-radius/backdropFilter handling added in convertThemeConfigToTokens increases module responsibilities and further enlarges an already-large tokens.ts, making the file harder to maintain.

Details

✨ AI Reasoning
​​1) The file defines ThemeTokens types, default token constants, numerous derive/merge/convert functions, and now additional modal/border-radius and backdropFilter handling spread across the file (new code blocks around lines 43, 924, and 972–990).
​2) The added modal/borders/backdropFilter logic increases the file's responsibilities and surface area, mixing type definitions, defaults, parsing utilities, and complex config-to-token conversion in a single large module, which harms navigability and maintainability.
​3) The violation is true because the PR introduced substantive new features and branching logic (modal radius handling and backdropFilter precedence) that further enlarge this already-large file and would benefit from splitting into smaller focused modules (e.g., button token extensions, modal/token conversion, and effects/backdrop handling).

🔧 How do I fix it?
Split large files into smaller, focused modules. Each file should have a single responsibility.

More info - Comment @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.

@Agilulfo1820 Agilulfo1820 merged commit 9698924 into main Dec 11, 2025
8 checks passed
@Agilulfo1820 Agilulfo1820 deleted the feat/more-style branch December 11, 2025 08:04
This was referenced Dec 12, 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