Files
ionic-framework/core/src/components/range/range.native.scss
Pedro Lourenço 175dc929a5 feat(range): adding custom styling for ionic theme (#29979)
Issue number: internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
No ionic theme custom implementation existed for the ion-range
component.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->
- Added ionic theme specific styling (based on the ios styling) for the
range according to UX requirements.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information
<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

![image](https://github.com/user-attachments/assets/1b78cba4-0f0f-45d4-abdc-d48cdb917ea2)
2024-11-05 13:03:11 +00:00

84 lines
2.2 KiB
SCSS

@import "range.common";
@import "../../themes/native/native.globals";
@import "./range.vars.scss";
:host {
--knob-handle-size: calc(var(--knob-size) * 2);
font-family: $font-family-base;
z-index: $z-index-item-input;
}
::slotted(ion-icon[slot]) {
font-size: 24px;
}
::slotted([slot="label"]) {
max-width: 200px;
}
// Range Label Placement - Start
// ----------------------------------------------------------------
:host(.range-label-placement-start) .label-text-wrapper {
/**
* The margin between the label and
* the range should be on the end
* when the label sits at the start.
*/
@include margin(0, $form-control-label-margin, 0, 0);
}
// Range Label Placement - End
// ----------------------------------------------------------------
:host(.range-label-placement-end) .label-text-wrapper {
/**
* The margin between the label and
* the range should be on the start
* when the label sits at the end.
*/
@include margin(0, 0, 0, $form-control-label-margin);
}
// Range Label Placement - Fixed
// ----------------------------------------------------------------
:host(.range-label-placement-fixed) .label-text-wrapper {
/**
* The margin between the label and
* the range should be on the end
* when the label sits at the start.
*/
@include margin(0, $form-control-label-margin, 0, 0);
}
// Range Label Placement - Stacked
// ----------------------------------------------------------------
:host(.range-label-placement-stacked) .label-text-wrapper {
@include transform(scale(#{$form-control-label-stacked-scale}));
/**
* The margin between the label and
* the range should be on the bottom
* when the label sits on top.
*/
@include margin(null, 0, $form-control-label-margin, 0);
/**
* Label text should not extend
* beyond the bounds of the range.
*/
max-width: calc(100% / #{$form-control-label-stacked-scale});
}
:host(.in-item.range-label-placement-stacked) .label-text-wrapper {
@include margin($range-item-label-margin-top, null, $form-control-label-margin, null);
}
:host(.in-item.range-label-placement-stacked) .native-wrapper {
@include margin(null, null, $range-item-label-margin-bottom, null);
}