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

fix(slider): rename highlightPlacement to fillPlacement #9195

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions packages/calcite-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3382,6 +3382,11 @@ export namespace Components {
"label": string;
}
interface CalcitePagination {
/**
* Set a specified page as active.
* @param page
*/
"goTo": (page: number | "start" | "end") => Promise<void>;
/**
* When `true`, number values are displayed with a group separator corresponding to the language and country format.
*/
Expand Down Expand Up @@ -4185,6 +4190,10 @@ export namespace Components {
* When `true`, interaction is prevented and the component is displayed with lower opacity.
*/
"disabled": boolean;
/**
* Used to configure where the fill is placed along the slider track in relation to the value handle. Range mode will always display the fill between the min and max handles.
*/
"fillPlacement": "start" | "none" | "end";
/**
* The `id` of the form that will be associated with the component. When not set, the component will be associated with its ancestor form element, if any.
*/
Expand All @@ -4197,10 +4206,6 @@ export namespace Components {
* When `true`, indicates a histogram is present.
*/
"hasHistogram": boolean;
/**
* Used to configure where the fill is placed along the slider track in relation to the value handle. Range mode will always display the fill between the min and max handles.
*/
"highlightPlacement": "start" | "none" | "end";
/**
* A list of the histogram's x,y coordinates within the component's `min` and `max`. Displays above the component's track.
* @see [DataSeries](https://github.com/Esri/calcite-design-system/blob/main/src/components/graph/interfaces.ts#L5)
Expand Down Expand Up @@ -11765,6 +11770,10 @@ declare namespace LocalJSX {
* When `true`, interaction is prevented and the component is displayed with lower opacity.
*/
"disabled"?: boolean;
/**
* Used to configure where the fill is placed along the slider track in relation to the value handle. Range mode will always display the fill between the min and max handles.
*/
"fillPlacement"?: "start" | "none" | "end";
/**
* The `id` of the form that will be associated with the component. When not set, the component will be associated with its ancestor form element, if any.
*/
Expand All @@ -11777,10 +11786,6 @@ declare namespace LocalJSX {
* When `true`, indicates a histogram is present.
*/
"hasHistogram"?: boolean;
/**
* Used to configure where the fill is placed along the slider track in relation to the value handle. Range mode will always display the fill between the min and max handles.
*/
"highlightPlacement"?: "start" | "none" | "end";
/**
* A list of the histogram's x,y coordinates within the component's `min` and `max`. Displays above the component's track.
* @see [DataSeries](https://github.com/Esri/calcite-design-system/blob/main/src/components/graph/interfaces.ts#L5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ describe("calcite-slider", () => {
propertyName: "hasHistogram",
defaultValue: false,
},
{
propertyName: "fillPlacement",
defaultValue: "start",
},
{
propertyName: "labelFormatter",
defaultValue: undefined,
Expand Down
20 changes: 10 additions & 10 deletions packages/calcite-components/src/components/slider/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ export class Slider
/** When `true`, interaction is prevented and the component is displayed with lower opacity. */
@Prop({ reflect: true }) disabled = false;

/**
* Used to configure where the fill is placed along the slider track in relation to the value handle.
*
* Range mode will always display the fill between the min and max handles.
*/
@Prop({ reflect: true }) fillPlacement: "start" | "none" | "end" = "start";

/**
* The `id` of the form that will be associated with the component.
*
Expand All @@ -92,13 +99,6 @@ export class Slider
/** When `true`, indicates a histogram is present. */
@Prop({ reflect: true, mutable: true }) hasHistogram = false;

/**
* Used to configure where the fill is placed along the slider track in relation to the value handle.
*
* Range mode will always display the fill between the min and max handles.
*/
@Prop({ reflect: true }) highlightPlacement: "start" | "none" | "end" = "start";

/**
* A list of the histogram's x,y coordinates within the component's `min` and `max`. Displays above the component's track.
*
Expand Down Expand Up @@ -296,14 +296,14 @@ export class Slider
mirror,
});

const { highlightPlacement } = this;
const { fillPlacement } = this;
const trackRangePlacementStyles =
highlightPlacement === "none"
fillPlacement === "none"
? {
left: `unset`,
right: `unset`,
}
: highlightPlacement === "end"
: fillPlacement === "end"
? {
left: `${mirror ? minInterval : maxInterval}%`,
right: `${mirror ? maxInterval : minInterval}%`,
Expand Down
Loading