Skip to content
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

Apply form-control variables to create consistent scaling #1950

Merged
merged 17 commits into from
Jul 25, 2024

Conversation

sebnitu
Copy link
Owner

@sebnitu sebnitu commented Jul 25, 2024

What changed?

This PR aligns form-controls sizing and scale by applying from-control variables. This allows form-controls to adjust their size based on the font-size property. This also removes a lot of previously used variables for controlling form-control size such as padding and line-height.

This is achieved by refactoring the css.get function to allow passing undefined properties as long as a fallback is also provided:

// Example usage
font-size: css.get("button", "font-size", css.get("form-control-font-size"));

// CSS output
font-size: var(--vb-button-font-size, var(--vb-form-control-font-size));

In the above example, --vb-button-font-size is not defined, but --vb-form-control-font-size is so it's value will be used while still allowing overriding the value whenever --vb-button-font-size is defined. Applying this methodology to all form-controls also means the size of all form-controls can be set by defining --vb-form-control-font-size.

Lastly, this PR fixes root output issues with the vrembem package and includes missing root exports in both base and utility components. When using vrembem in a Sass environment, it's important to import all base components before running any root css.output() calls. Here's an example of how a manifest might look:

// Import all base vrembem components.
@use "vrembem/base";

// Import all my custom components and project specific styles.
@use "./global";
@use "./my-component";
...

// Finally, run the root import to output all custom properties that have been set.
@use "vrembem/root";

- Adds missing root files to base and utility components.
- Vrembem package now correctly builds all custom properties.
- This refactors the form-control core custom properties.
- Ensures that all 6 form-control components are sized the same.
- Removes unnecessary sizing variables from individual components.
@sebnitu sebnitu marked this pull request as ready for review July 25, 2024 20:36
@sebnitu sebnitu added PR: feat and removed IS: feat labels Jul 25, 2024
@sebnitu sebnitu merged commit 3e6fb68 into next Jul 25, 2024
2 checks passed
@sebnitu sebnitu deleted the next-form-control-scale branch July 25, 2024 22:31
sebnitu added a commit that referenced this pull request Jul 30, 2024
…tyle language (#1961)

This PR is a follow up to #1950 but expands the form-control inheritance to appearance variables. This includes a complete refactor of how form-controls are styled internally and removes a lot of redundancy. 

Form-controls have been setup to more easily be customized coherently using the newly provided `from-control` variables along with component specific custom property override options. Appearance variables are now applied using `hsl` relative values giving much more flexibility with selecting an accent color for form-controls.

**Additional changes**
- The `css` module now allows registering a component in the variables map without explicitly setting any custom properties by running the `css.register("[module-name]")` mixin. This is used to setup component level custom property overrides while only setting form-control custom property values as their defaults.
- Added `loading-spinner` mixing to core and applied it to button component.
- Added `form-control-properties` mixin and apply to button, input and menu components.
- Added `button-base`, `input-base` and `menu-action-base` mixins to help make component styles more readable.
- Created build directory for core component.
@sebnitu sebnitu changed the title Apply form-control variables to create a consistent scaling Apply form-control variables to create consistent scaling Jul 31, 2024
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.

1 participant