igniteui-webcomponents 3.4.0-beta.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -2
- package/components/slider/range-slider.d.ts +2 -0
- package/components/slider/range-slider.js +61 -0
- package/components/slider/range-slider.js.map +1 -1
- package/components/slider/slider-base.d.ts +7 -7
- package/components/slider/slider-base.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,12 +5,18 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## [3.4.0] - 2022-09-07
|
|
9
|
+
### Added
|
|
10
|
+
- Dialog component [#175](https://github.com/IgniteUI/igniteui-webcomponents/issues/175)
|
|
11
|
+
- Select component [#180](https://github.com/IgniteUI/igniteui-webcomponents/issues/180)
|
|
9
12
|
|
|
10
13
|
### Fixed
|
|
11
|
-
- Chip - made remove button accessible with the keyboard [#480](https://github.com/IgniteUI/igniteui-webcomponents/issues/480)
|
|
12
14
|
- Calendar - range selection a11y improvements [#476](https://github.com/IgniteUI/igniteui-webcomponents/issues/476)
|
|
15
|
+
- Range slider - a11y improvements for choosing range values [#477](https://github.com/IgniteUI/igniteui-webcomponents/issues/477)
|
|
16
|
+
- Rating - improved a11y with assistive software now reading the total number of items [#478](https://github.com/IgniteUI/igniteui-webcomponents/issues/478)
|
|
13
17
|
- Toast - added `role="alert"` to the message container for assistive software to read it without the need of focusing [#479](https://github.com/IgniteUI/igniteui-webcomponents/issues/479)
|
|
18
|
+
- Chip - made remove button accessible with the keyboard [#480](https://github.com/IgniteUI/igniteui-webcomponents/issues/480)
|
|
19
|
+
- Button prefix/suffix does not align icons to the button text [#491](https://github.com/IgniteUI/igniteui-webcomponents/issues/491)
|
|
14
20
|
|
|
15
21
|
## [3.3.1] - 2022-08-10
|
|
16
22
|
### Changed
|
|
@@ -149,6 +155,7 @@ Initial release of Ignite UI Web Components
|
|
|
149
155
|
- Ripple component
|
|
150
156
|
- Switch component
|
|
151
157
|
|
|
158
|
+
[3.4.0]: https://github.com/IgniteUI/igniteui-webcomponents/compare/3.3.1...3.4.0
|
|
152
159
|
[3.3.1]: https://github.com/IgniteUI/igniteui-webcomponents/compare/3.3.0...3.3.1
|
|
153
160
|
[3.3.0]: https://github.com/IgniteUI/igniteui-webcomponents/compare/3.2.0...3.3.0
|
|
154
161
|
[3.2.0]: https://github.com/IgniteUI/igniteui-webcomponents/compare/3.1.0...3.2.0
|
|
@@ -75,6 +75,8 @@ export default class IgcRangeSliderComponent extends IgcRangeSliderComponent_bas
|
|
|
75
75
|
protected emitChangeEvent(): void;
|
|
76
76
|
private swapValues;
|
|
77
77
|
private toggleActiveThumb;
|
|
78
|
+
private handleFocus;
|
|
79
|
+
protected renderThumb(value: number, ariaLabel?: string, thumbId?: string): import("lit-html").TemplateResult<1>;
|
|
78
80
|
protected renderThumbs(): import("lit-html").TemplateResult<1>;
|
|
79
81
|
}
|
|
80
82
|
declare global {
|
|
@@ -6,6 +6,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html } from 'lit';
|
|
8
8
|
import { property, query } from 'lit/decorators.js';
|
|
9
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
9
11
|
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
|
|
10
12
|
import { IgcSliderBaseComponent } from './slider-base.js';
|
|
11
13
|
export default class IgcRangeSliderComponent extends EventEmitterMixin(IgcSliderBaseComponent) {
|
|
@@ -114,6 +116,65 @@ export default class IgcRangeSliderComponent extends EventEmitterMixin(IgcSlider
|
|
|
114
116
|
const thumb = this.activeThumb === this.thumbFrom ? this.thumbTo : this.thumbFrom;
|
|
115
117
|
thumb.focus();
|
|
116
118
|
}
|
|
119
|
+
handleFocus(ev) {
|
|
120
|
+
var _a, _b;
|
|
121
|
+
this.activeThumb = ev.target;
|
|
122
|
+
const thumbId = (_a = this.activeThumb) === null || _a === void 0 ? void 0 : _a.id;
|
|
123
|
+
const thumbs = (_b = this.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelectorAll('div[part="thumb"]');
|
|
124
|
+
thumbs === null || thumbs === void 0 ? void 0 : thumbs.forEach((t) => {
|
|
125
|
+
var _a;
|
|
126
|
+
if (t.id !== thumbId) {
|
|
127
|
+
const activeThumbVal = parseFloat(this.activeThumb.ariaValueNow);
|
|
128
|
+
const thumbVal = parseFloat(t.ariaValueNow);
|
|
129
|
+
const rangeFrom = Math.min(activeThumbVal, thumbVal);
|
|
130
|
+
const rangeTo = Math.max(activeThumbVal, thumbVal);
|
|
131
|
+
(_a = this.activeThumb) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-valuetext', `${this.formatValue(rangeFrom)} - ${this.formatValue(rangeTo)}`);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
renderThumb(value, ariaLabel, thumbId) {
|
|
136
|
+
const percent = `${this.valueToFraction(value) * 100}%`;
|
|
137
|
+
const ariaValueText = thumbId === 'thumbFrom' ? `min ${this.lower}` : `max ${this.upper}`;
|
|
138
|
+
const textValue = this.labels
|
|
139
|
+
? this.labels[value]
|
|
140
|
+
: this.valueFormat || this.valueFormatOptions
|
|
141
|
+
? this.formatValue(value)
|
|
142
|
+
: ariaValueText;
|
|
143
|
+
return html `
|
|
144
|
+
<div
|
|
145
|
+
part="thumb"
|
|
146
|
+
id=${ifDefined(thumbId)}
|
|
147
|
+
tabindex=${this.disabled ? -1 : 0}
|
|
148
|
+
style=${styleMap({ insetInlineStart: percent })}
|
|
149
|
+
role="slider"
|
|
150
|
+
aria-valuemin=${this.actualMin}
|
|
151
|
+
aria-valuemax=${this.actualMax}
|
|
152
|
+
aria-valuenow=${value}
|
|
153
|
+
aria-valuetext=${ifDefined(textValue)}
|
|
154
|
+
aria-label=${ifDefined(ariaLabel)}
|
|
155
|
+
aria-disabled=${this.disabled ? 'true' : 'false'}
|
|
156
|
+
@pointerenter=${this.handleThumbPointerEnter}
|
|
157
|
+
@pointerleave=${this.handleThumbPointerLeave}
|
|
158
|
+
@focus=${(ev) => this.handleFocus(ev)}
|
|
159
|
+
@blur=${() => (this.activeThumb = undefined)}
|
|
160
|
+
></div>
|
|
161
|
+
${this.hideTooltip
|
|
162
|
+
? html ``
|
|
163
|
+
: html `
|
|
164
|
+
<div
|
|
165
|
+
part="thumb-label"
|
|
166
|
+
style=${styleMap({
|
|
167
|
+
opacity: this.thumbLabelsVisible ? '1' : '0',
|
|
168
|
+
insetInlineStart: percent,
|
|
169
|
+
})}
|
|
170
|
+
>
|
|
171
|
+
<div part="thumb-label-inner">
|
|
172
|
+
${this.labels ? this.labels[value] : this.formatValue(value)}
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
`}
|
|
176
|
+
`;
|
|
177
|
+
}
|
|
117
178
|
renderThumbs() {
|
|
118
179
|
return html `${this.renderThumb(this.lower, this.ariaLabelLower, 'thumbFrom')}
|
|
119
180
|
${this.renderThumb(this.upper, this.ariaLabelUpper, 'thumbTo')}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-slider.js","sourceRoot":"","sources":["../../../src/components/slider/range-slider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AA0C1D,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,iBAAiB,CAGpE,sBAAsB,CAAC;IAHzB;;QAY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GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEO,iBAAiB;QACvB,MAAM,KAAK,GACT,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;QACtE,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAEkB,YAAY;QAC7B,OAAO,IAAI,CAAA,GAAG,IAAI,CAAC,WAAW,CAC5B,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,cAAc,EACnB,WAAW,CACZ;MACC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,CAAC;IACnE,CAAC;;AA9JsB,+BAAO,GAAG,kBAAkB,CAAC;AAGpD;IADC,KAAK,CAAC,YAAY,CAAC;0DACY;AAGhC;IADC,KAAK,CAAC,UAAU,CAAC;wDACY;AAe9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAG1B;AAYD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAG1B;AAMD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;+DACb;AAM/B;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;+DACb","sourcesContent":["import { html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { IgcSliderBaseComponent } from './slider-base.js';\n\n/* blazorSuppress */\nexport interface IgcRangeSliderValue {\n lower: number;\n upper: number;\n}\n\nexport interface IgcRangeSliderEventMap {\n /**\n * Emitted when a value is changed via thumb drag or keyboard interaction.\n */\n igcInput: CustomEvent<IgcRangeSliderValue>;\n /**\n * Emitted when a value change is committed on a thumb drag end or keyboard interaction.\n */\n igcChange: CustomEvent<IgcRangeSliderValue>;\n}\n\n/**\n * A range slider component used to select two numeric values within a range.\n *\n * @element igc-range-slider\n *\n * @fires igcInput - Emitted when a value is changed via thumb drag or keyboard interaction.\n * @fires igcChange - Emitted when a value change is committed on a thumb drag end or keyboard interaction.\n *\n * @csspart base - The base wrapper of the slider.\n * @csspart ticks - The ticks container.\n * @csspart tick-group - The tick group container.\n * @csspart tick - The tick element.\n * @csspart tick-label - The tick label element.\n * @csspart tick-label-inner - The inner element of the tick label.\n * @csspart thumbs - The thumbs container.\n * @csspart thumb - The thumb element.\n * @csspart thumb-label - The thumb tooltip label container.\n * @csspart thumb-label-inner - The thumb tooltip label inner element.\n * @csspart track - The track container.\n * @csspart steps - The track steps element.\n * @csspart inactive - The inactive element of the track.\n * @csspart fill - The filled part of the track.\n */\nexport default class IgcRangeSliderComponent extends EventEmitterMixin<\n IgcRangeSliderEventMap,\n Constructor<IgcSliderBaseComponent>\n>(IgcSliderBaseComponent) {\n public static readonly tagName = 'igc-range-slider';\n\n @query(`#thumbFrom`)\n private thumbFrom!: HTMLElement;\n\n @query(`#thumbTo`)\n private thumbTo!: HTMLElement;\n\n private _lower = 0;\n private _upper = 0;\n\n public set lower(val: number) {\n const oldVal = this._lower;\n this._lower = this.validateValue(val);\n this.requestUpdate('lower', oldVal);\n }\n\n /**\n * The current value of the lower thumb.\n */\n @property({ type: Number })\n public get lower() {\n return this._lower;\n }\n\n public set upper(val: number) {\n const oldVal = this._upper;\n this._upper = this.validateValue(val);\n this.requestUpdate('upper', oldVal);\n }\n\n /**\n * The current value of the upper thumb.\n */\n @property({ type: Number })\n public get upper() {\n return this._upper;\n }\n\n /**\n * The aria label of the lower thumb.\n */\n @property({ attribute: 'aria-label-lower' })\n public ariaLabelLower!: string;\n\n /**\n * The aria label of the upper thumb.\n */\n @property({ attribute: 'aria-label-upper' })\n public ariaLabelUpper!: string;\n\n protected override get activeValue(): number {\n return this.activeThumb === this.thumbFrom ? this.lower : this.upper;\n }\n\n protected override normalizeValue(): void {\n this._lower = this.validateValue(this._lower);\n this._upper = this.validateValue(this._upper);\n }\n\n protected override getTrackStyle() {\n const toPosition = this.valueToFraction(this.upper);\n const fromPosition = this.valueToFraction(this.lower);\n const positionGap = toPosition - fromPosition;\n\n const filledTrackStyle = {\n width: `${positionGap * 100}%`,\n insetInlineStart: `${fromPosition * 100}%`,\n };\n\n return filledTrackStyle;\n }\n\n private closestTo(goal: number, positions: number[]): number {\n return positions.reduce((previous, current) =>\n Math.abs(goal - current) < Math.abs(goal - previous) ? current : previous\n );\n }\n\n protected override closestHandle(event: PointerEvent): HTMLElement {\n const fromOffset =\n this.thumbFrom.offsetLeft + this.thumbFrom.offsetWidth / 2;\n const toOffset = this.thumbTo.offsetLeft + this.thumbTo.offsetWidth / 2;\n const xPointer = event.clientX - this.getBoundingClientRect().left;\n const match = this.closestTo(xPointer, [fromOffset, toOffset]);\n\n if (fromOffset === toOffset && toOffset < xPointer) {\n return this.thumbTo;\n } else if (fromOffset === toOffset && toOffset > xPointer) {\n return this.thumbFrom;\n } else if (match === fromOffset) {\n return this.thumbFrom;\n } else {\n return this.thumbTo;\n }\n }\n\n protected override updateValue(increment: number) {\n const oldValue = this.activeValue;\n\n let lower = this.lower;\n let upper = this.upper;\n\n if (this.activeThumb === this.thumbFrom) {\n lower += increment;\n } else {\n upper += increment;\n }\n\n if (lower >= upper) {\n this.swapValues(lower, upper);\n this.toggleActiveThumb();\n } else {\n if (this.activeThumb === this.thumbFrom) {\n this.lower = lower;\n } else {\n this.upper = upper;\n }\n }\n\n if (oldValue === this.activeValue) {\n return false;\n }\n\n this.emitInputEvent();\n return true;\n }\n\n protected override emitInputEvent() {\n this.emitEvent('igcInput', {\n detail: { lower: this.lower, upper: this.upper },\n });\n }\n\n protected override emitChangeEvent() {\n this.emitEvent('igcChange', {\n detail: { lower: this.lower, upper: this.upper },\n });\n }\n\n private swapValues(lower: number, upper: number) {\n this.lower = upper;\n this.upper = lower;\n }\n\n private toggleActiveThumb() {\n const thumb =\n this.activeThumb === this.thumbFrom ? this.thumbTo : this.thumbFrom;\n thumb.focus();\n }\n\n protected override renderThumbs() {\n return html`${this.renderThumb(\n this.lower,\n this.ariaLabelLower,\n 'thumbFrom'\n )}\n ${this.renderThumb(this.upper, this.ariaLabelUpper, 'thumbTo')}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-range-slider': IgcRangeSliderComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"range-slider.js","sourceRoot":"","sources":["../../../src/components/slider/range-slider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AA0C1D,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,iBAAiB,CAGpE,sBAAsB,CAAC;IAHzB;;QAYU,WAAM,GAAG,CAAC,CAAC;QACX,WAAM,GAAG,CAAC,CAAC;IA6NrB,CAAC;IA3NC,IAAW,KAAK,CAAC,GAAW;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAMD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAW,KAAK,CAAC,GAAW;QAC1B,MAAM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AC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,CAAC;IACnE,CAAC;;AArOsB,+BAAO,GAAG,kBAAkB,CAAC;AAGpD;IADC,KAAK,CAAC,YAAY,CAAC;0DACY;AAGhC;IADC,KAAK,CAAC,UAAU,CAAC;wDACY;AAe9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAG1B;AAYD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAG1B;AAMD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;+DACb;AAM/B;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;+DACb","sourcesContent":["import { html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { IgcSliderBaseComponent } from './slider-base.js';\n\n/* blazorSuppress */\nexport interface IgcRangeSliderValue {\n lower: number;\n upper: number;\n}\n\nexport interface IgcRangeSliderEventMap {\n /**\n * Emitted when a value is changed via thumb drag or keyboard interaction.\n */\n igcInput: CustomEvent<IgcRangeSliderValue>;\n /**\n * Emitted when a value change is committed on a thumb drag end or keyboard interaction.\n */\n igcChange: CustomEvent<IgcRangeSliderValue>;\n}\n\n/**\n * A range slider component used to select two numeric values within a range.\n *\n * @element igc-range-slider\n *\n * @fires igcInput - Emitted when a value is changed via thumb drag or keyboard interaction.\n * @fires igcChange - Emitted when a value change is committed on a thumb drag end or keyboard interaction.\n *\n * @csspart base - The base wrapper of the slider.\n * @csspart ticks - The ticks container.\n * @csspart tick-group - The tick group container.\n * @csspart tick - The tick element.\n * @csspart tick-label - The tick label element.\n * @csspart tick-label-inner - The inner element of the tick label.\n * @csspart thumbs - The thumbs container.\n * @csspart thumb - The thumb element.\n * @csspart thumb-label - The thumb tooltip label container.\n * @csspart thumb-label-inner - The thumb tooltip label inner element.\n * @csspart track - The track container.\n * @csspart steps - The track steps element.\n * @csspart inactive - The inactive element of the track.\n * @csspart fill - The filled part of the track.\n */\nexport default class IgcRangeSliderComponent extends EventEmitterMixin<\n IgcRangeSliderEventMap,\n Constructor<IgcSliderBaseComponent>\n>(IgcSliderBaseComponent) {\n public static readonly tagName = 'igc-range-slider';\n\n @query(`#thumbFrom`)\n private thumbFrom!: HTMLElement;\n\n @query(`#thumbTo`)\n private thumbTo!: HTMLElement;\n\n private _lower = 0;\n private _upper = 0;\n\n public set lower(val: number) {\n const oldVal = this._lower;\n this._lower = this.validateValue(val);\n this.requestUpdate('lower', oldVal);\n }\n\n /**\n * The current value of the lower thumb.\n */\n @property({ type: Number })\n public get lower() {\n return this._lower;\n }\n\n public set upper(val: number) {\n const oldVal = this._upper;\n this._upper = this.validateValue(val);\n this.requestUpdate('upper', oldVal);\n }\n\n /**\n * The current value of the upper thumb.\n */\n @property({ type: Number })\n public get upper() {\n return this._upper;\n }\n\n /**\n * The aria label of the lower thumb.\n */\n @property({ attribute: 'aria-label-lower' })\n public ariaLabelLower!: string;\n\n /**\n * The aria label of the upper thumb.\n */\n @property({ attribute: 'aria-label-upper' })\n public ariaLabelUpper!: string;\n\n protected override get activeValue(): number {\n return this.activeThumb === this.thumbFrom ? this.lower : this.upper;\n }\n\n protected override normalizeValue(): void {\n this._lower = this.validateValue(this._lower);\n this._upper = this.validateValue(this._upper);\n }\n\n protected override getTrackStyle() {\n const toPosition = this.valueToFraction(this.upper);\n const fromPosition = this.valueToFraction(this.lower);\n const positionGap = toPosition - fromPosition;\n\n const filledTrackStyle = {\n width: `${positionGap * 100}%`,\n insetInlineStart: `${fromPosition * 100}%`,\n };\n\n return filledTrackStyle;\n }\n\n private closestTo(goal: number, positions: number[]): number {\n return positions.reduce((previous, current) =>\n Math.abs(goal - current) < Math.abs(goal - previous) ? current : previous\n );\n }\n\n protected override closestHandle(event: PointerEvent): HTMLElement {\n const fromOffset =\n this.thumbFrom.offsetLeft + this.thumbFrom.offsetWidth / 2;\n const toOffset = this.thumbTo.offsetLeft + this.thumbTo.offsetWidth / 2;\n const xPointer = event.clientX - this.getBoundingClientRect().left;\n const match = this.closestTo(xPointer, [fromOffset, toOffset]);\n\n if (fromOffset === toOffset && toOffset < xPointer) {\n return this.thumbTo;\n } else if (fromOffset === toOffset && toOffset > xPointer) {\n return this.thumbFrom;\n } else if (match === fromOffset) {\n return this.thumbFrom;\n } else {\n return this.thumbTo;\n }\n }\n\n protected override updateValue(increment: number) {\n const oldValue = this.activeValue;\n\n let lower = this.lower;\n let upper = this.upper;\n\n if (this.activeThumb === this.thumbFrom) {\n lower += increment;\n } else {\n upper += increment;\n }\n\n if (lower >= upper) {\n this.swapValues(lower, upper);\n this.toggleActiveThumb();\n } else {\n if (this.activeThumb === this.thumbFrom) {\n this.lower = lower;\n } else {\n this.upper = upper;\n }\n }\n\n if (oldValue === this.activeValue) {\n return false;\n }\n\n this.emitInputEvent();\n return true;\n }\n\n protected override emitInputEvent() {\n this.emitEvent('igcInput', {\n detail: { lower: this.lower, upper: this.upper },\n });\n }\n\n protected override emitChangeEvent() {\n this.emitEvent('igcChange', {\n detail: { lower: this.lower, upper: this.upper },\n });\n }\n\n private swapValues(lower: number, upper: number) {\n this.lower = upper;\n this.upper = lower;\n }\n\n private toggleActiveThumb() {\n const thumb =\n this.activeThumb === this.thumbFrom ? this.thumbTo : this.thumbFrom;\n thumb.focus();\n }\n\n private handleFocus(ev: Event) {\n this.activeThumb = ev.target as HTMLElement;\n const thumbId = this.activeThumb?.id;\n const thumbs = this.shadowRoot?.querySelectorAll('div[part=\"thumb\"]');\n\n thumbs?.forEach((t) => {\n if (t.id !== thumbId) {\n const activeThumbVal = parseFloat(this.activeThumb!.ariaValueNow!);\n const thumbVal = parseFloat(t.ariaValueNow!);\n const rangeFrom = Math.min(activeThumbVal, thumbVal);\n const rangeTo = Math.max(activeThumbVal, thumbVal);\n\n this.activeThumb?.setAttribute(\n 'aria-valuetext',\n `${this.formatValue(rangeFrom)} - ${this.formatValue(rangeTo)}`\n );\n }\n });\n }\n\n protected override renderThumb(\n value: number,\n ariaLabel?: string,\n thumbId?: string\n ) {\n const percent = `${this.valueToFraction(value) * 100}%`;\n const ariaValueText =\n thumbId === 'thumbFrom' ? `min ${this.lower}` : `max ${this.upper}`;\n\n const textValue = this.labels\n ? this.labels[value]\n : this.valueFormat || this.valueFormatOptions\n ? this.formatValue(value)\n : ariaValueText;\n\n return html`\n <div\n part=\"thumb\"\n id=${ifDefined(thumbId)}\n tabindex=${this.disabled ? -1 : 0}\n style=${styleMap({ insetInlineStart: percent })}\n role=\"slider\"\n aria-valuemin=${this.actualMin}\n aria-valuemax=${this.actualMax}\n aria-valuenow=${value}\n aria-valuetext=${ifDefined(textValue)}\n aria-label=${ifDefined(ariaLabel)}\n aria-disabled=${this.disabled ? 'true' : 'false'}\n @pointerenter=${this.handleThumbPointerEnter}\n @pointerleave=${this.handleThumbPointerLeave}\n @focus=${(ev: Event) => this.handleFocus(ev)}\n @blur=${() => (this.activeThumb = undefined)}\n ></div>\n ${this.hideTooltip\n ? html``\n : html`\n <div\n part=\"thumb-label\"\n style=${styleMap({\n opacity: this.thumbLabelsVisible ? '1' : '0',\n insetInlineStart: percent,\n })}\n >\n <div part=\"thumb-label-inner\">\n ${this.labels ? this.labels[value] : this.formatValue(value)}\n </div>\n </div>\n `}\n `;\n }\n\n protected override renderThumbs() {\n return html`${this.renderThumb(\n this.lower,\n this.ariaLabelLower,\n 'thumbFrom'\n )}\n ${this.renderThumb(this.upper, this.ariaLabelUpper, 'thumbTo')}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-range-slider': IgcRangeSliderComponent;\n }\n}\n"]}
|
|
@@ -13,8 +13,8 @@ export declare class IgcSliderBaseComponent extends LitElement {
|
|
|
13
13
|
private pointerCaptured;
|
|
14
14
|
private thumbHoverTimer;
|
|
15
15
|
protected activeThumb?: HTMLElement;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
protected thumbLabelsVisible: boolean;
|
|
17
|
+
protected labels?: string[];
|
|
18
18
|
set min(value: number);
|
|
19
19
|
/**
|
|
20
20
|
* The minimum value of the slider scale. Defaults to 0.
|
|
@@ -102,10 +102,10 @@ export declare class IgcSliderBaseComponent extends LitElement {
|
|
|
102
102
|
protected renderThumbs(): TemplateResult<1>;
|
|
103
103
|
protected emitInputEvent(): void;
|
|
104
104
|
protected emitChangeEvent(): void;
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
protected get actualMin(): number;
|
|
106
|
+
protected get actualMax(): number;
|
|
107
107
|
protected validateValue(value: number): number;
|
|
108
|
-
|
|
108
|
+
protected formatValue(value: number): string;
|
|
109
109
|
private normalizeByStep;
|
|
110
110
|
protected closestHandle(_event: PointerEvent): HTMLElement;
|
|
111
111
|
private totalTickCount;
|
|
@@ -121,8 +121,8 @@ export declare class IgcSliderBaseComponent extends LitElement {
|
|
|
121
121
|
private pointerMove;
|
|
122
122
|
private lostPointerCapture;
|
|
123
123
|
private handleKeydown;
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
protected handleThumbPointerEnter: () => void;
|
|
125
|
+
protected handleThumbPointerLeave: () => void;
|
|
126
126
|
protected renderTicks(): TemplateResult<1>[];
|
|
127
127
|
protected renderThumb(value: number, ariaLabel?: string, thumbId?: string): TemplateResult<1>;
|
|
128
128
|
private renderSteps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider-base.js","sourceRoot":"","sources":["../../../src/components/slider/slider-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AACvD,OAAO,EACL,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SA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NU,sBAAsB;IAFlC,MAAM,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC/C,gBAAgB;GACJ,sBAAsB,CAimBlC;SAjmBY,sBAAsB","sourcesContent":["import { html, LitElement, TemplateResult } from 'lit';\nimport {\n property,\n query,\n queryAssignedElements,\n state,\n} from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { StyleInfo, styleMap } from 'lit/directives/style-map.js';\nimport { themes } from '../../theming/theming-decorator.js';\nimport { blazorTypeOverride } from '../common/decorators/blazorTypeOverride.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { styles } from './themes/light/slider.base.css.js';\nimport { styles as bootstrap } from './themes/light/slider.bootstrap.css.js';\nimport { styles as fluent } from './themes/light/slider.fluent.css.js';\nimport { styles as indigo } from './themes/light/slider.indigo.css.js';\nimport { styles as material } from './themes/light/slider.material.css.js';\n\nimport { defineComponents } from '../common/definitions/defineComponents.js';\nimport IgcSliderLabelComponent from './slider-label.js';\nimport { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';\nimport { isLTR } from '../common/util.js';\n\ndefineComponents(IgcSliderLabelComponent);\n\n@themes({ material, bootstrap, fluent, indigo })\n@blazorDeepImport\nexport class IgcSliderBaseComponent extends LitElement {\n public static override styles = styles;\n\n @query(`[part='thumb']`)\n protected thumb!: HTMLElement;\n\n @queryAssignedElements({ selector: 'igc-slider-label' })\n private labelElements!: HTMLElement[];\n\n private _lowerBound?: number;\n private _upperBound?: number;\n private _min = 0;\n private _max = 100;\n private _step = 1;\n private startValue?: number;\n private pointerCaptured = false;\n private thumbHoverTimer: any;\n protected activeThumb?: HTMLElement;\n\n @state()\n private thumbLabelsVisible = false;\n\n @state()\n private labels?: string[];\n\n public set min(value: number) {\n if (value < this.max) {\n const oldVal = this._min;\n this._min = this.labels ? 0 : value;\n this.requestUpdate('min', oldVal);\n\n if (typeof this.lowerBound === 'number' && this.lowerBound < value) {\n this.lowerBound = value;\n }\n }\n }\n\n /**\n * The minimum value of the slider scale. Defaults to 0.\n */\n @property({ type: Number })\n public get min() {\n return this._min;\n }\n\n public set max(value: number) {\n if (value > this.min) {\n const oldVal = this._max;\n this._max = this.labels ? this.labels.length - 1 : value;\n this.requestUpdate('max', oldVal);\n\n if (typeof this.upperBound === 'number' && this.upperBound > value) {\n this.upperBound = value;\n }\n }\n }\n\n /**\n * The maximum value of the slider scale. Defaults to 100.\n */\n @property({ type: Number })\n public get max() {\n return this._max;\n }\n\n public set lowerBound(value: number | undefined) {\n const oldVal = this._lowerBound;\n\n if (typeof value === 'number') {\n this._lowerBound = this.valueInRange(value, this.min, this.actualMax);\n } else {\n this._lowerBound = value;\n }\n this.requestUpdate('lowerBound', oldVal);\n }\n\n /**\n * The lower bound of the slider value. If not set, the `min` value is applied.\n */\n @property({ type: Number, attribute: 'lower-bound' })\n public get lowerBound(): number | undefined {\n return this._lowerBound;\n }\n\n public set upperBound(value: number | undefined) {\n const oldVal = this._upperBound;\n\n if (typeof value === 'number') {\n this._upperBound = this.valueInRange(value, this.actualMin, this.max);\n } else {\n this._upperBound = value;\n }\n this.requestUpdate('upperBound', oldVal);\n }\n\n /**\n * The upper bound of the slider value. If not set, the `max` value is applied.\n */\n @property({ type: Number, attribute: 'upper-bound' })\n public get upperBound(): number | undefined {\n return this._upperBound;\n }\n\n /**\n * Disables the UI interactions of the slider.\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * Marks the slider track as discrete so it displays the steps.\n * If the `step` is 0, the slider will remain continuos even if `discreteTrack` is `true`.\n */\n @property({ type: Boolean, attribute: 'discrete-track' })\n public discreteTrack = false;\n\n /**\n * Hides the thumb tooltip.\n */\n @property({ type: Boolean, attribute: 'hide-tooltip' })\n public hideTooltip = false;\n\n public set step(value: number) {\n const oldVal = this._step;\n this._step = this.labels ? 1 : value;\n this.requestUpdate('step', oldVal);\n }\n\n /**\n * Specifies the granularity that the value must adhere to.\n * If set to 0 no stepping is implied and any value in the range is allowed.\n */\n @property({ type: Number })\n public get step() {\n return this._step;\n }\n\n /**\n * The number of primary ticks. It defaults to 0 which means no primary ticks are displayed.\n */\n @property({ type: Number, attribute: 'primary-ticks' })\n public primaryTicks = 0;\n\n /**\n * The number of secondary ticks. It defaults to 0 which means no secondary ticks are displayed.\n */\n @property({ type: Number, attribute: 'secondary-ticks' })\n public secondaryTicks = 0;\n\n /**\n * Changes the orientation of the ticks.\n */\n @property({ attribute: 'tick-orientation' })\n public tickOrientation: 'mirror' | 'start' | 'end' = 'end';\n\n /**\n * Hides the primary tick labels.\n */\n @property({ type: Boolean, attribute: 'hide-primary-labels' })\n public hidePrimaryLabels = false;\n\n /**\n * Hides the secondary tick labels.\n */\n @property({ type: Boolean, attribute: 'hide-secondary-labels' })\n public hideSecondaryLabels = false;\n\n /**\n * The locale used to format the thumb and tick label values in the slider.\n */\n @property()\n public locale = 'en';\n\n /**\n * String format used for the thumb and tick label values in the slider.\n */\n @property({ attribute: 'value-format' })\n public valueFormat?: string;\n\n /**\n * Number format options used for the thumb and tick label values in the slider.\n */\n @property({ attribute: false })\n public valueFormatOptions?: Intl.NumberFormatOptions;\n\n /**\n * The degrees for the rotation of the tick labels. Defaults to 0.\n */\n @property({ type: Number, reflect: true, attribute: 'tick-label-rotation' })\n @blazorTypeOverride('TickLabelRotation', true)\n public tickLabelRotation: 0 | 90 | -90 = 0;\n\n @watch('min', { waitUntilFirstUpdate: true })\n @watch('max', { waitUntilFirstUpdate: true })\n @watch('lowerBound', { waitUntilFirstUpdate: true })\n @watch('upperBound', { waitUntilFirstUpdate: true })\n @watch('step', { waitUntilFirstUpdate: true })\n protected constraintsChange() {\n this.normalizeValue();\n }\n\n @watch('labels')\n protected labelsChange() {\n if (this.labels) {\n this.min = 0;\n this.max = this.labels.length - 1;\n this.step = 1;\n }\n }\n\n constructor() {\n super();\n this.addEventListener('pointerdown', this.pointerDown);\n this.addEventListener('pointermove', this.pointerMove);\n this.addEventListener('lostpointercapture', this.lostPointerCapture);\n this.addEventListener('keydown', this.handleKeydown);\n }\n\n public override connectedCallback() {\n super.connectedCallback();\n this.normalizeValue();\n }\n\n protected handleSlotChange() {\n this.labels =\n this.labelElements && this.labelElements.length\n ? this.labelElements.map((e) => e.textContent as string)\n : undefined;\n }\n\n /* c8 ignore next 3 */\n protected get activeValue() {\n return 0;\n }\n\n /* c8 ignore next */\n protected normalizeValue(): void {}\n\n /* c8 ignore next 3 */\n protected getTrackStyle(): StyleInfo {\n return {};\n }\n\n /* c8 ignore next 3 */\n protected updateValue(_increment: number): boolean {\n return false;\n }\n\n /* c8 ignore next 3 */\n protected renderThumbs(): TemplateResult<1> {\n return html``;\n }\n\n /* c8 ignore next */\n protected emitInputEvent() {}\n\n /* c8 ignore next */\n protected emitChangeEvent() {}\n\n private get actualMin(): number {\n return typeof this.lowerBound === 'number'\n ? (this.lowerBound as number)\n : this.min;\n }\n\n private get actualMax(): number {\n return typeof this.upperBound === 'number'\n ? (this.upperBound as number)\n : this.max;\n }\n\n protected validateValue(value: number) {\n value = this.valueInRange(value, this.actualMin, this.actualMax);\n value = this.normalizeByStep(value);\n\n return value;\n }\n\n private formatValue(value: number) {\n return this.valueFormat\n ? this.valueFormat.replace(\n '{0}',\n value.toLocaleString(this.locale, this.valueFormatOptions)\n )\n : value.toLocaleString(this.locale, this.valueFormatOptions);\n }\n\n private normalizeByStep(value: number) {\n return this.step ? value - ((value - this.actualMin) % this.step) : value;\n }\n\n protected closestHandle(_event: PointerEvent): HTMLElement {\n return this.thumb;\n }\n\n private totalTickCount() {\n const primaryTicks = this.labels\n ? this.primaryTicks > 0\n ? this.labels.length\n : 0\n : this.primaryTicks === 1\n ? 2\n : this.primaryTicks;\n\n return primaryTicks > 0\n ? (primaryTicks - 1) * this.secondaryTicks + primaryTicks\n : this.secondaryTicks > 0\n ? this.secondaryTicks\n : 0;\n }\n\n private tickValue(idx: number) {\n const tickCount = this.totalTickCount();\n const labelStep =\n tickCount > 1\n ? (this.max - this.min) / (tickCount - 1)\n : this.max - this.min;\n const labelVal = labelStep * idx;\n\n return this.min + labelVal;\n }\n\n private isPrimary(idx: number) {\n return this.primaryTicks <= 0\n ? false\n : idx % (this.secondaryTicks + 1) === 0;\n }\n\n private showThumbLabels() {\n if (this.disabled || this.hideTooltip) {\n return;\n }\n\n if (this.thumbHoverTimer) {\n clearTimeout(this.thumbHoverTimer);\n this.thumbHoverTimer = null;\n }\n\n this.thumbLabelsVisible = true;\n }\n\n private hideThumbLabels() {\n if (this.pointerCaptured || !this.thumbLabelsVisible) {\n return;\n }\n\n this.thumbHoverTimer = setTimeout(() => {\n this.thumbLabelsVisible = false;\n }, 750);\n }\n\n private valueInRange(value: number, min = 0, max = 100) {\n return Math.max(Math.min(value, max), min);\n }\n\n protected valueToFraction(value: number) {\n return (value - this.min) / (this.max - this.min);\n }\n\n private calculateTrackUpdate(mouseX: number): number {\n if (!this.activeThumb) {\n return 0;\n }\n\n const thumbBoundaries = this.activeThumb.getBoundingClientRect();\n const thumbCenter = (thumbBoundaries.right - thumbBoundaries.left) / 2;\n const thumbPositionX = thumbBoundaries.left + thumbCenter;\n\n const scale = this.getBoundingClientRect().width / (this.max - this.min);\n const change = isLTR(this)\n ? mouseX - thumbPositionX\n : thumbPositionX - mouseX;\n\n if (this.step) {\n const stepDistance = scale * this.step;\n const stepDistanceCenter = stepDistance / 2;\n\n // If the thumb scale range (slider update) is less than a half step,\n // the position stays the same.\n const scaleXPositive = Math.abs(change);\n if (scaleXPositive < stepDistanceCenter) {\n return 0;\n }\n\n return Math.round(change / stepDistance) * this.step;\n } else {\n return change / scale;\n }\n }\n\n private updateSlider(mouseX: number) {\n if (this.disabled) {\n return;\n }\n\n const increment = this.calculateTrackUpdate(mouseX);\n if (this.activeThumb && increment !== 0) {\n this.updateValue(increment);\n }\n }\n\n private pointerDown = (event: PointerEvent) => {\n const thumb = this.closestHandle(event);\n thumb.focus();\n\n this.startValue = this.activeValue;\n this.updateSlider(event.clientX);\n\n this.setPointerCapture(event.pointerId);\n this.pointerCaptured = true;\n this.showThumbLabels();\n event.preventDefault();\n };\n\n private pointerMove = (event: PointerEvent) => {\n if (this.pointerCaptured) {\n this.updateSlider(event.clientX);\n }\n };\n\n private lostPointerCapture = () => {\n this.pointerCaptured = false;\n this.hideThumbLabels();\n\n if (this.startValue! !== this.activeValue) {\n this.emitChangeEvent();\n }\n this.startValue = undefined;\n };\n\n private handleKeydown = (event: KeyboardEvent) => {\n if (this.disabled) {\n return;\n }\n\n const { key } = event;\n\n let increment = 0;\n const value = this.activeValue;\n const step = this.step ? this.step : 1;\n const ltr = isLTR(this);\n\n switch (key) {\n case 'ArrowLeft':\n increment += ltr ? -step : step;\n break;\n case 'ArrowRight':\n increment += ltr ? step : -step;\n break;\n case 'ArrowUp':\n increment = step;\n break;\n case 'ArrowDown':\n increment = -step;\n break;\n case 'Home':\n increment = this.actualMin - value;\n break;\n case 'End':\n increment = this.actualMax - value;\n break;\n case 'PageUp':\n increment = Math.max((this.actualMax - this.actualMin) / 10, step);\n break;\n case 'PageDown':\n increment = -Math.max((this.actualMax - this.actualMin) / 10, step);\n break;\n default:\n return;\n }\n\n if (increment) {\n const updated = this.updateValue(increment);\n this.showThumbLabels();\n this.hideThumbLabels();\n\n if (updated) {\n this.emitChangeEvent();\n }\n }\n };\n\n private handleThumbPointerEnter = () => {\n this.showThumbLabels();\n };\n\n private handleThumbPointerLeave = () => {\n this.hideThumbLabels();\n };\n\n protected renderTicks() {\n const groups = [];\n for (let i = 0, totalCount = this.totalTickCount(); i < totalCount; i++) {\n const isPrimary = this.isPrimary(i);\n groups.push(html`\n <div part=\"tick-group\">\n <div part=\"tick\" data-primary=${isPrimary}>\n ${(isPrimary ? this.hidePrimaryLabels : this.hideSecondaryLabels)\n ? html``\n : html`\n <div part=\"tick-label\">\n <span part=\"tick-label-inner\">\n ${this.labels\n ? isPrimary\n ? this.labels[\n Math.round(i / (this.secondaryTicks + 1))\n ]\n : ''\n : this.formatValue(this.tickValue(i))}\n </span>\n </div>\n `}\n </div>\n </div>\n `);\n }\n return groups;\n }\n\n protected renderThumb(value: number, ariaLabel?: string, thumbId?: string) {\n const percent = `${this.valueToFraction(value) * 100}%`;\n\n return html`\n <div\n part=\"thumb\"\n id=${ifDefined(thumbId)}\n tabindex=${this.disabled ? -1 : 0}\n style=${styleMap({ insetInlineStart: percent })}\n role=\"slider\"\n aria-valuemin=${this.actualMin}\n aria-valuemax=${this.actualMax}\n aria-valuenow=${value}\n aria-valuetext=${ifDefined(\n this.labels\n ? this.labels[value]\n : this.valueFormat || this.valueFormatOptions\n ? this.formatValue(value)\n : undefined\n )}\n aria-label=${ifDefined(ariaLabel)}\n aria-disabled=${this.disabled ? 'true' : 'false'}\n @pointerenter=${this.handleThumbPointerEnter}\n @pointerleave=${this.handleThumbPointerLeave}\n @focus=${(ev: Event) => (this.activeThumb = ev.target as HTMLElement)}\n @blur=${() => (this.activeThumb = undefined)}\n ></div>\n ${this.hideTooltip\n ? html``\n : html`\n <div\n part=\"thumb-label\"\n style=${styleMap({\n opacity: this.thumbLabelsVisible ? '1' : '0',\n insetInlineStart: percent,\n })}\n >\n <div part=\"thumb-label-inner\">\n ${this.labels ? this.labels[value] : this.formatValue(value)}\n </div>\n </div>\n `}\n `;\n }\n\n private renderSteps() {\n if (!this.discreteTrack || !this.step) {\n return html``;\n }\n\n const trackRange = this.max - this.min;\n const interval = ((100 / (trackRange / this.step)) * 10) / 10;\n\n return html`\n <div part=\"steps\">\n <svg width=\"100%\" height=\"100%\" style=\"display: flex\">\n <line\n x1=\"0\"\n y1=\"1\"\n x2=\"100%\"\n y2=\"1\"\n stroke=\"currentColor\"\n stroke-dasharray=\"0, calc(${interval * Math.sqrt(2)}%)\"\n stroke-linecap=\"round\"\n stroke-width=\"2px\"\n ></line>\n </svg>\n </div>\n `;\n }\n\n protected override render() {\n return html`\n <div part=\"base\">\n ${this.tickOrientation === 'mirror' || this.tickOrientation === 'start'\n ? html`<div part=\"ticks\">${this.renderTicks()}</div>`\n : html``}\n <div part=\"track\">\n <div part=\"inactive\"></div>\n <div part=\"fill\" style=${styleMap(this.getTrackStyle())}></div>\n ${this.renderSteps()}\n </div>\n ${this.tickOrientation !== 'start'\n ? html`<div part=\"ticks\">${this.renderTicks()}</div>`\n : html``}\n <div part=\"thumbs\">${this.renderThumbs()}</div>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"slider-base.js","sourceRoot":"","sources":["../../../src/components/slider/slider-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AACvD,OAAO,EACL,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAa,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,uBAAuB,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,K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AE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;IAC3E,kBAAkB,CAAC,mBAAmB,EAAE,IAAI,CAAC;iEACH;AAO3C;IALC,KAAK,CAAC,KAAK,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;IAC5C,KAAK,CAAC,KAAK,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;IAC5C,KAAK,CAAC,YAAY,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;IACnD,KAAK,CAAC,YAAY,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;IACnD,KAAK,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;+DAG7C;AAGD;IADC,KAAK,CAAC,QAAQ,CAAC;0DAOf;AAhNU,sBAAsB;IAFlC,MAAM,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC/C,gBAAgB;GACJ,sBAAsB,CAimBlC;SAjmBY,sBAAsB","sourcesContent":["import { html, LitElement, TemplateResult } from 'lit';\nimport {\n property,\n query,\n queryAssignedElements,\n state,\n} from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { StyleInfo, styleMap } from 'lit/directives/style-map.js';\nimport { themes } from '../../theming/theming-decorator.js';\nimport { blazorTypeOverride } from '../common/decorators/blazorTypeOverride.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { styles } from './themes/light/slider.base.css.js';\nimport { styles as bootstrap } from './themes/light/slider.bootstrap.css.js';\nimport { styles as fluent } from './themes/light/slider.fluent.css.js';\nimport { styles as indigo } from './themes/light/slider.indigo.css.js';\nimport { styles as material } from './themes/light/slider.material.css.js';\n\nimport { defineComponents } from '../common/definitions/defineComponents.js';\nimport IgcSliderLabelComponent from './slider-label.js';\nimport { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';\nimport { isLTR } from '../common/util.js';\n\ndefineComponents(IgcSliderLabelComponent);\n\n@themes({ material, bootstrap, fluent, indigo })\n@blazorDeepImport\nexport class IgcSliderBaseComponent extends LitElement {\n public static override styles = styles;\n\n @query(`[part='thumb']`)\n protected thumb!: HTMLElement;\n\n @queryAssignedElements({ selector: 'igc-slider-label' })\n private labelElements!: HTMLElement[];\n\n private _lowerBound?: number;\n private _upperBound?: number;\n private _min = 0;\n private _max = 100;\n private _step = 1;\n private startValue?: number;\n private pointerCaptured = false;\n private thumbHoverTimer: any;\n protected activeThumb?: HTMLElement;\n\n @state()\n protected thumbLabelsVisible = false;\n\n @state()\n protected labels?: string[];\n\n public set min(value: number) {\n if (value < this.max) {\n const oldVal = this._min;\n this._min = this.labels ? 0 : value;\n this.requestUpdate('min', oldVal);\n\n if (typeof this.lowerBound === 'number' && this.lowerBound < value) {\n this.lowerBound = value;\n }\n }\n }\n\n /**\n * The minimum value of the slider scale. Defaults to 0.\n */\n @property({ type: Number })\n public get min() {\n return this._min;\n }\n\n public set max(value: number) {\n if (value > this.min) {\n const oldVal = this._max;\n this._max = this.labels ? this.labels.length - 1 : value;\n this.requestUpdate('max', oldVal);\n\n if (typeof this.upperBound === 'number' && this.upperBound > value) {\n this.upperBound = value;\n }\n }\n }\n\n /**\n * The maximum value of the slider scale. Defaults to 100.\n */\n @property({ type: Number })\n public get max() {\n return this._max;\n }\n\n public set lowerBound(value: number | undefined) {\n const oldVal = this._lowerBound;\n\n if (typeof value === 'number') {\n this._lowerBound = this.valueInRange(value, this.min, this.actualMax);\n } else {\n this._lowerBound = value;\n }\n this.requestUpdate('lowerBound', oldVal);\n }\n\n /**\n * The lower bound of the slider value. If not set, the `min` value is applied.\n */\n @property({ type: Number, attribute: 'lower-bound' })\n public get lowerBound(): number | undefined {\n return this._lowerBound;\n }\n\n public set upperBound(value: number | undefined) {\n const oldVal = this._upperBound;\n\n if (typeof value === 'number') {\n this._upperBound = this.valueInRange(value, this.actualMin, this.max);\n } else {\n this._upperBound = value;\n }\n this.requestUpdate('upperBound', oldVal);\n }\n\n /**\n * The upper bound of the slider value. If not set, the `max` value is applied.\n */\n @property({ type: Number, attribute: 'upper-bound' })\n public get upperBound(): number | undefined {\n return this._upperBound;\n }\n\n /**\n * Disables the UI interactions of the slider.\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * Marks the slider track as discrete so it displays the steps.\n * If the `step` is 0, the slider will remain continuos even if `discreteTrack` is `true`.\n */\n @property({ type: Boolean, attribute: 'discrete-track' })\n public discreteTrack = false;\n\n /**\n * Hides the thumb tooltip.\n */\n @property({ type: Boolean, attribute: 'hide-tooltip' })\n public hideTooltip = false;\n\n public set step(value: number) {\n const oldVal = this._step;\n this._step = this.labels ? 1 : value;\n this.requestUpdate('step', oldVal);\n }\n\n /**\n * Specifies the granularity that the value must adhere to.\n * If set to 0 no stepping is implied and any value in the range is allowed.\n */\n @property({ type: Number })\n public get step() {\n return this._step;\n }\n\n /**\n * The number of primary ticks. It defaults to 0 which means no primary ticks are displayed.\n */\n @property({ type: Number, attribute: 'primary-ticks' })\n public primaryTicks = 0;\n\n /**\n * The number of secondary ticks. It defaults to 0 which means no secondary ticks are displayed.\n */\n @property({ type: Number, attribute: 'secondary-ticks' })\n public secondaryTicks = 0;\n\n /**\n * Changes the orientation of the ticks.\n */\n @property({ attribute: 'tick-orientation' })\n public tickOrientation: 'mirror' | 'start' | 'end' = 'end';\n\n /**\n * Hides the primary tick labels.\n */\n @property({ type: Boolean, attribute: 'hide-primary-labels' })\n public hidePrimaryLabels = false;\n\n /**\n * Hides the secondary tick labels.\n */\n @property({ type: Boolean, attribute: 'hide-secondary-labels' })\n public hideSecondaryLabels = false;\n\n /**\n * The locale used to format the thumb and tick label values in the slider.\n */\n @property()\n public locale = 'en';\n\n /**\n * String format used for the thumb and tick label values in the slider.\n */\n @property({ attribute: 'value-format' })\n public valueFormat?: string;\n\n /**\n * Number format options used for the thumb and tick label values in the slider.\n */\n @property({ attribute: false })\n public valueFormatOptions?: Intl.NumberFormatOptions;\n\n /**\n * The degrees for the rotation of the tick labels. Defaults to 0.\n */\n @property({ type: Number, reflect: true, attribute: 'tick-label-rotation' })\n @blazorTypeOverride('TickLabelRotation', true)\n public tickLabelRotation: 0 | 90 | -90 = 0;\n\n @watch('min', { waitUntilFirstUpdate: true })\n @watch('max', { waitUntilFirstUpdate: true })\n @watch('lowerBound', { waitUntilFirstUpdate: true })\n @watch('upperBound', { waitUntilFirstUpdate: true })\n @watch('step', { waitUntilFirstUpdate: true })\n protected constraintsChange() {\n this.normalizeValue();\n }\n\n @watch('labels')\n protected labelsChange() {\n if (this.labels) {\n this.min = 0;\n this.max = this.labels.length - 1;\n this.step = 1;\n }\n }\n\n constructor() {\n super();\n this.addEventListener('pointerdown', this.pointerDown);\n this.addEventListener('pointermove', this.pointerMove);\n this.addEventListener('lostpointercapture', this.lostPointerCapture);\n this.addEventListener('keydown', this.handleKeydown);\n }\n\n public override connectedCallback() {\n super.connectedCallback();\n this.normalizeValue();\n }\n\n protected handleSlotChange() {\n this.labels =\n this.labelElements && this.labelElements.length\n ? this.labelElements.map((e) => e.textContent as string)\n : undefined;\n }\n\n /* c8 ignore next 3 */\n protected get activeValue() {\n return 0;\n }\n\n /* c8 ignore next */\n protected normalizeValue(): void {}\n\n /* c8 ignore next 3 */\n protected getTrackStyle(): StyleInfo {\n return {};\n }\n\n /* c8 ignore next 3 */\n protected updateValue(_increment: number): boolean {\n return false;\n }\n\n /* c8 ignore next 3 */\n protected renderThumbs(): TemplateResult<1> {\n return html``;\n }\n\n /* c8 ignore next */\n protected emitInputEvent() {}\n\n /* c8 ignore next */\n protected emitChangeEvent() {}\n\n protected get actualMin(): number {\n return typeof this.lowerBound === 'number'\n ? (this.lowerBound as number)\n : this.min;\n }\n\n protected get actualMax(): number {\n return typeof this.upperBound === 'number'\n ? (this.upperBound as number)\n : this.max;\n }\n\n protected validateValue(value: number) {\n value = this.valueInRange(value, this.actualMin, this.actualMax);\n value = this.normalizeByStep(value);\n\n return value;\n }\n\n protected formatValue(value: number) {\n return this.valueFormat\n ? this.valueFormat.replace(\n '{0}',\n value.toLocaleString(this.locale, this.valueFormatOptions)\n )\n : value.toLocaleString(this.locale, this.valueFormatOptions);\n }\n\n private normalizeByStep(value: number) {\n return this.step ? value - ((value - this.actualMin) % this.step) : value;\n }\n\n protected closestHandle(_event: PointerEvent): HTMLElement {\n return this.thumb;\n }\n\n private totalTickCount() {\n const primaryTicks = this.labels\n ? this.primaryTicks > 0\n ? this.labels.length\n : 0\n : this.primaryTicks === 1\n ? 2\n : this.primaryTicks;\n\n return primaryTicks > 0\n ? (primaryTicks - 1) * this.secondaryTicks + primaryTicks\n : this.secondaryTicks > 0\n ? this.secondaryTicks\n : 0;\n }\n\n private tickValue(idx: number) {\n const tickCount = this.totalTickCount();\n const labelStep =\n tickCount > 1\n ? (this.max - this.min) / (tickCount - 1)\n : this.max - this.min;\n const labelVal = labelStep * idx;\n\n return this.min + labelVal;\n }\n\n private isPrimary(idx: number) {\n return this.primaryTicks <= 0\n ? false\n : idx % (this.secondaryTicks + 1) === 0;\n }\n\n private showThumbLabels() {\n if (this.disabled || this.hideTooltip) {\n return;\n }\n\n if (this.thumbHoverTimer) {\n clearTimeout(this.thumbHoverTimer);\n this.thumbHoverTimer = null;\n }\n\n this.thumbLabelsVisible = true;\n }\n\n private hideThumbLabels() {\n if (this.pointerCaptured || !this.thumbLabelsVisible) {\n return;\n }\n\n this.thumbHoverTimer = setTimeout(() => {\n this.thumbLabelsVisible = false;\n }, 750);\n }\n\n private valueInRange(value: number, min = 0, max = 100) {\n return Math.max(Math.min(value, max), min);\n }\n\n protected valueToFraction(value: number) {\n return (value - this.min) / (this.max - this.min);\n }\n\n private calculateTrackUpdate(mouseX: number): number {\n if (!this.activeThumb) {\n return 0;\n }\n\n const thumbBoundaries = this.activeThumb.getBoundingClientRect();\n const thumbCenter = (thumbBoundaries.right - thumbBoundaries.left) / 2;\n const thumbPositionX = thumbBoundaries.left + thumbCenter;\n\n const scale = this.getBoundingClientRect().width / (this.max - this.min);\n const change = isLTR(this)\n ? mouseX - thumbPositionX\n : thumbPositionX - mouseX;\n\n if (this.step) {\n const stepDistance = scale * this.step;\n const stepDistanceCenter = stepDistance / 2;\n\n // If the thumb scale range (slider update) is less than a half step,\n // the position stays the same.\n const scaleXPositive = Math.abs(change);\n if (scaleXPositive < stepDistanceCenter) {\n return 0;\n }\n\n return Math.round(change / stepDistance) * this.step;\n } else {\n return change / scale;\n }\n }\n\n private updateSlider(mouseX: number) {\n if (this.disabled) {\n return;\n }\n\n const increment = this.calculateTrackUpdate(mouseX);\n if (this.activeThumb && increment !== 0) {\n this.updateValue(increment);\n }\n }\n\n private pointerDown = (event: PointerEvent) => {\n const thumb = this.closestHandle(event);\n thumb.focus();\n\n this.startValue = this.activeValue;\n this.updateSlider(event.clientX);\n\n this.setPointerCapture(event.pointerId);\n this.pointerCaptured = true;\n this.showThumbLabels();\n event.preventDefault();\n };\n\n private pointerMove = (event: PointerEvent) => {\n if (this.pointerCaptured) {\n this.updateSlider(event.clientX);\n }\n };\n\n private lostPointerCapture = () => {\n this.pointerCaptured = false;\n this.hideThumbLabels();\n\n if (this.startValue! !== this.activeValue) {\n this.emitChangeEvent();\n }\n this.startValue = undefined;\n };\n\n private handleKeydown = (event: KeyboardEvent) => {\n if (this.disabled) {\n return;\n }\n\n const { key } = event;\n\n let increment = 0;\n const value = this.activeValue;\n const step = this.step ? this.step : 1;\n const ltr = isLTR(this);\n\n switch (key) {\n case 'ArrowLeft':\n increment += ltr ? -step : step;\n break;\n case 'ArrowRight':\n increment += ltr ? step : -step;\n break;\n case 'ArrowUp':\n increment = step;\n break;\n case 'ArrowDown':\n increment = -step;\n break;\n case 'Home':\n increment = this.actualMin - value;\n break;\n case 'End':\n increment = this.actualMax - value;\n break;\n case 'PageUp':\n increment = Math.max((this.actualMax - this.actualMin) / 10, step);\n break;\n case 'PageDown':\n increment = -Math.max((this.actualMax - this.actualMin) / 10, step);\n break;\n default:\n return;\n }\n\n if (increment) {\n const updated = this.updateValue(increment);\n this.showThumbLabels();\n this.hideThumbLabels();\n\n if (updated) {\n this.emitChangeEvent();\n }\n }\n };\n\n protected handleThumbPointerEnter = () => {\n this.showThumbLabels();\n };\n\n protected handleThumbPointerLeave = () => {\n this.hideThumbLabels();\n };\n\n protected renderTicks() {\n const groups = [];\n for (let i = 0, totalCount = this.totalTickCount(); i < totalCount; i++) {\n const isPrimary = this.isPrimary(i);\n groups.push(html`\n <div part=\"tick-group\">\n <div part=\"tick\" data-primary=${isPrimary}>\n ${(isPrimary ? this.hidePrimaryLabels : this.hideSecondaryLabels)\n ? html``\n : html`\n <div part=\"tick-label\">\n <span part=\"tick-label-inner\">\n ${this.labels\n ? isPrimary\n ? this.labels[\n Math.round(i / (this.secondaryTicks + 1))\n ]\n : ''\n : this.formatValue(this.tickValue(i))}\n </span>\n </div>\n `}\n </div>\n </div>\n `);\n }\n return groups;\n }\n\n protected renderThumb(value: number, ariaLabel?: string, thumbId?: string) {\n const percent = `${this.valueToFraction(value) * 100}%`;\n\n return html`\n <div\n part=\"thumb\"\n id=${ifDefined(thumbId)}\n tabindex=${this.disabled ? -1 : 0}\n style=${styleMap({ insetInlineStart: percent })}\n role=\"slider\"\n aria-valuemin=${this.actualMin}\n aria-valuemax=${this.actualMax}\n aria-valuenow=${value}\n aria-valuetext=${ifDefined(\n this.labels\n ? this.labels[value]\n : this.valueFormat || this.valueFormatOptions\n ? this.formatValue(value)\n : undefined\n )}\n aria-label=${ifDefined(ariaLabel)}\n aria-disabled=${this.disabled ? 'true' : 'false'}\n @pointerenter=${this.handleThumbPointerEnter}\n @pointerleave=${this.handleThumbPointerLeave}\n @focus=${(ev: Event) => (this.activeThumb = ev.target as HTMLElement)}\n @blur=${() => (this.activeThumb = undefined)}\n ></div>\n ${this.hideTooltip\n ? html``\n : html`\n <div\n part=\"thumb-label\"\n style=${styleMap({\n opacity: this.thumbLabelsVisible ? '1' : '0',\n insetInlineStart: percent,\n })}\n >\n <div part=\"thumb-label-inner\">\n ${this.labels ? this.labels[value] : this.formatValue(value)}\n </div>\n </div>\n `}\n `;\n }\n\n private renderSteps() {\n if (!this.discreteTrack || !this.step) {\n return html``;\n }\n\n const trackRange = this.max - this.min;\n const interval = ((100 / (trackRange / this.step)) * 10) / 10;\n\n return html`\n <div part=\"steps\">\n <svg width=\"100%\" height=\"100%\" style=\"display: flex\">\n <line\n x1=\"0\"\n y1=\"1\"\n x2=\"100%\"\n y2=\"1\"\n stroke=\"currentColor\"\n stroke-dasharray=\"0, calc(${interval * Math.sqrt(2)}%)\"\n stroke-linecap=\"round\"\n stroke-width=\"2px\"\n ></line>\n </svg>\n </div>\n `;\n }\n\n protected override render() {\n return html`\n <div part=\"base\">\n ${this.tickOrientation === 'mirror' || this.tickOrientation === 'start'\n ? html`<div part=\"ticks\">${this.renderTicks()}</div>`\n : html``}\n <div part=\"track\">\n <div part=\"inactive\"></div>\n <div part=\"fill\" style=${styleMap(this.getTrackStyle())}></div>\n ${this.renderSteps()}\n </div>\n ${this.tickOrientation !== 'start'\n ? html`<div part=\"ticks\">${this.renderTicks()}</div>`\n : html``}\n <div part=\"thumbs\">${this.renderThumbs()}</div>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-webcomponents",
|
|
3
|
-
"version": "3.4.0
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.",
|
|
5
5
|
"author": "Infragistics",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|