igniteui-webcomponents 2.0.0-beta.0 → 2.0.0-beta.1
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 +5 -0
- package/components/avatar/avatar.d.ts +1 -3
- package/components/avatar/avatar.js.map +1 -1
- package/components/badge/badge.d.ts +1 -3
- package/components/badge/badge.js.map +1 -1
- package/components/button/button-base.d.ts +0 -6
- package/components/button/button-base.js.map +1 -1
- package/components/button/button.d.ts +1 -5
- package/components/button/button.js.map +1 -1
- package/components/button/icon-button.d.ts +1 -3
- package/components/button/icon-button.js.map +1 -1
- package/components/calendar/calendar.d.ts +1 -5
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/days-view/days-view.d.ts +1 -4
- package/components/calendar/days-view/days-view.js.map +1 -1
- package/components/calendar/months-view/months-view.d.ts +1 -4
- package/components/calendar/months-view/months-view.js.map +1 -1
- package/components/calendar/years-view/years-view.d.ts +0 -3
- package/components/calendar/years-view/years-view.js.map +1 -1
- package/components/card/card.actions.d.ts +1 -3
- package/components/card/card.actions.js.map +1 -1
- package/components/card/card.content.d.ts +1 -3
- package/components/card/card.content.js.map +1 -1
- package/components/card/card.d.ts +1 -3
- package/components/card/card.header.d.ts +1 -3
- package/components/card/card.header.js.map +1 -1
- package/components/card/card.js.map +1 -1
- package/components/card/card.media.d.ts +1 -3
- package/components/card/card.media.js.map +1 -1
- package/components/checkbox/checkbox-base.js.map +1 -1
- package/components/checkbox/checkbox.d.ts +1 -3
- package/components/checkbox/checkbox.js.map +1 -1
- package/components/checkbox/switch.d.ts +1 -3
- package/components/checkbox/switch.js.map +1 -1
- package/components/common/mixins/event-emitter.js.map +1 -1
- package/components/form/form.d.ts +1 -5
- package/components/form/form.js.map +1 -1
- package/components/icon/icon.d.ts +1 -5
- package/components/icon/icon.js.map +1 -1
- package/components/input/input.d.ts +1 -4
- package/components/input/input.js +3 -3
- package/components/input/input.js.map +1 -1
- package/components/list/list-header.d.ts +1 -3
- package/components/list/list-header.js.map +1 -1
- package/components/list/list-item.d.ts +1 -3
- package/components/list/list-item.js.map +1 -1
- package/components/list/list.d.ts +1 -3
- package/components/list/list.js.map +1 -1
- package/components/nav-drawer/nav-drawer-header-item.d.ts +1 -3
- package/components/nav-drawer/nav-drawer-header-item.js.map +1 -1
- package/components/nav-drawer/nav-drawer-item.d.ts +1 -3
- package/components/nav-drawer/nav-drawer-item.js +2 -2
- package/components/nav-drawer/nav-drawer-item.js.map +1 -1
- package/components/nav-drawer/nav-drawer.d.ts +2 -20
- package/components/nav-drawer/nav-drawer.js +1 -34
- package/components/nav-drawer/nav-drawer.js.map +1 -1
- package/components/navbar/navbar.d.ts +1 -3
- package/components/navbar/navbar.js.map +1 -1
- package/components/radio/radio.d.ts +4 -3
- package/components/radio/radio.js +15 -1
- package/components/radio/radio.js.map +1 -1
- package/components/radio-group/radio-group.d.ts +3 -5
- package/components/radio-group/radio-group.js +21 -7
- package/components/radio-group/radio-group.js.map +1 -1
- package/components/ripple/ripple.d.ts +1 -3
- package/components/ripple/ripple.js.map +1 -1
- package/components/slider/range-slider.d.ts +1 -2
- package/components/slider/range-slider.js.map +1 -1
- package/components/slider/slider-base.d.ts +0 -1
- package/components/slider/slider-base.js +14 -14
- package/components/slider/slider-base.js.map +1 -1
- package/components/slider/slider.d.ts +1 -2
- package/components/slider/slider.js.map +1 -1
- package/components/slider/slider.material.css.js +1 -1
- package/components/slider/slider.material.css.js.map +1 -1
- package/custom-elements.json +321 -27
- package/index.d.ts +2 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/vscode-html-custom-data.json +43 -54
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
export default class IgcRadioGroupComponent extends LitElement {
|
|
3
|
-
|
|
4
|
-
static tagName: string;
|
|
5
|
-
/** @private */
|
|
3
|
+
static readonly tagName = "igc-radio-group";
|
|
6
4
|
static styles: import("lit").CSSResult;
|
|
7
|
-
private
|
|
8
|
-
private get radios();
|
|
5
|
+
private radios;
|
|
9
6
|
private get isLTR();
|
|
10
7
|
constructor();
|
|
11
8
|
alignment: 'vertical' | 'horizontal';
|
|
9
|
+
private updateRequiredState;
|
|
12
10
|
private handleKeydown;
|
|
13
11
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
14
12
|
}
|
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { html, LitElement } from 'lit';
|
|
8
|
-
import { property,
|
|
8
|
+
import { property, queryAssignedElements } from 'lit/decorators.js';
|
|
9
9
|
import { styles } from './radio-group.material.css';
|
|
10
10
|
export default class IgcRadioGroupComponent extends LitElement {
|
|
11
11
|
constructor() {
|
|
@@ -40,23 +40,37 @@ export default class IgcRadioGroupComponent extends LitElement {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
this.addEventListener('keydown', this.handleKeydown);
|
|
43
|
-
|
|
44
|
-
get radios() {
|
|
45
|
-
return Array.from(this._slottedRadios).filter((radio) => !radio.disabled);
|
|
43
|
+
this.addEventListener('igcChange', this.updateRequiredState);
|
|
46
44
|
}
|
|
47
45
|
get isLTR() {
|
|
48
46
|
const styles = window.getComputedStyle(this);
|
|
49
47
|
return styles.getPropertyValue('direction') === 'ltr';
|
|
50
48
|
}
|
|
49
|
+
updateRequiredState() {
|
|
50
|
+
const hasRequired = this.radios.some((r) => r.required);
|
|
51
|
+
if (hasRequired) {
|
|
52
|
+
this.radios.forEach((r) => (r.required = false));
|
|
53
|
+
const hasChecked = this.radios.some((r) => r.checked);
|
|
54
|
+
if (hasChecked) {
|
|
55
|
+
this.radios.filter((r) => r.checked)[0].required = true;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.radios[0].required = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
51
62
|
render() {
|
|
52
|
-
return html `<slot></slot>`;
|
|
63
|
+
return html `<slot @slotchange=${this.updateRequiredState}></slot>`;
|
|
53
64
|
}
|
|
54
65
|
}
|
|
55
66
|
IgcRadioGroupComponent.tagName = 'igc-radio-group';
|
|
56
67
|
IgcRadioGroupComponent.styles = styles;
|
|
57
68
|
__decorate([
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
queryAssignedElements({
|
|
70
|
+
flatten: true,
|
|
71
|
+
selector: 'igc-radio:not([disabled])',
|
|
72
|
+
})
|
|
73
|
+
], IgcRadioGroupComponent.prototype, "radios", void 0);
|
|
60
74
|
__decorate([
|
|
61
75
|
property({ reflect: true })
|
|
62
76
|
], IgcRadioGroupComponent.prototype, "alignment", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../src/components/radio-group/radio-group.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../src/components/radio-group/radio-group.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU;IAgB5D;QACE,KAAK,EAAE,CAAC;QAMH,cAAS,GAA8B,UAAU,CAAC;QAkBjD,kBAAa,GAAG,CAAC,KAAoB,EAAE,EAAE;YAC/C,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;YAEtB,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,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E,OAAO,EAAE,IAAI,EAAE,CAAC;yDAC6B","sourcesContent":["import { html, LitElement } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport { default as IgcRadioComponent } from '../radio/radio';\nimport { styles } from './radio-group.material.css';\n\nexport default class IgcRadioGroupComponent extends LitElement {\n public static readonly tagName = 'igc-radio-group';\n\n public static override styles = styles;\n\n @queryAssignedElements({\n flatten: true,\n selector: 'igc-radio:not([disabled])',\n })\n private radios!: Array<IgcRadioComponent>;\n\n private get isLTR(): boolean {\n const styles = window.getComputedStyle(this);\n return styles.getPropertyValue('direction') === 'ltr';\n }\n\n constructor() {\n super();\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('igcChange', this.updateRequiredState);\n }\n\n @property({ reflect: true })\n public alignment: 'vertical' | 'horizontal' = 'vertical';\n\n private updateRequiredState() {\n const hasRequired = this.radios.some((r) => r.required);\n\n if (hasRequired) {\n this.radios.forEach((r) => (r.required = false));\n\n const hasChecked = this.radios.some((r) => r.checked);\n\n if (hasChecked) {\n this.radios.filter((r) => r.checked)[0].required = true;\n } else {\n this.radios[0].required = true;\n }\n }\n }\n\n private handleKeydown = (event: KeyboardEvent) => {\n const { key } = event;\n\n if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) {\n const checked = this.radios.find((radio) => radio.checked);\n let index = this.radios.indexOf(checked!);\n\n switch (key) {\n case 'ArrowUp':\n index += -1;\n break;\n case 'ArrowLeft':\n index += this.isLTR ? -1 : 1;\n break;\n case 'ArrowRight':\n index += this.isLTR ? 1 : -1;\n break;\n default:\n index += 1;\n }\n\n if (index < 0) index = this.radios.length - 1;\n if (index > this.radios.length - 1) index = 0;\n\n this.radios.forEach((radio) => (radio.checked = false));\n this.radios[index].focus();\n this.radios[index].checked = true;\n\n event.preventDefault();\n }\n };\n\n protected override render() {\n return html`<slot @slotchange=${this.updateRequiredState}></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-radio-group': IgcRadioGroupComponent;\n }\n}\n"]}
|
|
@@ -6,9 +6,7 @@ import { LitElement } from 'lit';
|
|
|
6
6
|
* @element igc-ripple
|
|
7
7
|
*/
|
|
8
8
|
export default class IgcRippleComponent extends LitElement {
|
|
9
|
-
|
|
10
|
-
static tagName: string;
|
|
11
|
-
/** @private */
|
|
9
|
+
static readonly tagName = "igc-ripple";
|
|
12
10
|
static styles: import("lit").CSSResult;
|
|
13
11
|
constructor();
|
|
14
12
|
private handler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ripple.js","sourceRoot":"","sources":["../../../src/components/ripple/ripple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAQ/C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;
|
|
1
|
+
{"version":3,"file":"ripple.js","sourceRoot":"","sources":["../../../src/components/ripple/ripple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAQ/C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IAKxD;QACE,KAAK,EAAE,CAAC;QAIF,YAAO,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAc,EAAE,EAAE;;YACrD,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC/C,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEnE,MAAM,MAAM,GAAiC;gBAC3C,QAAQ,EAAE,UAAU;gBACpB,OAAO,EAAE,OAAO;gBAChB,aAAa,EAAE,MAAM;gBACrB,eAAe,EAAE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AI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC;QAC9C,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA,aAAa,CAAC;IAC3B,CAAC;;AAtDsB,0BAAO,GAAG,YAAY,CAAC;AAEvB,yBAAM,GAAG,MAAM,CAAC","sourcesContent":["import { html, LitElement } from 'lit';\nimport { styles } from './ripple.material.css';\n\n/**\n * A ripple can be applied to an element to represent\n * interactive surface.\n *\n * @element igc-ripple\n */\nexport default class IgcRippleComponent extends LitElement {\n public static readonly tagName = 'igc-ripple';\n\n public static override styles = styles;\n\n constructor() {\n super();\n this.addEventListener('mousedown', this.handler);\n }\n\n private handler = ({ clientX, clientY }: MouseEvent) => {\n const element = document.createElement('span');\n const { radius, top, left } = this.getDimensions(clientX, clientY);\n\n const styles: Partial<CSSStyleDeclaration> = {\n position: 'absolute',\n display: 'block',\n pointerEvents: 'none',\n transformOrigin: 'center',\n transform: `translate3d(0, 0, 0) scale(0)`,\n willChange: 'opacity, transform',\n margin: `0 !important`,\n border: 'none !important',\n width: `${radius}px`,\n height: `${radius}px`,\n borderRadius: '50%',\n top: `${top}px`,\n left: `${left}px`,\n background: 'var(--color, hsl(var(--igc-gray-800)))',\n };\n const frames: Keyframe[] = [\n { opacity: 0.5, transform: 'scale(.3)' },\n { opacity: 0, transform: 'scale(2)' },\n ];\n const opts: KeyframeAnimationOptions = {\n duration: 600, // --igc-ripple-duration,\n fill: 'forwards',\n easing: 'linear', // --igc-ripple-easing\n };\n\n Object.assign(element.style, styles);\n this.shadowRoot?.appendChild(element);\n element.animate(frames, opts).finished.then(() => element.remove());\n };\n\n private getDimensions(x: number, y: number) {\n const { width, height, left, top } = this.getBoundingClientRect();\n const radius = Math.max(width, height);\n const _left = Math.round(x - left - radius / 2);\n const _top = Math.round(y - top - radius / 2);\n return { radius, top: _top, left: _left };\n }\n\n protected override render() {\n return html`<div></div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-ripple': IgcRippleComponent;\n }\n}\n"]}
|
|
@@ -38,8 +38,7 @@ declare const IgcRangeSliderComponent_base: Constructor<import("../common/mixins
|
|
|
38
38
|
* @csspart fill - The filled part of the track.
|
|
39
39
|
*/
|
|
40
40
|
export default class IgcRangeSliderComponent extends IgcRangeSliderComponent_base {
|
|
41
|
-
|
|
42
|
-
static tagName: string;
|
|
41
|
+
static readonly tagName = "igc-range-slider";
|
|
43
42
|
private thumbFrom;
|
|
44
43
|
private thumbTo;
|
|
45
44
|
private _lower;
|
|
@@ -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,gCAAgC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAwCvD,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,iBAAiB,CAGpE,sBAAsB,CAAC;IAHzB;;QAaU,WAAM,GAAG,CAAC,CAAC;QACX,WAAM,GAAG,CAAC,CAAC;IAsJrB,CAAC;IApJC,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,CA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,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;;AA9Ja,+BAAO,GAAG,kBAAkB,CAAC;AAG3C;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';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter';\nimport { IgcSliderBaseComponent } from './slider-base';\n\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.\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 /** @private */\n public static 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 get activeValue(): number {\n return this.activeThumb === this.thumbFrom ? this.lower : this.upper;\n }\n\n protected normalizeValue(): void {\n this._lower = this.validateValue(this._lower);\n this._upper = this.validateValue(this._upper);\n }\n\n protected 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 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 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 emitInputEvent() {\n this.emitEvent('igcInput', {\n detail: { lower: this.lower, upper: this.upper },\n });\n }\n\n protected 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 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","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,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';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter';\nimport { IgcSliderBaseComponent } from './slider-base';\n\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.\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,7 +1,6 @@
|
|
|
1
1
|
import { LitElement, TemplateResult } from 'lit';
|
|
2
2
|
import { StyleInfo } from 'lit/directives/style-map.js';
|
|
3
3
|
export declare class IgcSliderBaseComponent extends LitElement {
|
|
4
|
-
/** @private */
|
|
5
4
|
static styles: import("lit").CSSResult[];
|
|
6
5
|
protected thumb: HTMLElement;
|
|
7
6
|
private _lowerBound?;
|
|
@@ -312,19 +312,6 @@ export class IgcSliderBaseComponent extends LitElement {
|
|
|
312
312
|
renderThumb(value, ariaLabel, thumbId) {
|
|
313
313
|
const percent = `${this.valueToFraction(value) * 100}%`;
|
|
314
314
|
return html `
|
|
315
|
-
${this.hideTooltip
|
|
316
|
-
? html ``
|
|
317
|
-
: html `
|
|
318
|
-
<div
|
|
319
|
-
part="thumb-label"
|
|
320
|
-
style=${styleMap({
|
|
321
|
-
opacity: this.thumbLabelsVisible ? '1' : '0',
|
|
322
|
-
insetInlineStart: percent,
|
|
323
|
-
})}
|
|
324
|
-
>
|
|
325
|
-
${this.labelFormatter ? this.labelFormatter(value) : value}
|
|
326
|
-
</div>
|
|
327
|
-
`}
|
|
328
315
|
<div
|
|
329
316
|
part="thumb"
|
|
330
317
|
id=${ifDefined(thumbId)}
|
|
@@ -342,6 +329,19 @@ export class IgcSliderBaseComponent extends LitElement {
|
|
|
342
329
|
@focus=${(ev) => (this.activeThumb = ev.target)}
|
|
343
330
|
@blur=${() => (this.activeThumb = undefined)}
|
|
344
331
|
></div>
|
|
332
|
+
${this.hideTooltip
|
|
333
|
+
? html ``
|
|
334
|
+
: html `
|
|
335
|
+
<div
|
|
336
|
+
part="thumb-label"
|
|
337
|
+
style=${styleMap({
|
|
338
|
+
opacity: this.thumbLabelsVisible ? '1' : '0',
|
|
339
|
+
insetInlineStart: percent,
|
|
340
|
+
})}
|
|
341
|
+
>
|
|
342
|
+
${this.labelFormatter ? this.labelFormatter(value) : value}
|
|
343
|
+
</div>
|
|
344
|
+
`}
|
|
345
345
|
`;
|
|
346
346
|
}
|
|
347
347
|
renderSteps() {
|
|
@@ -374,8 +374,8 @@ export class IgcSliderBaseComponent extends LitElement {
|
|
|
374
374
|
? html `<div part="ticks">${this.renderTicks()}</div>`
|
|
375
375
|
: html ``}
|
|
376
376
|
<div part="track">
|
|
377
|
-
<div part="fill" style=${styleMap(this.getTrackStyle())}></div>
|
|
378
377
|
<div part="inactive"></div>
|
|
378
|
+
<div part="fill" style=${styleMap(this.getTrackStyle())}></div>
|
|
379
379
|
${this.renderSteps()}
|
|
380
380
|
</div>
|
|
381
381
|
${this.tickOrientation !== 'start'
|
|
@@ -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,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAA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from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { StyleInfo, styleMap } from 'lit/directives/style-map.js';\nimport { watch } from '../common/decorators';\nimport { styles } from './slider.material.css';\n\nexport class IgcSliderBaseComponent extends LitElement {\n /** @private */\n public static styles = [styles];\n\n @query(`[part='thumb']`)\n protected thumb!: HTMLElement;\n\n private _lowerBound?: number;\n private _upperBound?: number;\n private _min = 0;\n private _max = 100;\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 public set min(value: number) {\n if (value < this.max) {\n const oldVal = this._min;\n this._min = 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 = 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 /**\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 step = 1;\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 * Specifies a custom function to format the labels.\n */\n @property({ attribute: false })\n public labelFormatter: ((value: number) => string) | undefined;\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 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 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 connectedCallback() {\n super.connectedCallback();\n this.normalizeValue();\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 private get isLTR(): boolean {\n const styles = window.getComputedStyle(this);\n return styles.getPropertyValue('direction') === 'ltr';\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 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 if (this.primaryTicks === 1) {\n this.primaryTicks = 2;\n }\n\n return this.primaryTicks > 0\n ? (this.primaryTicks - 1) * this.secondaryTicks + this.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 = this.isLTR\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\n switch (key) {\n case 'ArrowLeft':\n increment += this.isLTR ? -step : step;\n break;\n case 'ArrowRight':\n increment += this.isLTR ? 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.labelFormatter\n ? this.labelFormatter(this.tickValue(i))\n : 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 ${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 ${this.labelFormatter ? this.labelFormatter(value) : value}\n </div>\n `}\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.labelFormatter ? this.labelFormatter(value) : 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 `;\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=\"1.5px, calc(${interval * Math.sqrt(2)}% - 1.5px)\"\n stroke-linecap=\"round\"\n stroke-width=\"2px\"\n ></line>\n </svg>\n </div>\n `;\n }\n\n protected 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=\"fill\" style=${styleMap(this.getTrackStyle())}></div>\n <div part=\"inactive\"></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 </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,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAa,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,MAAM,OAAO,sBAAuB,SAAQ,UAAU;IA6KpD;QACE,KAAK,EAAE,CAAC;QAtKF,SAAI,GAAG,CAAC,CAAC;QACT,SAAI,GAAG,GAAG,CAAC;QAEX,oBAAe,GAAG,KAAK,CAAC;QAKxB,uBAAkB,GAAG,KAAK,CAAC;QAoF5B,aAAQ,GAAG,KAAK,CAAC;QAOjB,kBAAa,GAAG,KAAK,CAAC;QAMtB,gBAAW,GAAG,KAAK,CAAC;QAOpB,SAAI,GAAG,CAAC,CAAC;QAMT,iBAAY,GAAG,CAAC,CAAC;QAMjB,mBAAc,GAAG,CAAC,CAAC;QAMnB,oBAAe,GAA+B,KAAK,CAAC;QAMpD,sBAAiB,GAAG,KAAK,CAAC;QAM1B,wBAAmB,GAAG,KAAK,CAAC;QAY5B,sBAAiB,GAAiB,CAAC,CAAC;QA2LnC,gBAAW,GAAG,CAAC,KAAmB,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACxC,KAAK,CAAC,KAAK,EAAE,CAAC;YAEd,IAAI,CAAC,UAAU,GAAG,IAA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AK,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","sourcesContent":["import { html, LitElement, TemplateResult } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { StyleInfo, styleMap } from 'lit/directives/style-map.js';\nimport { watch } from '../common/decorators';\nimport { styles } from './slider.material.css';\n\nexport class IgcSliderBaseComponent extends LitElement {\n public static override styles = [styles];\n\n @query(`[part='thumb']`)\n protected thumb!: HTMLElement;\n\n private _lowerBound?: number;\n private _upperBound?: number;\n private _min = 0;\n private _max = 100;\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 public set min(value: number) {\n if (value < this.max) {\n const oldVal = this._min;\n this._min = 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 = 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 /**\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 step = 1;\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 * Specifies a custom function to format the labels.\n */\n @property({ attribute: false })\n public labelFormatter: ((value: number) => string) | undefined;\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 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 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 /* 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 private get isLTR(): boolean {\n const styles = window.getComputedStyle(this);\n return styles.getPropertyValue('direction') === 'ltr';\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 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 if (this.primaryTicks === 1) {\n this.primaryTicks = 2;\n }\n\n return this.primaryTicks > 0\n ? (this.primaryTicks - 1) * this.secondaryTicks + this.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 = this.isLTR\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\n switch (key) {\n case 'ArrowLeft':\n increment += this.isLTR ? -step : step;\n break;\n case 'ArrowRight':\n increment += this.isLTR ? 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.labelFormatter\n ? this.labelFormatter(this.tickValue(i))\n : 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.labelFormatter ? this.labelFormatter(value) : 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 ${this.labelFormatter ? this.labelFormatter(value) : value}\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=\"1.5px, calc(${interval * Math.sqrt(2)}% - 1.5px)\"\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 </div>\n `;\n }\n}\n"]}
|
|
@@ -34,8 +34,7 @@ declare const IgcSliderComponent_base: Constructor<import("../common/mixins/even
|
|
|
34
34
|
* @csspart fill - The filled part of the track.
|
|
35
35
|
*/
|
|
36
36
|
export default class IgcSliderComponent extends IgcSliderComponent_base {
|
|
37
|
-
|
|
38
|
-
static tagName: string;
|
|
37
|
+
static readonly tagName = "igc-slider";
|
|
39
38
|
private _value;
|
|
40
39
|
private _ariaLabel;
|
|
41
40
|
set value(val: number);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../src/components/slider/slider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAmCvD,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,iBAAiB,CAG/D,sBAAsB,CAAC;IAHzB;;
|
|
1
|
+
{"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../src/components/slider/slider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ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cesContent":["import { html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { Constructor } from '../common/mixins/constructor';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter';\nimport { IgcSliderBaseComponent } from './slider-base';\n\nexport interface IgcSliderEventMap {\n /**\n * Emitted when a value is changed via thumb drag or keyboard interaction.\n */\n igcInput: CustomEvent<number>;\n /**\n * Emitted when a value change is committed on a thumb drag end or keyboard interaction.\n */\n igcChange: CustomEvent<number>;\n}\n\n/**\n * A slider component used to select numeric value within a range.\n *\n * @element igc-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 label of the thumb tooltip.\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 IgcSliderComponent extends EventEmitterMixin<\n IgcSliderEventMap,\n Constructor<IgcSliderBaseComponent>\n>(IgcSliderBaseComponent) {\n public static readonly tagName = 'igc-slider';\n\n private _value = 0;\n private _ariaLabel!: string;\n\n public set value(val: number) {\n const oldVal = this._value;\n this._value = this.validateValue(val);\n this.requestUpdate('value', oldVal);\n }\n\n /**\n * The current value of the slider.\n */\n @property({ type: Number })\n public get value() {\n return this._value;\n }\n\n public override set ariaLabel(value: string) {\n const oldVal = this._ariaLabel;\n this._ariaLabel = value;\n\n if (this.hasAttribute('aria-label')) {\n this.removeAttribute('aria-label');\n }\n this.requestUpdate('ariaLabel', oldVal);\n }\n\n /**\n * The aria label of the slider thumb.\n */\n @property({ attribute: 'aria-label' })\n public override get ariaLabel() {\n return this._ariaLabel;\n }\n\n protected override get activeValue(): number {\n return this.value;\n }\n\n protected override normalizeValue(): void {\n this._value = this.validateValue(this._value);\n }\n\n protected override getTrackStyle() {\n const position = this.valueToFraction(this.value);\n const filledTrackStyle = {\n width: `${position * 100}%`,\n };\n\n return filledTrackStyle;\n }\n\n protected override updateValue(increment: number) {\n const oldValue = this.value;\n\n this.value = (this.value as number) + increment;\n\n if (oldValue === this.value) {\n return false;\n }\n\n this.emitInputEvent();\n return true;\n }\n\n protected override emitInputEvent() {\n this.emitEvent('igcInput', { detail: this.value });\n }\n\n protected override emitChangeEvent() {\n this.emitEvent('igcChange', { detail: this.value });\n }\n\n /**\n * Increments the value of the slider by `stepIncrement * step`, where `stepIncrement` defaults to 1.\n * @param stepIncrement Optional step increment. If no parameter is passed, it defaults to 1.\n */\n public stepUp(stepIncrement = 1) {\n this.value = this.value + stepIncrement * this.step;\n }\n\n /**\n * Decrements the value of the slider by `stepDecrement * step`, where `stepDecrement` defaults to 1.\n * @param stepDecrement Optional step decrement. If no parameter is passed, it defaults to 1.\n */\n public stepDown(stepDecrement = 1) {\n this.value = this.value - stepDecrement * this.step;\n }\n\n protected override renderThumbs() {\n return html`${this.renderThumb(this.value, this.ariaLabel)}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-slider': IgcSliderComponent;\n }\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const styles = css `:host{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;scrollbar-width:var(--scrolbar-size);scrollbar-color:var(--igc-scrollbar-thumb-color) var(--igc-scrollbar-track-color)}:host *,:host *::before,:host *::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host ::-webkit-scrollbar{width:var(--scrolbar-size);height:var(--scrolbar-size);background:var(--igc-scrollbar-track-color)}:host ::-webkit-scrollbar-thumb{background:var(--igc-scrollbar-thumb-color)}[hidden]{display:none !important}:host{display:block}[part=base]{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:3rem;-webkit-transition:all .2s ease-out;-o-transition:all .2s ease-out;transition:all .2s ease-out;font-family:var(--igc-font-family)}[part=track]{position:relative;height:.375rem;width:100%;border-radius:2rem;overflow:hidden}[part=fill]{position:absolute;height:.375rem;background:hsla(var(--igc-secondary-500), var(--igc-secondary-a));border-radius:inherit}[part=inactive]{position:absolute;height:.25rem;width:100%;top:.0625rem;background:hsla(var(--igc-secondary-500), 0.24);-webkit-transition:background .2s ease-out;-o-transition:background .2s ease-out;transition:background .2s ease-out;border-radius:inherit
|
|
2
|
+
export const styles = css `:host{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;scrollbar-width:var(--scrolbar-size);scrollbar-color:var(--igc-scrollbar-thumb-color) var(--igc-scrollbar-track-color)}:host *,:host *::before,:host *::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host ::-webkit-scrollbar{width:var(--scrolbar-size);height:var(--scrolbar-size);background:var(--igc-scrollbar-track-color)}:host ::-webkit-scrollbar-thumb{background:var(--igc-scrollbar-thumb-color)}[hidden]{display:none !important}:host{display:block}[part=base]{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:3rem;-webkit-transition:all .2s ease-out;-o-transition:all .2s ease-out;transition:all .2s ease-out;font-family:var(--igc-font-family)}[part=track]{position:relative;height:.375rem;width:100%;border-radius:2rem;overflow:hidden}[part=fill]{position:absolute;height:.375rem;background:hsla(var(--igc-secondary-500), var(--igc-secondary-a));border-radius:inherit}[part=inactive]{position:absolute;height:.25rem;width:100%;top:.0625rem;background:hsla(var(--igc-secondary-500), 0.24);-webkit-transition:background .2s ease-out;-o-transition:background .2s ease-out;transition:background .2s ease-out;border-radius:inherit}[part=steps]{position:absolute;width:100%;height:.125rem;color:#fff;opacity:.85;-webkit-transition:opacity .2s ease-out;-o-transition:opacity .2s ease-out;transition:opacity .2s ease-out;top:.125rem}[part=ticks]{width:100%;display:-webkit-box;display:-ms-flexbox;display:flex;position:absolute;bottom:0;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}[part=ticks]:first-child{bottom:auto;top:0;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}[part=ticks]:first-child [part=tick-label]{top:auto;bottom:1.5rem}[part=tick-group]:first-of-type{-webkit-margin-start:-0.0625rem;margin-inline-start:-0.0625rem}[part=tick-group]:last-of-type{-webkit-margin-start:-0.0625rem;margin-inline-start:-0.0625rem}[part=tick]{background:hsla(var(--igc-gray-500), var(--igc-gray-a));height:.5rem;width:.125rem}[part=tick][data-primary=true]{height:1rem}[part=tick-label]{color:hsla(var(--igc-gray-500), var(--igc-gray-a));position:absolute;top:1.5rem;line-height:.7;opacity:1;-webkit-transition:opacity .2s ease-in-out;-o-transition:opacity .2s ease-in-out;transition:opacity .2s ease-in-out;font-family:var(--igc-caption-font-family);font-weight:var(--igc-caption-font-weight);font-size:var(--igc-caption-font-size);font-style:var(--igc-caption-font-style);letter-spacing:var(--igc-caption-letter-spacing);text-transform:var(--igc-caption-text-transform);line-height:var(--igc-caption-line-height);margin-top:var(--igc-caption-margin-top);margin-bottom:var(--igc-caption-margin-bottom)}[part=tick-label-inner]{-webkit-margin-start:-50%;margin-inline-start:-50%}[part=thumbs]{position:absolute;width:100%;height:0;cursor:default;inset-inline-start:0}[part=thumb],[part=thumb-label]{position:absolute;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;outline-style:none}[part=thumb]{width:1.25rem;height:1.25rem;background:hsla(var(--igc-secondary-500), var(--igc-secondary-a));-webkit-transition:border-radius .1s ease-out,-webkit-transform .1s ease-out;transition:border-radius .1s ease-out,-webkit-transform .1s ease-out;-o-transition:transform .1s ease-out,border-radius .1s ease-out;transition:transform .1s ease-out,border-radius .1s ease-out;transition:transform .1s ease-out,border-radius .1s ease-out,-webkit-transform .1s ease-out;border-radius:calc(1.25rem / 2);top:calc((1.25rem - calc(1.25rem / 2))*-1);-webkit-margin-start:calc((1.25rem - calc(1.25rem / 2))*-1);margin-inline-start:calc((1.25rem - calc(1.25rem / 2))*-1)}[part=thumb]::after{position:absolute;content:"";width:2.5rem;height:2.5rem;background:hsla(var(--igc-secondary-500), var(--igc-secondary-a));top:calc(50% - calc(2.5rem / 2));inset-inline-start:calc(50% - calc(2.5rem / 2));opacity:0;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;-webkit-transition:opacity .1s ease-out,-webkit-transform .1s ease-out;transition:opacity .1s ease-out,-webkit-transform .1s ease-out;-o-transition:transform .1s ease-out,opacity .1s ease-out;transition:transform .1s ease-out,opacity .1s ease-out;transition:transform .1s ease-out,opacity .1s ease-out,-webkit-transform .1s ease-out;overflow:hidden;border-radius:calc(2.5rem / 2)}[part=thumb]:hover::after{opacity:.12;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}[part=thumb]:focus::after{opacity:.18;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}[part=thumb]:active::after{opacity:.24}[part=thumb-label]{font-family:var(--igc-caption-font-family);font-weight:var(--igc-caption-font-weight);font-size:var(--igc-caption-font-size);font-style:var(--igc-caption-font-style);letter-spacing:var(--igc-caption-letter-spacing);text-transform:var(--igc-caption-text-transform);line-height:var(--igc-caption-line-height);margin-top:var(--igc-caption-margin-top);margin-bottom:var(--igc-caption-margin-bottom);-webkit-margin-start:calc((2.5rem / 2)*-1);margin-inline-start:calc((2.5rem / 2)*-1);-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;top:calc((1.875rem + 1.25rem)*-1);pointer-events:none;min-width:2.5rem;height:1.875rem;padding:0 .125rem;border-radius:.125rem;color:var(--igc-gray-700-contrast);background:hsla(var(--igc-gray-700), var(--igc-gray-a));opacity:0}[part=thumb-label]::after{content:"";position:absolute;top:85%;border-left:.625rem solid transparent;border-right:.625rem solid transparent;border-top:.625rem solid hsla(var(--igc-gray-700), var(--igc-gray-a))}:host(:not([tick-label-rotation="0"])) [part=tick-label-inner]{-webkit-writing-mode:vertical-rl;-ms-writing-mode:tb-rl;writing-mode:vertical-rl;-webkit-margin-start:0;margin-inline-start:0;margin-block:-50%}:host([tick-label-rotation="-90"]) [part=tick-label-inner]{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}:host([disabled]){-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;cursor:initial}:host([disabled]) [part=inactive]{background:hsla(var(--igc-gray-200), var(--igc-gray-a))}:host([disabled]) [part=fill],:host([disabled]) [part=tick]{background:hsla(var(--igc-gray-400), var(--igc-gray-a))}:host([disabled]) [part=tick-label]{color:hsla(var(--igc-gray-400), var(--igc-gray-a))}:host([disabled]) [part=thumb]{background:hsla(var(--igc-gray-400), var(--igc-gray-a))}:host([disabled]) [part=thumb]:focus::after{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}:host([disabled]):hover [part=inactive]{background:hsla(var(--igc-gray-400), var(--igc-gray-a))}:host([disabled]):hover [part=thumb]{border-color:hsla(var(--igc-gray-400), var(--igc-gray-a))}`;
|
|
3
3
|
//# sourceMappingURL=slider.material.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.material.css.js","sourceRoot":"","sources":["../../../src/components/slider/slider.material.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,
|
|
1
|
+
{"version":3,"file":"slider.material.css.js","sourceRoot":"","sources":["../../../src/components/slider/slider.material.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,umOAAumO,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`:host{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;scrollbar-width:var(--scrolbar-size);scrollbar-color:var(--igc-scrollbar-thumb-color) var(--igc-scrollbar-track-color)}:host *,:host *::before,:host *::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host ::-webkit-scrollbar{width:var(--scrolbar-size);height:var(--scrolbar-size);background:var(--igc-scrollbar-track-color)}:host ::-webkit-scrollbar-thumb{background:var(--igc-scrollbar-thumb-color)}[hidden]{display:none !important}:host{display:block}[part=base]{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:3rem;-webkit-transition:all .2s ease-out;-o-transition:all .2s ease-out;transition:all .2s ease-out;font-family:var(--igc-font-family)}[part=track]{position:relative;height:.375rem;width:100%;border-radius:2rem;overflow:hidden}[part=fill]{position:absolute;height:.375rem;background:hsla(var(--igc-secondary-500), var(--igc-secondary-a));border-radius:inherit}[part=inactive]{position:absolute;height:.25rem;width:100%;top:.0625rem;background:hsla(var(--igc-secondary-500), 0.24);-webkit-transition:background .2s ease-out;-o-transition:background .2s ease-out;transition:background .2s ease-out;border-radius:inherit}[part=steps]{position:absolute;width:100%;height:.125rem;color:#fff;opacity:.85;-webkit-transition:opacity .2s ease-out;-o-transition:opacity .2s ease-out;transition:opacity .2s ease-out;top:.125rem}[part=ticks]{width:100%;display:-webkit-box;display:-ms-flexbox;display:flex;position:absolute;bottom:0;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}[part=ticks]:first-child{bottom:auto;top:0;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}[part=ticks]:first-child [part=tick-label]{top:auto;bottom:1.5rem}[part=tick-group]:first-of-type{-webkit-margin-start:-0.0625rem;margin-inline-start:-0.0625rem}[part=tick-group]:last-of-type{-webkit-margin-start:-0.0625rem;margin-inline-start:-0.0625rem}[part=tick]{background:hsla(var(--igc-gray-500), var(--igc-gray-a));height:.5rem;width:.125rem}[part=tick][data-primary=true]{height:1rem}[part=tick-label]{color:hsla(var(--igc-gray-500), var(--igc-gray-a));position:absolute;top:1.5rem;line-height:.7;opacity:1;-webkit-transition:opacity .2s ease-in-out;-o-transition:opacity .2s ease-in-out;transition:opacity .2s ease-in-out;font-family:var(--igc-caption-font-family);font-weight:var(--igc-caption-font-weight);font-size:var(--igc-caption-font-size);font-style:var(--igc-caption-font-style);letter-spacing:var(--igc-caption-letter-spacing);text-transform:var(--igc-caption-text-transform);line-height:var(--igc-caption-line-height);margin-top:var(--igc-caption-margin-top);margin-bottom:var(--igc-caption-margin-bottom)}[part=tick-label-inner]{-webkit-margin-start:-50%;margin-inline-start:-50%}[part=thumbs]{position:absolute;width:100%;height:0;cursor:default;inset-inline-start:0}[part=thumb],[part=thumb-label]{position:absolute;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;outline-style:none}[part=thumb]{width:1.25rem;height:1.25rem;background:hsla(var(--igc-secondary-500), var(--igc-secondary-a));-webkit-transition:border-radius .1s ease-out,-webkit-transform .1s ease-out;transition:border-radius .1s ease-out,-webkit-transform .1s ease-out;-o-transition:transform .1s ease-out,border-radius .1s ease-out;transition:transform .1s ease-out,border-radius .1s ease-out;transition:transform .1s ease-out,border-radius .1s ease-out,-webkit-transform .1s ease-out;border-radius:calc(1.25rem / 2);top:calc((1.25rem - calc(1.25rem / 2))*-1);-webkit-margin-start:calc((1.25rem - calc(1.25rem / 2))*-1);margin-inline-start:calc((1.25rem - calc(1.25rem / 2))*-1)}[part=thumb]::after{position:absolute;content:\"\";width:2.5rem;height:2.5rem;background:hsla(var(--igc-secondary-500), var(--igc-secondary-a));top:calc(50% - calc(2.5rem / 2));inset-inline-start:calc(50% - calc(2.5rem / 2));opacity:0;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;-webkit-transition:opacity .1s ease-out,-webkit-transform .1s ease-out;transition:opacity .1s ease-out,-webkit-transform .1s ease-out;-o-transition:transform .1s ease-out,opacity .1s ease-out;transition:transform .1s ease-out,opacity .1s ease-out;transition:transform .1s ease-out,opacity .1s ease-out,-webkit-transform .1s ease-out;overflow:hidden;border-radius:calc(2.5rem / 2)}[part=thumb]:hover::after{opacity:.12;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}[part=thumb]:focus::after{opacity:.18;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}[part=thumb]:active::after{opacity:.24}[part=thumb-label]{font-family:var(--igc-caption-font-family);font-weight:var(--igc-caption-font-weight);font-size:var(--igc-caption-font-size);font-style:var(--igc-caption-font-style);letter-spacing:var(--igc-caption-letter-spacing);text-transform:var(--igc-caption-text-transform);line-height:var(--igc-caption-line-height);margin-top:var(--igc-caption-margin-top);margin-bottom:var(--igc-caption-margin-bottom);-webkit-margin-start:calc((2.5rem / 2)*-1);margin-inline-start:calc((2.5rem / 2)*-1);-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;top:calc((1.875rem + 1.25rem)*-1);pointer-events:none;min-width:2.5rem;height:1.875rem;padding:0 .125rem;border-radius:.125rem;color:var(--igc-gray-700-contrast);background:hsla(var(--igc-gray-700), var(--igc-gray-a));opacity:0}[part=thumb-label]::after{content:\"\";position:absolute;top:85%;border-left:.625rem solid transparent;border-right:.625rem solid transparent;border-top:.625rem solid hsla(var(--igc-gray-700), var(--igc-gray-a))}:host(:not([tick-label-rotation=\"0\"])) [part=tick-label-inner]{-webkit-writing-mode:vertical-rl;-ms-writing-mode:tb-rl;writing-mode:vertical-rl;-webkit-margin-start:0;margin-inline-start:0;margin-block:-50%}:host([tick-label-rotation=\"-90\"]) [part=tick-label-inner]{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}:host([disabled]){-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;cursor:initial}:host([disabled]) [part=inactive]{background:hsla(var(--igc-gray-200), var(--igc-gray-a))}:host([disabled]) [part=fill],:host([disabled]) [part=tick]{background:hsla(var(--igc-gray-400), var(--igc-gray-a))}:host([disabled]) [part=tick-label]{color:hsla(var(--igc-gray-400), var(--igc-gray-a))}:host([disabled]) [part=thumb]{background:hsla(var(--igc-gray-400), var(--igc-gray-a))}:host([disabled]) [part=thumb]:focus::after{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0)}:host([disabled]):hover [part=inactive]{background:hsla(var(--igc-gray-400), var(--igc-gray-a))}:host([disabled]):hover [part=thumb]{border-color:hsla(var(--igc-gray-400), var(--igc-gray-a))}`;\n"]}
|