igniteui-webcomponents 3.3.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 +24 -0
- package/README.md +7 -2
- package/components/accordion/accordion.js +3 -1
- package/components/accordion/accordion.js.map +1 -1
- package/components/button/button-base.js +7 -2
- package/components/button/button-base.js.map +1 -1
- package/components/button/themes/button/light/button.base.css.js +1 -1
- package/components/button/themes/button/light/button.base.css.js.map +1 -1
- package/components/button/themes/button/light/button.material.css.js +1 -1
- package/components/button/themes/button/light/button.material.css.js.map +1 -1
- package/components/calendar/common/calendar-base.js +3 -1
- package/components/calendar/common/calendar-base.js.map +1 -1
- package/components/calendar/days-view/days-view.d.ts +2 -0
- package/components/calendar/days-view/days-view.js +17 -5
- package/components/calendar/days-view/days-view.js.map +1 -1
- package/components/checkbox/checkbox-base.js +7 -2
- package/components/checkbox/checkbox-base.js.map +1 -1
- package/components/chip/chip.d.ts +1 -0
- package/components/chip/chip.js +9 -0
- package/components/chip/chip.js.map +1 -1
- package/components/common/decorators/blazorDeepImport.d.ts +4 -0
- package/components/common/decorators/blazorDeepImport.js +2 -0
- package/components/common/decorators/blazorDeepImport.js.map +1 -0
- package/components/common/util.d.ts +1 -0
- package/components/common/util.js +3 -0
- package/components/common/util.js.map +1 -1
- package/components/dialog/dialog.d.ts +69 -0
- package/components/dialog/dialog.js +168 -0
- package/components/dialog/dialog.js.map +1 -0
- package/components/dialog/themes/light/dialog.base.css.d.ts +1 -0
- package/components/dialog/themes/light/dialog.base.css.js +3 -0
- package/components/dialog/themes/light/dialog.base.css.js.map +1 -0
- package/components/dialog/themes/light/dialog.bootstrap.css.d.ts +1 -0
- package/components/dialog/themes/light/dialog.bootstrap.css.js +3 -0
- package/components/dialog/themes/light/dialog.bootstrap.css.js.map +1 -0
- package/components/dialog/themes/light/dialog.fluent.css.d.ts +1 -0
- package/components/dialog/themes/light/dialog.fluent.css.js +3 -0
- package/components/dialog/themes/light/dialog.fluent.css.js.map +1 -0
- package/components/dialog/themes/light/dialog.indigo.css.d.ts +1 -0
- package/components/dialog/themes/light/dialog.indigo.css.js +3 -0
- package/components/dialog/themes/light/dialog.indigo.css.js.map +1 -0
- package/components/dialog/themes/light/dialog.material.css.d.ts +1 -0
- package/components/dialog/themes/light/dialog.material.css.js +3 -0
- package/components/dialog/themes/light/dialog.material.css.js.map +1 -0
- package/components/dropdown/dropdown-group.d.ts +2 -2
- package/components/dropdown/dropdown-group.js +1 -1
- package/components/dropdown/dropdown-group.js.map +1 -1
- package/components/dropdown/dropdown-header.d.ts +1 -1
- package/components/dropdown/dropdown-header.js.map +1 -1
- package/components/dropdown/dropdown-item.d.ts +1 -1
- package/components/dropdown/dropdown-item.js.map +1 -1
- package/components/dropdown/dropdown.d.ts +10 -8
- package/components/dropdown/dropdown.js +15 -10
- package/components/dropdown/dropdown.js.map +1 -1
- package/components/dropdown/themes/light/dropdown-group.base.css.js +1 -1
- package/components/dropdown/themes/light/dropdown-group.base.css.js.map +1 -1
- package/components/dropdown/themes/light/dropdown-group.fluent.css.js +1 -1
- package/components/dropdown/themes/light/dropdown-group.fluent.css.js.map +1 -1
- package/components/dropdown/themes/light/dropdown-item.base.css.js +1 -1
- package/components/dropdown/themes/light/dropdown-item.base.css.js.map +1 -1
- package/components/dropdown/themes/light/dropdown.base.css.js +1 -1
- package/components/dropdown/themes/light/dropdown.base.css.js.map +1 -1
- package/components/dropdown/themes/light/dropdown.fluent.css.js +1 -1
- package/components/dropdown/themes/light/dropdown.fluent.css.js.map +1 -1
- package/components/form/form.js +4 -3
- package/components/form/form.js.map +1 -1
- package/components/icon/icon.js +3 -1
- package/components/icon/icon.js.map +1 -1
- package/components/input/input-base.js +3 -1
- package/components/input/input-base.js.map +1 -1
- package/components/input/input.d.ts +1 -0
- package/components/input/input.js +5 -0
- package/components/input/input.js.map +1 -1
- package/components/input/themes/light/input.base.css.js +1 -1
- package/components/input/themes/light/input.base.css.js.map +1 -1
- package/components/input/themes/light/input.bootstrap.css.js +1 -1
- package/components/input/themes/light/input.bootstrap.css.js.map +1 -1
- package/components/input/themes/light/input.fluent.css.js +1 -1
- package/components/input/themes/light/input.fluent.css.js.map +1 -1
- package/components/input/themes/light/input.indigo.css.js +1 -1
- package/components/input/themes/light/input.indigo.css.js.map +1 -1
- package/components/mask-input/mask-input-base.js +7 -2
- package/components/mask-input/mask-input-base.js.map +1 -1
- package/components/progress/linear-progress.js +1 -0
- package/components/progress/linear-progress.js.map +1 -1
- package/components/progress/themes/circular/circular.progress.base.css.js +1 -1
- package/components/progress/themes/circular/circular.progress.base.css.js.map +1 -1
- package/components/progress/themes/linear/linear.progress.base.css.js +1 -1
- package/components/progress/themes/linear/linear.progress.base.css.js.map +1 -1
- package/components/progress/themes/linear/linear.progress.bootstrap.css.js +1 -1
- package/components/progress/themes/linear/linear.progress.bootstrap.css.js.map +1 -1
- package/components/progress/themes/linear/linear.progress.fluent.css.js +1 -1
- package/components/progress/themes/linear/linear.progress.fluent.css.js.map +1 -1
- package/components/progress/themes/linear/linear.progress.indigo.css.js +1 -1
- package/components/progress/themes/linear/linear.progress.indigo.css.js.map +1 -1
- package/components/radio-group/radio-group.d.ts +0 -1
- package/components/radio-group/radio-group.js +7 -6
- package/components/radio-group/radio-group.js.map +1 -1
- package/components/rating/rating.d.ts +21 -9
- package/components/rating/rating.js +50 -33
- package/components/rating/rating.js.map +1 -1
- package/components/select/select-group.d.ts +31 -0
- package/components/select/select-group.js +69 -0
- package/components/select/select-group.js.map +1 -0
- package/components/select/select-header.d.ts +15 -0
- package/components/select/select-header.js +5 -0
- package/components/select/select-header.js.map +1 -0
- package/components/select/select-item.d.ts +30 -0
- package/components/select/select-item.js +39 -0
- package/components/select/select-item.js.map +1 -0
- package/components/select/select.d.ts +112 -0
- package/components/select/select.js +343 -0
- package/components/select/select.js.map +1 -0
- package/components/select/themes/dark/select.bootstrap.css.d.ts +1 -0
- package/components/select/themes/dark/select.bootstrap.css.js +3 -0
- package/components/select/themes/dark/select.bootstrap.css.js.map +1 -0
- package/components/select/themes/dark/select.fluent.css.d.ts +1 -0
- package/components/select/themes/dark/select.fluent.css.js +3 -0
- package/components/select/themes/dark/select.fluent.css.js.map +1 -0
- package/components/select/themes/dark/select.indigo.css.d.ts +1 -0
- package/components/select/themes/dark/select.indigo.css.js +3 -0
- package/components/select/themes/dark/select.indigo.css.js.map +1 -0
- package/components/select/themes/dark/select.material.css.d.ts +1 -0
- package/components/select/themes/dark/select.material.css.js +3 -0
- package/components/select/themes/dark/select.material.css.js.map +1 -0
- package/components/select/themes/light/select.base.css.d.ts +1 -0
- package/components/select/themes/light/select.base.css.js +3 -0
- package/components/select/themes/light/select.base.css.js.map +1 -0
- package/components/select/themes/light/select.bootstrap.css.d.ts +1 -0
- package/components/select/themes/light/select.bootstrap.css.js +3 -0
- package/components/select/themes/light/select.bootstrap.css.js.map +1 -0
- package/components/select/themes/light/select.fluent.css.d.ts +1 -0
- package/components/select/themes/light/select.fluent.css.js +3 -0
- package/components/select/themes/light/select.fluent.css.js.map +1 -0
- package/components/select/themes/light/select.indigo.css.d.ts +1 -0
- package/components/select/themes/light/select.indigo.css.js +3 -0
- package/components/select/themes/light/select.indigo.css.js.map +1 -0
- package/components/select/themes/light/select.material.css.d.ts +1 -0
- package/components/select/themes/light/select.material.css.js +3 -0
- package/components/select/themes/light/select.material.css.js.map +1 -0
- 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 -8
- package/components/slider/slider-base.js +8 -8
- package/components/slider/slider-base.js.map +1 -1
- package/components/tabs/tabs.d.ts +0 -1
- package/components/tabs/tabs.js +7 -9
- package/components/tabs/tabs.js.map +1 -1
- package/components/toast/toast.d.ts +1 -0
- package/components/toast/toast.js +9 -0
- package/components/toast/toast.js.map +1 -1
- package/components/toggle/toggle.controller.d.ts +7 -2
- package/components/toggle/toggle.controller.js +21 -20
- package/components/toggle/toggle.controller.js.map +1 -1
- package/components/tree/themes/light/tree.base.css.js +1 -1
- package/components/tree/themes/light/tree.base.css.js.map +1 -1
- package/custom-elements.json +613 -14
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/themes/dark/bootstrap.css +1 -1
- package/themes/dark/fluent.css +1 -1
- package/themes/dark/indigo.css +1 -1
- package/themes/dark/material.css +1 -1
- package/vscode-html-custom-data.json +282 -14
|
@@ -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;;QAYU,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,CAAC,CAAC;IACtC,CAAC;IAMD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAW,KAAK,CAAC,GAAW;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;Q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,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,MA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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,11 +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
|
-
|
|
107
|
-
private get isLTR();
|
|
105
|
+
protected get actualMin(): number;
|
|
106
|
+
protected get actualMax(): number;
|
|
108
107
|
protected validateValue(value: number): number;
|
|
109
|
-
|
|
108
|
+
protected formatValue(value: number): string;
|
|
110
109
|
private normalizeByStep;
|
|
111
110
|
protected closestHandle(_event: PointerEvent): HTMLElement;
|
|
112
111
|
private totalTickCount;
|
|
@@ -122,8 +121,8 @@ export declare class IgcSliderBaseComponent extends LitElement {
|
|
|
122
121
|
private pointerMove;
|
|
123
122
|
private lostPointerCapture;
|
|
124
123
|
private handleKeydown;
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
protected handleThumbPointerEnter: () => void;
|
|
125
|
+
protected handleThumbPointerLeave: () => void;
|
|
127
126
|
protected renderTicks(): TemplateResult<1>[];
|
|
128
127
|
protected renderThumb(value: number, ariaLabel?: string, thumbId?: string): TemplateResult<1>;
|
|
129
128
|
private renderSteps;
|
|
@@ -18,6 +18,8 @@ import { styles as indigo } from './themes/light/slider.indigo.css.js';
|
|
|
18
18
|
import { styles as material } from './themes/light/slider.material.css.js';
|
|
19
19
|
import { defineComponents } from '../common/definitions/defineComponents.js';
|
|
20
20
|
import IgcSliderLabelComponent from './slider-label.js';
|
|
21
|
+
import { blazorDeepImport } from '../common/decorators/blazorDeepImport.js';
|
|
22
|
+
import { isLTR } from '../common/util.js';
|
|
21
23
|
defineComponents(IgcSliderLabelComponent);
|
|
22
24
|
let IgcSliderBaseComponent = class IgcSliderBaseComponent extends LitElement {
|
|
23
25
|
constructor() {
|
|
@@ -68,12 +70,13 @@ let IgcSliderBaseComponent = class IgcSliderBaseComponent extends LitElement {
|
|
|
68
70
|
let increment = 0;
|
|
69
71
|
const value = this.activeValue;
|
|
70
72
|
const step = this.step ? this.step : 1;
|
|
73
|
+
const ltr = isLTR(this);
|
|
71
74
|
switch (key) {
|
|
72
75
|
case 'ArrowLeft':
|
|
73
|
-
increment +=
|
|
76
|
+
increment += ltr ? -step : step;
|
|
74
77
|
break;
|
|
75
78
|
case 'ArrowRight':
|
|
76
|
-
increment +=
|
|
79
|
+
increment += ltr ? step : -step;
|
|
77
80
|
break;
|
|
78
81
|
case 'ArrowUp':
|
|
79
82
|
increment = step;
|
|
@@ -221,10 +224,6 @@ let IgcSliderBaseComponent = class IgcSliderBaseComponent extends LitElement {
|
|
|
221
224
|
? this.upperBound
|
|
222
225
|
: this.max;
|
|
223
226
|
}
|
|
224
|
-
get isLTR() {
|
|
225
|
-
const styles = window.getComputedStyle(this);
|
|
226
|
-
return styles.getPropertyValue('direction') === 'ltr';
|
|
227
|
-
}
|
|
228
227
|
validateValue(value) {
|
|
229
228
|
value = this.valueInRange(value, this.actualMin, this.actualMax);
|
|
230
229
|
value = this.normalizeByStep(value);
|
|
@@ -300,7 +299,7 @@ let IgcSliderBaseComponent = class IgcSliderBaseComponent extends LitElement {
|
|
|
300
299
|
const thumbCenter = (thumbBoundaries.right - thumbBoundaries.left) / 2;
|
|
301
300
|
const thumbPositionX = thumbBoundaries.left + thumbCenter;
|
|
302
301
|
const scale = this.getBoundingClientRect().width / (this.max - this.min);
|
|
303
|
-
const change = this
|
|
302
|
+
const change = isLTR(this)
|
|
304
303
|
? mouseX - thumbPositionX
|
|
305
304
|
: thumbPositionX - mouseX;
|
|
306
305
|
if (this.step) {
|
|
@@ -511,7 +510,8 @@ __decorate([
|
|
|
511
510
|
watch('labels')
|
|
512
511
|
], IgcSliderBaseComponent.prototype, "labelsChange", null);
|
|
513
512
|
IgcSliderBaseComponent = __decorate([
|
|
514
|
-
themes({ material, bootstrap, fluent, indigo })
|
|
513
|
+
themes({ material, bootstrap, fluent, indigo }),
|
|
514
|
+
blazorDeepImport
|
|
515
515
|
], IgcSliderBaseComponent);
|
|
516
516
|
export { IgcSliderBaseComponent };
|
|
517
517
|
//# sourceMappingURL=slider-base.js.map
|
|
@@ -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,EAC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,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;+DAG7C;AAGD;IADC,KAAK,CAAC,QAAQ,CAAC;0DAOf;AAhNU,sBAAsB;IADlC,MAAM,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;GACnC,sBAAsB,CAqmBlC;SArmBY,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';\n\ndefineComponents(IgcSliderLabelComponent);\n\n@themes({ material, bootstrap, fluent, indigo })\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 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 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 = 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.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,OAA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AC;kEACsB;AAOrD;IAFC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,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"]}
|
|
@@ -41,7 +41,6 @@ export default class IgcTabsComponent extends IgcTabsComponent_base {
|
|
|
41
41
|
protected resizeObserver: ResizeObserver;
|
|
42
42
|
protected mutationObserver: MutationObserver;
|
|
43
43
|
protected get enabledTabs(): IgcTabComponent[];
|
|
44
|
-
protected get isLTR(): boolean;
|
|
45
44
|
/** Returns the currently selected tab. */
|
|
46
45
|
get selected(): string;
|
|
47
46
|
/** Sets the alignment for the tab headers */
|
package/components/tabs/tabs.js
CHANGED
|
@@ -15,7 +15,7 @@ import { styles as bootstrap } from './themes/light/tabs.bootstrap.css.js';
|
|
|
15
15
|
import { styles as fluent } from './themes/light/tabs.fluent.css.js';
|
|
16
16
|
import { styles as indigo } from './themes/light/tabs.indigo.css.js';
|
|
17
17
|
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
|
|
18
|
-
import { createCounter, getOffset } from '../common/util.js';
|
|
18
|
+
import { createCounter, getOffset, isLTR } from '../common/util.js';
|
|
19
19
|
import { getAttributesForTags, getNodesForTags, observerConfig, } from './utils.js';
|
|
20
20
|
import { defineComponents } from '../common/definitions/defineComponents.js';
|
|
21
21
|
import IgcTabComponent from './tab.js';
|
|
@@ -34,15 +34,16 @@ let IgcTabsComponent = IgcTabsComponent_1 = class IgcTabsComponent extends Event
|
|
|
34
34
|
var _a;
|
|
35
35
|
const { key } = event;
|
|
36
36
|
const enabledTabs = this.enabledTabs;
|
|
37
|
+
const ltr = isLTR(this);
|
|
37
38
|
let index = enabledTabs.indexOf((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest('igc-tab'));
|
|
38
39
|
switch (key) {
|
|
39
40
|
case 'ArrowLeft':
|
|
40
|
-
index =
|
|
41
|
+
index = ltr
|
|
41
42
|
? (enabledTabs.length + index - 1) % enabledTabs.length
|
|
42
43
|
: (index + 1) % enabledTabs.length;
|
|
43
44
|
break;
|
|
44
45
|
case 'ArrowRight':
|
|
45
|
-
index =
|
|
46
|
+
index = ltr
|
|
46
47
|
? (index + 1) % enabledTabs.length
|
|
47
48
|
: (enabledTabs.length + index - 1) % enabledTabs.length;
|
|
48
49
|
break;
|
|
@@ -73,9 +74,6 @@ let IgcTabsComponent = IgcTabsComponent_1 = class IgcTabsComponent extends Event
|
|
|
73
74
|
get enabledTabs() {
|
|
74
75
|
return this.tabs.filter((tab) => !tab.disabled);
|
|
75
76
|
}
|
|
76
|
-
get isLTR() {
|
|
77
|
-
return (window.getComputedStyle(this).getPropertyValue('direction') === 'ltr');
|
|
78
|
-
}
|
|
79
77
|
get selected() {
|
|
80
78
|
var _a, _b;
|
|
81
79
|
return (_b = (_a = this.activeTab) === null || _a === void 0 ? void 0 : _a.panel) !== null && _b !== void 0 ? _b : '';
|
|
@@ -88,7 +86,7 @@ let IgcTabsComponent = IgcTabsComponent_1 = class IgcTabsComponent extends Event
|
|
|
88
86
|
if (this.activeTab) {
|
|
89
87
|
Object.assign(styles, {
|
|
90
88
|
width: `${this.activeTab.offsetWidth}px`,
|
|
91
|
-
transform: `translate(${this
|
|
89
|
+
transform: `translate(${isLTR(this)
|
|
92
90
|
? getOffset(this.activeTab, this.wrapper).left
|
|
93
91
|
: getOffset(this.activeTab, this.wrapper).right}px)`,
|
|
94
92
|
});
|
|
@@ -193,7 +191,7 @@ let IgcTabsComponent = IgcTabsComponent_1 = class IgcTabsComponent extends Event
|
|
|
193
191
|
}
|
|
194
192
|
scrollByTabOffset(direction) {
|
|
195
193
|
const { scrollLeft, offsetWidth } = this.container;
|
|
196
|
-
const LTR = this
|
|
194
|
+
const LTR = isLTR(this), next = direction === 'end';
|
|
197
195
|
const pivot = Math.abs(next ? offsetWidth + scrollLeft : scrollLeft);
|
|
198
196
|
let amount = this.tabs
|
|
199
197
|
.map((tab) => ({
|
|
@@ -205,7 +203,7 @@ let IgcTabsComponent = IgcTabsComponent_1 = class IgcTabsComponent extends Event
|
|
|
205
203
|
.filter((offset) => next ? offset.start + offset.width > pivot : offset.start < pivot)
|
|
206
204
|
.at(next ? 0 : -1).width;
|
|
207
205
|
amount *= next ? 1 : -1;
|
|
208
|
-
this.container.scrollBy({ left:
|
|
206
|
+
this.container.scrollBy({ left: LTR ? amount : -amount });
|
|
209
207
|
}
|
|
210
208
|
handleClick(event) {
|
|
211
209
|
const target = event.target;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../../src/components/tabs/tabs.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,QAAQ,E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C;IADC,KAAK,CAAC,0BAA0B,EAAE,IAAI,CAAC;mDACN;AAGlC;IADC,KAAK,CAAC,6BAA6B,EAAE,IAAI,CAAC;2DACD;AAG1C;IADC,KAAK,EAAE;2DAC4B;AAGpC;IADC,KAAK,EAAE;kEACkC;AAG1C;IADC,KAAK,EAAE;gEACiC;AAGzC;IADC,KAAK,EAAE;mDAC8B;AAsBtC;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDACuC;AASnE;IADC,QAAQ,EAAE;oDACmC;AAG9C;IADC,KAAK,CAAC,WAAW,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;sDAmBlD;AAyND;IADC,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAG/B;AAjTkB,gBAAgB;IAFpC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACrC,4BAA4B,CAAC,uCAAuC,CAAC;GACjD,gBAAgB,CAoWpC;eApWoB,gBAAgB","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport {\n eventOptions,\n property,\n query,\n queryAssignedElements,\n state,\n} from 'lit/decorators.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { blazorAdditionalDependencies } from '../common/decorators/blazorAdditionalDependencies.js';\nimport { themes } from '../../theming/theming-decorator.js';\nimport { styles } from './themes/light/tabs.base.css.js';\nimport { styles as bootstrap } from './themes/light/tabs.bootstrap.css.js';\nimport { styles as fluent } from './themes/light/tabs.fluent.css.js';\nimport { styles as indigo } from './themes/light/tabs.indigo.css.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { Constructor } from '../common/mixins/constructor.js';\nimport { createCounter, getOffset } from '../common/util.js';\nimport {\n getAttributesForTags,\n getNodesForTags,\n observerConfig,\n} from './utils.js';\n\nimport { defineComponents } from '../common/definitions/defineComponents.js';\nimport IgcTabComponent from './tab.js';\nimport IgcTabPanelComponent from './tab-panel.js';\nimport IgcIconButtonComponent from '../button/icon-button.js';\n\ndefineComponents(IgcTabComponent, IgcTabPanelComponent, IgcIconButtonComponent);\n\nexport interface IgcTabsEventMap {\n igcChange: CustomEvent<IgcTabComponent>;\n}\n\n/**\n * Represents tabs component\n *\n * @element igc-tabs\n *\n * @fires igcChange - Emitted when the selected tab changes.\n *\n * @slot - Renders the tab header.\n * @slot panel - Renders the tab content.\n *\n * @csspart headers - The wrapper of the tabs including the headers content and the scroll buttons.\n * @csspart headers-content - The container for the tab headers.\n * @csspart headers-wrapper - The wrapper for the tab headers and the selected indicator.\n * @csspart headers-scroll - The container for the headers.\n * @csspart selected-indicator - The selected indicator.\n * @csspart start-scroll-button - The start scroll button displayed when the tabs overflow.\n * @csspart end-scroll-button - The end scroll button displayed when the tabs overflow.\n * @csspart content - The container for the tabs content.\n */\n@themes({ bootstrap, fluent, indigo })\n@blazorAdditionalDependencies('IgcTabComponent, IgcTabPanelComponent')\nexport default class IgcTabsComponent extends EventEmitterMixin<\n IgcTabsEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-tabs';\n\n public static styles = styles;\n private static readonly increment = createCounter();\n\n @queryAssignedElements({ selector: 'igc-tab' })\n protected tabs!: Array<IgcTabComponent>;\n\n @queryAssignedElements({ slot: 'panel' })\n protected panels!: Array<IgcTabPanelComponent>;\n\n @query('[part=\"headers-wrapper\"]', true)\n protected wrapper!: HTMLElement;\n\n @query('[part=\"headers-content\"]', true)\n protected container!: HTMLElement;\n\n @query('[part=\"selected-indicator\"]', true)\n protected selectedIndicator!: HTMLElement;\n\n @state()\n protected showScrollButtons = false;\n\n @state()\n protected disableStartScrollButton = true;\n\n @state()\n protected disableEndScrollButton = false;\n\n @state()\n protected activeTab?: IgcTabComponent;\n\n protected resizeObserver!: ResizeObserver;\n protected mutationObserver!: MutationObserver;\n\n protected get enabledTabs() {\n return this.tabs.filter((tab) => !tab.disabled);\n }\n\n protected get isLTR() {\n return (\n window.getComputedStyle(this).getPropertyValue('direction') === 'ltr'\n );\n }\n\n /** Returns the currently selected tab. */\n public get selected(): string {\n return this.activeTab?.panel ?? '';\n }\n\n /** Sets the alignment for the tab headers */\n @property({ reflect: true })\n public alignment: 'start' | 'end' | 'center' | 'justify' = 'start';\n\n /**\n * Determines the tab activation. When set to auto,\n * the tab is instantly selected while navigating with the Left/Right Arrows, Home or End keys\n * and the corresponding panel is displayed.\n * When set to manual, the tab is only focused. The selection happens after pressing Space or Enter.\n */\n @property()\n public activation: 'auto' | 'manual' = 'auto';\n\n @watch('alignment', { waitUntilFirstUpdate: true })\n protected alignIndicator() {\n const styles: Partial<CSSStyleDeclaration> = {\n visibility: this.activeTab ? 'visible' : 'hidden',\n transitionDuration: '0.3s',\n };\n\n if (this.activeTab) {\n Object.assign(styles, {\n width: `${this.activeTab!.offsetWidth}px`,\n transform: `translate(${\n this.isLTR\n ? getOffset(this.activeTab!, this.wrapper).left\n : getOffset(this.activeTab!, this.wrapper).right\n }px)`,\n });\n }\n\n Object.assign(this.selectedIndicator.style, styles);\n }\n\n protected override async firstUpdated() {\n this.showScrollButtons =\n this.container.scrollWidth > this.container.clientWidth;\n\n await this.updateComplete;\n\n this.syncAttributes();\n this.setupObserver();\n this.setSelectedTab(\n this.tabs.filter((tab) => tab.selected).at(-1) ?? this.enabledTabs.at(0)\n );\n }\n\n public override disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.mutationObserver?.disconnect();\n super.disconnectedCallback();\n }\n\n protected updateButtonsOnResize() {\n // Hide the buttons in the resize observer callback and synchronously update the DOM\n // in order to get the actual size\n this.showScrollButtons = false;\n this.performUpdate();\n\n this.showScrollButtons =\n this.container.scrollWidth > this.container.clientWidth;\n\n this.updateScrollButtons();\n }\n\n protected updateScrollButtons() {\n const { scrollLeft, offsetWidth } = this.container,\n { scrollWidth } = this.wrapper;\n\n this.disableEndScrollButton =\n scrollWidth <= Math.abs(scrollLeft) + offsetWidth;\n this.disableStartScrollButton = scrollLeft === 0;\n }\n\n protected setupObserver() {\n this.resizeObserver = new ResizeObserver(() => {\n this.updateButtonsOnResize();\n this.alignIndicator();\n });\n\n [this.container, this.wrapper, ...this.tabs].forEach((element) =>\n this.resizeObserver.observe(element)\n );\n\n this.mutationObserver = new MutationObserver(async (records, observer) => {\n // Stop observing while handling changes\n observer.disconnect();\n\n const attributes = getAttributesForTags<IgcTabComponent>(\n records,\n 'igc-tab'\n );\n const changed = getNodesForTags<IgcTabComponent>(\n records,\n this,\n 'igc-tab'\n );\n\n if (attributes.length > 0) {\n this.activeTab = attributes.find((tab) => tab.selected);\n }\n\n if (changed) {\n changed.addedNodes.forEach((tab) => {\n this.resizeObserver.observe(tab);\n if (tab.selected) {\n this.activeTab = tab;\n }\n });\n changed.removedNodes.forEach((tab) => {\n this.resizeObserver.unobserve(tab);\n if (tab.selected || this.activeTab === tab) {\n this.activeTab = undefined;\n }\n });\n\n this.syncAttributes();\n }\n\n this.updateSelectedTab();\n this.activeTab?.scrollIntoView({ block: 'nearest' });\n this.alignIndicator();\n\n // Watch for changes again\n await this.updateComplete;\n observer.observe(this, observerConfig);\n });\n\n this.mutationObserver.observe(this, observerConfig);\n }\n\n protected updateSelectedTab() {\n this.tabs.forEach((tab) => (tab.selected = tab === this.activeTab));\n this.panels.forEach((panel) =>\n Object.assign(panel.style, {\n display: panel.id === this.activeTab?.panel ? 'block' : 'none',\n })\n );\n }\n\n protected syncAttributes() {\n const prefix = this.id ? `${this.id}-` : '';\n this.tabs.forEach((tab, index) => {\n if (!tab.panel) {\n tab.panel =\n this.panels.at(index)?.id ??\n `${prefix}tab-${IgcTabsComponent.increment()}`;\n }\n this.panels\n .find((panel) => panel.id === tab.panel)\n ?.setAttribute('aria-labelledby', tab.id);\n });\n }\n\n private setSelectedTab(tab?: IgcTabComponent) {\n if (!tab || tab === this.activeTab) {\n return;\n }\n\n if (this.activeTab) {\n this.activeTab.selected = false;\n }\n\n this.activeTab = tab;\n this.activeTab.selected = true;\n }\n\n protected scrollByTabOffset(direction: 'start' | 'end') {\n const { scrollLeft, offsetWidth } = this.container;\n const LTR = this.isLTR,\n next = direction === 'end';\n\n const pivot = Math.abs(next ? offsetWidth + scrollLeft : scrollLeft);\n\n let amount = this.tabs\n .map((tab) => ({\n start: LTR\n ? getOffset(tab, this.wrapper).left\n : Math.abs(getOffset(tab, this.wrapper).right),\n width: tab.offsetWidth,\n }))\n .filter((offset) =>\n next ? offset.start + offset.width > pivot : offset.start < pivot\n )\n .at(next ? 0 : -1)!.width;\n\n amount *= next ? 1 : -1;\n this.container.scrollBy({ left: this.isLTR ? amount : -amount });\n }\n\n protected handleClick(event: MouseEvent) {\n const target = event.target as HTMLElement;\n const tab = target.closest('igc-tab');\n\n if (!(tab && this.contains(tab)) || tab.disabled) {\n return;\n }\n\n tab.focus();\n this.setSelectedTab(tab);\n this.emitEvent('igcChange', { detail: this.activeTab });\n }\n\n protected handleKeyDown = (event: KeyboardEvent) => {\n const { key } = event;\n const enabledTabs = this.enabledTabs;\n\n let index = enabledTabs.indexOf(\n document.activeElement?.closest('igc-tab') as IgcTabComponent\n );\n\n switch (key) {\n case 'ArrowLeft':\n index = this.isLTR\n ? (enabledTabs.length + index - 1) % enabledTabs.length\n : (index + 1) % enabledTabs.length;\n break;\n case 'ArrowRight':\n index = this.isLTR\n ? (index + 1) % enabledTabs.length\n : (enabledTabs.length + index - 1) % enabledTabs.length;\n break;\n case 'Home':\n index = 0;\n break;\n case 'End':\n index = enabledTabs.length - 1;\n break;\n case 'Enter':\n case ' ':\n this.setSelectedTab(enabledTabs[index]);\n break;\n default:\n return;\n }\n\n enabledTabs[index].focus({ preventScroll: true });\n\n if (this.activation === 'auto') {\n this.setSelectedTab(enabledTabs[index]);\n this.emitEvent('igcChange', { detail: this.activeTab });\n } else {\n enabledTabs[index].scrollIntoView({ block: 'nearest' });\n }\n\n event.preventDefault();\n };\n\n @eventOptions({ passive: true })\n protected handleScroll() {\n this.updateScrollButtons();\n }\n\n /** Selects the specified tab and displays the corresponding panel. */\n public select(name: string) {\n this.setSelectedTab(this.tabs.find((el) => el.panel === name));\n }\n\n protected renderScrollButton(direction: 'start' | 'end') {\n const start = direction === 'start';\n\n return this.showScrollButtons\n ? html`<igc-icon-button\n tabindex=\"-1\"\n aria-hidden=\"true\"\n size=\"large\"\n variant=\"flat\"\n collection=\"internal\"\n part=\"${direction}-scroll-button\"\n name=\"navigate_${start ? 'before' : 'next'}\"\n .disabled=${start\n ? this.disableStartScrollButton\n : this.disableEndScrollButton}\n @click=${() => this.scrollByTabOffset(direction)}\n ></igc-icon-button>`\n : nothing;\n }\n\n protected override render() {\n return html`\n <div part=\"headers\">\n ${this.renderScrollButton('start')}\n <div part=\"headers-content\" @scroll=${this.handleScroll}>\n <div part=\"headers-wrapper\">\n <div\n part=\"headers-scroll\"\n role=\"tablist\"\n @click=${this.handleClick}\n @keydown=${this.handleKeyDown}\n >\n <slot></slot>\n </div>\n <div part=\"selected-indicator\"></div>\n </div>\n </div>\n ${this.renderScrollButton('end')}\n </div>\n <div part=\"content\">\n <slot name=\"panel\"></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tabs': IgcTabsComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../../src/components/tabs/tabs.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,sDAAsD,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,MAAM,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,IAAI,EAAE,CAAC;sDAmBlD;AA0ND;IADC,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAG/B;AA5SkB,gBAAgB;IAFpC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACrC,4BAA4B,CAAC,uCAAuC,CAAC;GACjD,gBAAgB,CA+VpC;eA/VoB,gBAAgB","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport {\n eventOptions,\n property,\n query,\n queryAssignedElements,\n state,\n} from 'lit/decorators.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { blazorAdditionalDependencies } from '../common/decorators/blazorAdditionalDependencies.js';\nimport { themes } from '../../theming/theming-decorator.js';\nimport { styles } from './themes/light/tabs.base.css.js';\nimport { styles as bootstrap } from './themes/light/tabs.bootstrap.css.js';\nimport { styles as fluent } from './themes/light/tabs.fluent.css.js';\nimport { styles as indigo } from './themes/light/tabs.indigo.css.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { Constructor } from '../common/mixins/constructor.js';\nimport { createCounter, getOffset, isLTR } from '../common/util.js';\nimport {\n getAttributesForTags,\n getNodesForTags,\n observerConfig,\n} from './utils.js';\n\nimport { defineComponents } from '../common/definitions/defineComponents.js';\nimport IgcTabComponent from './tab.js';\nimport IgcTabPanelComponent from './tab-panel.js';\nimport IgcIconButtonComponent from '../button/icon-button.js';\n\ndefineComponents(IgcTabComponent, IgcTabPanelComponent, IgcIconButtonComponent);\n\nexport interface IgcTabsEventMap {\n igcChange: CustomEvent<IgcTabComponent>;\n}\n\n/**\n * Represents tabs component\n *\n * @element igc-tabs\n *\n * @fires igcChange - Emitted when the selected tab changes.\n *\n * @slot - Renders the tab header.\n * @slot panel - Renders the tab content.\n *\n * @csspart headers - The wrapper of the tabs including the headers content and the scroll buttons.\n * @csspart headers-content - The container for the tab headers.\n * @csspart headers-wrapper - The wrapper for the tab headers and the selected indicator.\n * @csspart headers-scroll - The container for the headers.\n * @csspart selected-indicator - The selected indicator.\n * @csspart start-scroll-button - The start scroll button displayed when the tabs overflow.\n * @csspart end-scroll-button - The end scroll button displayed when the tabs overflow.\n * @csspart content - The container for the tabs content.\n */\n@themes({ bootstrap, fluent, indigo })\n@blazorAdditionalDependencies('IgcTabComponent, IgcTabPanelComponent')\nexport default class IgcTabsComponent extends EventEmitterMixin<\n IgcTabsEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-tabs';\n\n public static styles = styles;\n private static readonly increment = createCounter();\n\n @queryAssignedElements({ selector: 'igc-tab' })\n protected tabs!: Array<IgcTabComponent>;\n\n @queryAssignedElements({ slot: 'panel' })\n protected panels!: Array<IgcTabPanelComponent>;\n\n @query('[part=\"headers-wrapper\"]', true)\n protected wrapper!: HTMLElement;\n\n @query('[part=\"headers-content\"]', true)\n protected container!: HTMLElement;\n\n @query('[part=\"selected-indicator\"]', true)\n protected selectedIndicator!: HTMLElement;\n\n @state()\n protected showScrollButtons = false;\n\n @state()\n protected disableStartScrollButton = true;\n\n @state()\n protected disableEndScrollButton = false;\n\n @state()\n protected activeTab?: IgcTabComponent;\n\n protected resizeObserver!: ResizeObserver;\n protected mutationObserver!: MutationObserver;\n\n protected get enabledTabs() {\n return this.tabs.filter((tab) => !tab.disabled);\n }\n\n /** Returns the currently selected tab. */\n public get selected(): string {\n return this.activeTab?.panel ?? '';\n }\n\n /** Sets the alignment for the tab headers */\n @property({ reflect: true })\n public alignment: 'start' | 'end' | 'center' | 'justify' = 'start';\n\n /**\n * Determines the tab activation. When set to auto,\n * the tab is instantly selected while navigating with the Left/Right Arrows, Home or End keys\n * and the corresponding panel is displayed.\n * When set to manual, the tab is only focused. The selection happens after pressing Space or Enter.\n */\n @property()\n public activation: 'auto' | 'manual' = 'auto';\n\n @watch('alignment', { waitUntilFirstUpdate: true })\n protected alignIndicator() {\n const styles: Partial<CSSStyleDeclaration> = {\n visibility: this.activeTab ? 'visible' : 'hidden',\n transitionDuration: '0.3s',\n };\n\n if (this.activeTab) {\n Object.assign(styles, {\n width: `${this.activeTab!.offsetWidth}px`,\n transform: `translate(${\n isLTR(this)\n ? getOffset(this.activeTab!, this.wrapper).left\n : getOffset(this.activeTab!, this.wrapper).right\n }px)`,\n });\n }\n\n Object.assign(this.selectedIndicator.style, styles);\n }\n\n protected override async firstUpdated() {\n this.showScrollButtons =\n this.container.scrollWidth > this.container.clientWidth;\n\n await this.updateComplete;\n\n this.syncAttributes();\n this.setupObserver();\n this.setSelectedTab(\n this.tabs.filter((tab) => tab.selected).at(-1) ?? this.enabledTabs.at(0)\n );\n }\n\n public override disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.mutationObserver?.disconnect();\n super.disconnectedCallback();\n }\n\n protected updateButtonsOnResize() {\n // Hide the buttons in the resize observer callback and synchronously update the DOM\n // in order to get the actual size\n this.showScrollButtons = false;\n this.performUpdate();\n\n this.showScrollButtons =\n this.container.scrollWidth > this.container.clientWidth;\n\n this.updateScrollButtons();\n }\n\n protected updateScrollButtons() {\n const { scrollLeft, offsetWidth } = this.container,\n { scrollWidth } = this.wrapper;\n\n this.disableEndScrollButton =\n scrollWidth <= Math.abs(scrollLeft) + offsetWidth;\n this.disableStartScrollButton = scrollLeft === 0;\n }\n\n protected setupObserver() {\n this.resizeObserver = new ResizeObserver(() => {\n this.updateButtonsOnResize();\n this.alignIndicator();\n });\n\n [this.container, this.wrapper, ...this.tabs].forEach((element) =>\n this.resizeObserver.observe(element)\n );\n\n this.mutationObserver = new MutationObserver(async (records, observer) => {\n // Stop observing while handling changes\n observer.disconnect();\n\n const attributes = getAttributesForTags<IgcTabComponent>(\n records,\n 'igc-tab'\n );\n const changed = getNodesForTags<IgcTabComponent>(\n records,\n this,\n 'igc-tab'\n );\n\n if (attributes.length > 0) {\n this.activeTab = attributes.find((tab) => tab.selected);\n }\n\n if (changed) {\n changed.addedNodes.forEach((tab) => {\n this.resizeObserver.observe(tab);\n if (tab.selected) {\n this.activeTab = tab;\n }\n });\n changed.removedNodes.forEach((tab) => {\n this.resizeObserver.unobserve(tab);\n if (tab.selected || this.activeTab === tab) {\n this.activeTab = undefined;\n }\n });\n\n this.syncAttributes();\n }\n\n this.updateSelectedTab();\n this.activeTab?.scrollIntoView({ block: 'nearest' });\n this.alignIndicator();\n\n // Watch for changes again\n await this.updateComplete;\n observer.observe(this, observerConfig);\n });\n\n this.mutationObserver.observe(this, observerConfig);\n }\n\n protected updateSelectedTab() {\n this.tabs.forEach((tab) => (tab.selected = tab === this.activeTab));\n this.panels.forEach((panel) =>\n Object.assign(panel.style, {\n display: panel.id === this.activeTab?.panel ? 'block' : 'none',\n })\n );\n }\n\n protected syncAttributes() {\n const prefix = this.id ? `${this.id}-` : '';\n this.tabs.forEach((tab, index) => {\n if (!tab.panel) {\n tab.panel =\n this.panels.at(index)?.id ??\n `${prefix}tab-${IgcTabsComponent.increment()}`;\n }\n this.panels\n .find((panel) => panel.id === tab.panel)\n ?.setAttribute('aria-labelledby', tab.id);\n });\n }\n\n private setSelectedTab(tab?: IgcTabComponent) {\n if (!tab || tab === this.activeTab) {\n return;\n }\n\n if (this.activeTab) {\n this.activeTab.selected = false;\n }\n\n this.activeTab = tab;\n this.activeTab.selected = true;\n }\n\n protected scrollByTabOffset(direction: 'start' | 'end') {\n const { scrollLeft, offsetWidth } = this.container;\n const LTR = isLTR(this),\n next = direction === 'end';\n\n const pivot = Math.abs(next ? offsetWidth + scrollLeft : scrollLeft);\n\n let amount = this.tabs\n .map((tab) => ({\n start: LTR\n ? getOffset(tab, this.wrapper).left\n : Math.abs(getOffset(tab, this.wrapper).right),\n width: tab.offsetWidth,\n }))\n .filter((offset) =>\n next ? offset.start + offset.width > pivot : offset.start < pivot\n )\n .at(next ? 0 : -1)!.width;\n\n amount *= next ? 1 : -1;\n this.container.scrollBy({ left: LTR ? amount : -amount });\n }\n\n protected handleClick(event: MouseEvent) {\n const target = event.target as HTMLElement;\n const tab = target.closest('igc-tab');\n\n if (!(tab && this.contains(tab)) || tab.disabled) {\n return;\n }\n\n tab.focus();\n this.setSelectedTab(tab);\n this.emitEvent('igcChange', { detail: this.activeTab });\n }\n\n protected handleKeyDown = (event: KeyboardEvent) => {\n const { key } = event;\n const enabledTabs = this.enabledTabs;\n const ltr = isLTR(this);\n\n let index = enabledTabs.indexOf(\n document.activeElement?.closest('igc-tab') as IgcTabComponent\n );\n\n switch (key) {\n case 'ArrowLeft':\n index = ltr\n ? (enabledTabs.length + index - 1) % enabledTabs.length\n : (index + 1) % enabledTabs.length;\n break;\n case 'ArrowRight':\n index = ltr\n ? (index + 1) % enabledTabs.length\n : (enabledTabs.length + index - 1) % enabledTabs.length;\n break;\n case 'Home':\n index = 0;\n break;\n case 'End':\n index = enabledTabs.length - 1;\n break;\n case 'Enter':\n case ' ':\n this.setSelectedTab(enabledTabs[index]);\n break;\n default:\n return;\n }\n\n enabledTabs[index].focus({ preventScroll: true });\n\n if (this.activation === 'auto') {\n this.setSelectedTab(enabledTabs[index]);\n this.emitEvent('igcChange', { detail: this.activeTab });\n } else {\n enabledTabs[index].scrollIntoView({ block: 'nearest' });\n }\n\n event.preventDefault();\n };\n\n @eventOptions({ passive: true })\n protected handleScroll() {\n this.updateScrollButtons();\n }\n\n /** Selects the specified tab and displays the corresponding panel. */\n public select(name: string) {\n this.setSelectedTab(this.tabs.find((el) => el.panel === name));\n }\n\n protected renderScrollButton(direction: 'start' | 'end') {\n const start = direction === 'start';\n\n return this.showScrollButtons\n ? html`<igc-icon-button\n tabindex=\"-1\"\n aria-hidden=\"true\"\n size=\"large\"\n variant=\"flat\"\n collection=\"internal\"\n part=\"${direction}-scroll-button\"\n name=\"navigate_${start ? 'before' : 'next'}\"\n .disabled=${start\n ? this.disableStartScrollButton\n : this.disableEndScrollButton}\n @click=${() => this.scrollByTabOffset(direction)}\n ></igc-icon-button>`\n : nothing;\n }\n\n protected override render() {\n return html`\n <div part=\"headers\">\n ${this.renderScrollButton('start')}\n <div part=\"headers-content\" @scroll=${this.handleScroll}>\n <div part=\"headers-wrapper\">\n <div\n part=\"headers-scroll\"\n role=\"tablist\"\n @click=${this.handleClick}\n @keydown=${this.handleKeyDown}\n >\n <slot></slot>\n </div>\n <div part=\"selected-indicator\"></div>\n </div>\n </div>\n ${this.renderScrollButton('end')}\n </div>\n <div part=\"content\">\n <slot name=\"panel\"></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tabs': IgcTabsComponent;\n }\n}\n"]}
|
|
@@ -42,6 +42,15 @@ let IgcToastComponent = class IgcToastComponent extends LitElement {
|
|
|
42
42
|
this.show();
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
connectedCallback() {
|
|
46
|
+
super.connectedCallback();
|
|
47
|
+
if (!this.hasAttribute('role')) {
|
|
48
|
+
this.setAttribute('role', 'alert');
|
|
49
|
+
}
|
|
50
|
+
if (!this.hasAttribute('aria-live')) {
|
|
51
|
+
this.setAttribute('aria-live', 'polite');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
45
54
|
render() {
|
|
46
55
|
return html `<slot></slot>`;
|
|
47
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../../src/components/toast/toast.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAWhE,IAAqB,iBAAiB,GAAtC,MAA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AC,WAAW,CAAC,CAAC;SACtB;IACH,CAAC;IAGM,MAAM;QACX,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,IAAI,EAAE,CAAC;SACb;aAAM;YACL,IAAI,CAAC,IAAI,EAAE,CAAC;SACb;IACH,CAAC;IAEe,iBAAiB;QAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;YAC9B,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACpC;QACD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;YACnC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;SAC1C;IACH,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;CACF,CAAA;AA/De,yBAAO,GAAG,WAAY,CAAA;AAGb,wBAAM,GAAG,CAAC,MAAM,CAAE,CAAA;AAMzC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CACvB;AAIpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;sDAC5C;AAI1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;mDAC3C;AAnBL,iBAAiB;IADrC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;GACjB,iBAAiB,CAiErC;eAjEoB,iBAAiB","sourcesContent":["import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { themes } from '../../theming/theming-decorator.js';\nimport { styles } from './themes/toast.base.css.js';\nimport { styles as bootstrap } from './themes/toast.bootstrap.css.js';\nimport { styles as fluent } from './themes/toast.fluent.css.js';\nimport { styles as indigo } from './themes/toast.indigo.css.js';\n\n/**\n * A toast component is used to show a notification\n *\n * @element igc-toast\n *\n * @csspart base - The base wrapper of the toast.\n */\n\n@themes({ bootstrap, fluent, indigo })\nexport default class IgcToastComponent extends LitElement {\n /** @private */\n public static tagName = 'igc-toast';\n\n /** @private */\n public static override styles = [styles];\n\n private displayTimeout: any;\n\n /** Determines whether the toast is opened. */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /** Determines the time after which the toast will close */\n @property({ type: Number, reflect: false, attribute: 'display-time' })\n public displayTime = 4000;\n\n /** Determines whether the toast is closed automatically or not. */\n @property({ type: Boolean, reflect: true, attribute: 'keep-open' })\n public keepOpen = false;\n\n /** Closes the toast. */\n public hide() {\n if (this.open) {\n this.open = false;\n }\n }\n\n /** Opens the toast. */\n public show() {\n window.clearTimeout(this.displayTimeout);\n\n if (!this.open) {\n this.open = true;\n }\n\n if (this.keepOpen === false) {\n this.displayTimeout = setTimeout(() => {\n this.open = false;\n }, this.displayTime);\n }\n }\n\n /** Toggles the open state of the toast. */\n public toggle() {\n if (this.open) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n public override connectedCallback() {\n super.connectedCallback();\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'alert');\n }\n if (!this.hasAttribute('aria-live')) {\n this.setAttribute('aria-live', 'polite');\n }\n }\n\n protected override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-toast': IgcToastComponent;\n }\n}\n"]}
|
|
@@ -25,6 +25,12 @@ export declare class IgcToggleController implements ReactiveController {
|
|
|
25
25
|
private initialScrollLeft;
|
|
26
26
|
private _target;
|
|
27
27
|
private _hide?;
|
|
28
|
+
private _abortController;
|
|
29
|
+
/**
|
|
30
|
+
* Abort controller used to clean up document level event listeners
|
|
31
|
+
* See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#add_an_abortable_listener
|
|
32
|
+
*/
|
|
33
|
+
protected get abortController(): AbortController;
|
|
28
34
|
/** The directive that marks the toggle. */
|
|
29
35
|
toggleDirective: DirectiveResult<typeof IgcToggleDirective>;
|
|
30
36
|
rendered: Promise<void>;
|
|
@@ -32,12 +38,11 @@ export declare class IgcToggleController implements ReactiveController {
|
|
|
32
38
|
/** The element, relative to which, the toggle will be positioned. */
|
|
33
39
|
get target(): HTMLElement;
|
|
34
40
|
constructor(host: ToggleHost, config?: ToggleControllerConfig);
|
|
35
|
-
hostConnected(): void;
|
|
36
41
|
hostDisconnected(): void;
|
|
37
42
|
update(): void;
|
|
38
43
|
protected hide(): void;
|
|
39
44
|
private addEventListeners;
|
|
40
|
-
private
|
|
45
|
+
private configureListeners;
|
|
41
46
|
private blockScroll;
|
|
42
47
|
/** The document's click event handler to override in the host component if necessary. */
|
|
43
48
|
private documentClicked;
|