@taiga-ui/kit 5.0.0-rc.2 → 5.0.0-rc.3
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/components/calendar-month/calendar-month.component.d.ts +4 -3
- package/components/copy/button-copy.component.d.ts +17 -0
- package/components/copy/copy.d.ts +2 -1
- package/components/copy/copy.directive.d.ts +5 -2
- package/components/copy/copy.options.d.ts +1 -3
- package/components/copy/index.d.ts +1 -0
- package/components/index.d.ts +0 -3
- package/components/input-chip/input-chip.component.d.ts +5 -0
- package/components/input-chip/input-chip.directive.d.ts +1 -1
- package/components/input-date/input-date.directive.d.ts +2 -2
- package/components/input-date/input-date.options.d.ts +2 -4
- package/components/input-date-multi/input-date-multi.directive.d.ts +1 -1
- package/components/input-month/input-month.directive.d.ts +1 -1
- package/components/input-month/input-month.options.d.ts +1 -7
- package/components/input-month-range/input-month-range.directive.d.ts +1 -1
- package/components/input-month-range/input-month-range.options.d.ts +1 -3
- package/components/input-number/input-number.directive.d.ts +1 -0
- package/components/input-slider/input-slider.d.ts +1 -1
- package/components/input-time/input-time.directive.d.ts +1 -1
- package/components/input-time/input-time.options.d.ts +1 -3
- package/components/input-year/input-year.directive.d.ts +1 -1
- package/components/line-clamp/line-clamp-box.component.d.ts +2 -0
- package/components/line-clamp/line-clamp.component.d.ts +2 -0
- package/components/range/range.component.d.ts +2 -2
- package/components/select/select-option/select-option.component.d.ts +1 -1
- package/components/switch/switch.component.d.ts +1 -1
- package/components/switch/switch.options.d.ts +1 -1
- package/directives/password/password.options.d.ts +2 -4
- package/fesm2022/taiga-ui-kit-components-avatar.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-avatar.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-badge.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-badge.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-block.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-block.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-calendar-month.mjs +24 -14
- package/fesm2022/taiga-ui-kit-components-calendar-month.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-chip.mjs +3 -3
- package/fesm2022/taiga-ui-kit-components-chip.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-comment.mjs +3 -3
- package/fesm2022/taiga-ui-kit-components-comment.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-compass.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-compass.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-copy.mjs +87 -24
- package/fesm2022/taiga-ui-kit-components-copy.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-data-list-wrapper.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-data-list-wrapper.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-chip.mjs +11 -7
- package/fesm2022/taiga-ui-kit-components-input-chip.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-color.mjs +3 -3
- package/fesm2022/taiga-ui-kit-components-input-color.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-date-multi.mjs +3 -2
- package/fesm2022/taiga-ui-kit-components-input-date-multi.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-date.mjs +6 -5
- package/fesm2022/taiga-ui-kit-components-input-date.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-month-range.mjs +3 -2
- package/fesm2022/taiga-ui-kit-components-input-month-range.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-month.mjs +4 -10
- package/fesm2022/taiga-ui-kit-components-input-month.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-number.mjs +9 -4
- package/fesm2022/taiga-ui-kit-components-input-number.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-phone.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-input-phone.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-pin.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-input-pin.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-range.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-slider.mjs +1 -1
- package/fesm2022/taiga-ui-kit-components-input-slider.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-time.mjs +4 -3
- package/fesm2022/taiga-ui-kit-components-input-time.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-year.mjs +3 -2
- package/fesm2022/taiga-ui-kit-components-input-year.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-like.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-like.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-line-clamp.mjs +16 -5
- package/fesm2022/taiga-ui-kit-components-line-clamp.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-message.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-message.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-multi-select.mjs +5 -5
- package/fesm2022/taiga-ui-kit-components-multi-select.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-pin.mjs +3 -3
- package/fesm2022/taiga-ui-kit-components-pin.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-preview.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-preview.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-progress.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-progress.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-radio-list.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-radio-list.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-range.mjs +17 -14
- package/fesm2022/taiga-ui-kit-components-range.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-select.mjs +6 -9
- package/fesm2022/taiga-ui-kit-components-select.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-status.mjs +3 -3
- package/fesm2022/taiga-ui-kit-components-status.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-switch.mjs +3 -3
- package/fesm2022/taiga-ui-kit-components-switch.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-tabs.mjs +13 -8
- package/fesm2022/taiga-ui-kit-components-tabs.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-textarea.mjs +4 -4
- package/fesm2022/taiga-ui-kit-components-textarea.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-toast.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-toast.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components.mjs +0 -3
- package/fesm2022/taiga-ui-kit-components.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-chevron.mjs +2 -2
- package/fesm2022/taiga-ui-kit-directives-chevron.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-fade.mjs +2 -2
- package/fesm2022/taiga-ui-kit-directives-fade.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-password.mjs +1 -7
- package/fesm2022/taiga-ui-kit-directives-password.mjs.map +1 -1
- package/package.json +32 -45
- package/components/checkbox/checkbox.component.d.ts +0 -10
- package/components/checkbox/checkbox.options.d.ts +0 -10
- package/components/checkbox/index.d.ts +0 -2
- package/components/radio/index.d.ts +0 -4
- package/components/radio/radio.component.d.ts +0 -18
- package/components/radio/radio.d.ts +0 -3
- package/components/radio/radio.directive.d.ts +0 -8
- package/components/radio/radio.options.d.ts +0 -7
- package/components/slider/helpers/key-steps.d.ts +0 -27
- package/components/slider/helpers/slider-key-steps.directive.d.ts +0 -32
- package/components/slider/helpers/slider-readonly.directive.d.ts +0 -15
- package/components/slider/helpers/slider-thumb-label.component.d.ts +0 -13
- package/components/slider/index.d.ts +0 -6
- package/components/slider/slider.component.d.ts +0 -22
- package/components/slider/slider.d.ts +0 -5
- package/fesm2022/taiga-ui-kit-components-checkbox.mjs +0 -37
- package/fesm2022/taiga-ui-kit-components-checkbox.mjs.map +0 -1
- package/fesm2022/taiga-ui-kit-components-radio.mjs +0 -91
- package/fesm2022/taiga-ui-kit-components-radio.mjs.map +0 -1
- package/fesm2022/taiga-ui-kit-components-slider.mjs +0 -337
- package/fesm2022/taiga-ui-kit-components-slider.mjs.map +0 -1
- package/styles/components/avatar.less +0 -188
- package/styles/components/badge.less +0 -127
- package/styles/components/block.less +0 -118
- package/styles/components/checkbox.less +0 -84
- package/styles/components/chip.less +0 -131
- package/styles/components/comment.less +0 -64
- package/styles/components/compass.less +0 -49
- package/styles/components/like.less +0 -67
- package/styles/components/message.less +0 -33
- package/styles/components/pin.less +0 -164
- package/styles/components/progress-bar.less +0 -117
- package/styles/components/radio.less +0 -59
- package/styles/components/status.less +0 -40
- package/styles/components/switch.less +0 -103
- package/styles/components/toast.less +0 -44
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-radio.mjs","sources":["../../../projects/kit/components/radio/radio.options.ts","../../../projects/kit/components/radio/radio.component.ts","../../../projects/kit/components/radio/radio.directive.ts","../../../projects/kit/components/radio/radio.ts","../../../projects/kit/components/radio/taiga-ui-kit-components-radio.ts"],"sourcesContent":["import {type TuiStringHandler} from '@taiga-ui/cdk/types';\nimport {tuiCreateOptions} from '@taiga-ui/cdk/utils/di';\nimport {type TuiSizeS} from '@taiga-ui/core/types';\n\nexport interface TuiRadioOptions {\n readonly appearance: TuiStringHandler<HTMLInputElement>;\n readonly size: TuiSizeS;\n}\n\nexport const [TUI_RADIO_OPTIONS, tuiRadioOptionsProvider] =\n tuiCreateOptions<TuiRadioOptions>({\n size: 'm',\n appearance: ({checked}) => (checked ? 'primary' : 'outline-grayscale'),\n });\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n type DoCheck,\n inject,\n input,\n type OnInit,\n ViewEncapsulation,\n} from '@angular/core';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {NgControl, NgModel} from '@angular/forms';\nimport {TUI_VERSION} from '@taiga-ui/cdk/constants';\nimport {TuiNativeValidator} from '@taiga-ui/cdk/directives/native-validator';\nimport {tuiControlValue} from '@taiga-ui/cdk/observables';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport {TuiAppearance, tuiAppearance} from '@taiga-ui/core/directives/appearance';\nimport {distinctUntilChanged} from 'rxjs';\n\nimport {TUI_RADIO_OPTIONS, type TuiRadioOptions} from './radio.options';\n\n@Component({\n selector: 'input[type=\"radio\"][tuiRadio]',\n template: '',\n styles: `\n [data-tui-version='${TUI_VERSION}'] {\n @import '@taiga-ui/kit/styles/components/radio.less';\n }\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n hostDirectives: [\n {\n directive: TuiAppearance,\n inputs: ['tuiAppearanceState', 'tuiAppearanceFocus', 'tuiAppearanceMode'],\n },\n TuiNativeValidator,\n ],\n host: {\n '[disabled]': '!control || control.disabled',\n '[attr.data-size]': 'size()',\n '[class._readonly]': '!control',\n },\n})\nexport class TuiRadioComponent<T extends TuiRadioOptions> implements DoCheck, OnInit {\n private readonly destroyRef = inject(DestroyRef);\n\n protected readonly el = tuiInjectElement<HTMLInputElement>();\n protected readonly options = inject<T>(TUI_RADIO_OPTIONS);\n protected readonly appearance = tuiAppearance(this.options.appearance(this.el));\n protected readonly control = inject(NgControl, {self: true, optional: true});\n\n public readonly size = input(this.options.size);\n\n public ngOnInit(): void {\n tuiControlValue(this.control)\n .pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))\n .subscribe((value) => {\n // https://github.com/angular/angular/issues/14988\n const fix =\n this.control instanceof NgModel && value == null\n ? this.control.model\n : value;\n\n this.el.indeterminate = fix == null && this.el.matches('[tuiCheckbox]');\n this.ngDoCheck();\n });\n }\n\n public ngDoCheck(): void {\n this.appearance.set(this.options.appearance(this.el));\n }\n}\n","import {Directive, inject, input} from '@angular/core';\nimport {RadioControlValueAccessor} from '@angular/forms';\nimport {TUI_DEFAULT_IDENTITY_MATCHER} from '@taiga-ui/cdk/constants';\nimport {type TuiIdentityMatcher} from '@taiga-ui/cdk/types';\n\n@Directive({selector: 'input[type=\"radio\"][tuiRadio][identityMatcher]'})\nexport class TuiRadioDirective<T> {\n public readonly identityMatcher = input<TuiIdentityMatcher<T>>(\n TUI_DEFAULT_IDENTITY_MATCHER,\n );\n\n constructor() {\n const accessor = inject(RadioControlValueAccessor);\n const writeValue = accessor.writeValue.bind(accessor);\n\n accessor.writeValue = (value: T) => {\n if (this.identityMatcher()(value, accessor.value)) {\n writeValue(accessor.value);\n } else {\n writeValue(value);\n }\n };\n }\n}\n","import {TuiRadioComponent} from './radio.component';\nimport {TuiRadioDirective} from './radio.directive';\n\nexport const TuiRadio = [TuiRadioComponent, TuiRadioDirective] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MASa,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,GACrD,gBAAgB,CAAkB;AAC9B,IAAA,IAAI,EAAE,GAAG;AACT,IAAA,UAAU,EAAE,CAAC,EAAC,OAAO,EAAC,MAAM,OAAO,GAAG,SAAS,GAAG,mBAAmB,CAAC;AACzE,CAAA;;MC+BQ,iBAAiB,CAAA;AAvB9B,IAAA,WAAA,GAAA;AAwBqB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAE7B,IAAE,CAAA,EAAA,GAAG,gBAAgB,EAAoB;AACzC,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAI,iBAAiB,CAAC;AACtC,QAAA,IAAA,CAAA,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5D,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,SAAS,EAAE,EAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;QAE5D,IAAI,CAAA,IAAA,G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EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAD7B,SAAS;mBAAC,EAAC,QAAQ,EAAE,gDAAgD,EAAC;;;MCF1D,QAAQ,GAAG,CAAC,iBAAiB,EAAE,iBAAiB;;ACH7D;;AAEG;;;;"}
|
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { tuiRound } from '@taiga-ui/cdk/utils/math';
|
|
2
|
-
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, computed, input, ChangeDetectionStrategy, Component, INJECTOR, signal, effect, Directive, contentChild } from '@angular/core';
|
|
4
|
-
import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
-
import { NgControl, NgModel } from '@angular/forms';
|
|
6
|
-
import { TuiControl, TUI_IDENTITY_VALUE_TRANSFORMER } from '@taiga-ui/cdk/classes';
|
|
7
|
-
import { tuiWatch, tuiControlValue, tuiTypedFromEvent } from '@taiga-ui/cdk/observables';
|
|
8
|
-
import { tuiFallbackValueProvider } from '@taiga-ui/cdk/tokens';
|
|
9
|
-
import { take, timer, switchMap, merge, tap, map, combineLatest, filter } from 'rxjs';
|
|
10
|
-
import { tuiInjectElement } from '@taiga-ui/cdk/utils/dom';
|
|
11
|
-
import { tuiIsNumber } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
12
|
-
import { tuiAsAuxiliary } from '@taiga-ui/core/tokens';
|
|
13
|
-
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
14
|
-
import { DOCUMENT, AsyncPipe } from '@angular/common';
|
|
15
|
-
import { TUI_TRUE_HANDLER, TUI_FALSE_HANDLER } from '@taiga-ui/cdk/constants';
|
|
16
|
-
import { tuiHintOptionsProvider } from '@taiga-ui/core/portals/hint';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Used as a limit for eliminating JS issues with floating point math
|
|
20
|
-
*/
|
|
21
|
-
const TUI_FLOATING_PRECISION = 7;
|
|
22
|
-
function tuiFindKeyStepsBoundariesByFn(keySteps, fn) {
|
|
23
|
-
const keyStepUpperIndex = keySteps.findIndex((keyStep, i) => i && fn(keyStep));
|
|
24
|
-
const lowerStep = keySteps[keyStepUpperIndex - 1] || keySteps[0];
|
|
25
|
-
const upperStep = keySteps[keyStepUpperIndex] ||
|
|
26
|
-
keySteps[keySteps.length - 1] || [0, 0];
|
|
27
|
-
return [lowerStep, upperStep];
|
|
28
|
-
}
|
|
29
|
-
function tuiPercentageToKeyStepValue(valuePercentage, keySteps) {
|
|
30
|
-
const [[lowerStepPercent, lowerStepValue], [upperStepPercent, upperStepValue]] = tuiFindKeyStepsBoundariesByFn(keySteps, ([keyStepPercentage, _]) => valuePercentage <= keyStepPercentage);
|
|
31
|
-
const ratio = (valuePercentage - lowerStepPercent) / (upperStepPercent - lowerStepPercent);
|
|
32
|
-
const controlValue = (upperStepValue - lowerStepValue) * ratio + lowerStepValue;
|
|
33
|
-
return tuiRound(controlValue, TUI_FLOATING_PRECISION);
|
|
34
|
-
}
|
|
35
|
-
function tuiKeyStepValueToPercentage(value, keySteps) {
|
|
36
|
-
const [[lowerStepPercent, lowerStepValue], [upperStepPercent, upperStepValue]] = tuiFindKeyStepsBoundariesByFn(keySteps, ([_, keyStepValue]) => value <= keyStepValue);
|
|
37
|
-
const ratio = (value - lowerStepValue) / (upperStepValue - lowerStepValue) || 0;
|
|
38
|
-
return (upperStepPercent - lowerStepPercent) * ratio + lowerStepPercent;
|
|
39
|
-
}
|
|
40
|
-
function tuiCreateKeyStepsTransformer(keySteps) {
|
|
41
|
-
return new (class {
|
|
42
|
-
fromControlValue(controlValue) {
|
|
43
|
-
return tuiKeyStepValueToPercentage(controlValue, keySteps) / 100;
|
|
44
|
-
}
|
|
45
|
-
toControlValue(ratio) {
|
|
46
|
-
return tuiPercentageToKeyStepValue(ratio * 100, keySteps);
|
|
47
|
-
}
|
|
48
|
-
})();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
class TuiSliderComponent {
|
|
52
|
-
constructor() {
|
|
53
|
-
this.control = inject(NgControl, { self: true, optional: true });
|
|
54
|
-
this.ticksGradient = computed((segments = this.segments()) => this.getTicksGradient(segments));
|
|
55
|
-
this.segments = input([1], {
|
|
56
|
-
alias: 'segments',
|
|
57
|
-
transform: (x) => tuiIsNumber(x) ? Array.from({ length: x }, (_, i) => i / x) : x,
|
|
58
|
-
});
|
|
59
|
-
this.el = tuiInjectElement();
|
|
60
|
-
this.keySteps = inject(TuiSliderKeyStepsBase, {
|
|
61
|
-
self: true,
|
|
62
|
-
optional: true,
|
|
63
|
-
});
|
|
64
|
-
if (this.control instanceof NgModel) {
|
|
65
|
-
/**
|
|
66
|
-
* The ValueAccessor.writeValue method is called twice on any value accessor during component initialization,
|
|
67
|
-
* when a control is bound using [(ngModel)], first time with a phantom null value.
|
|
68
|
-
* With `changeDetection: ChangeDetectionStrategy.OnPush` the second call of writeValue with real value don't re-render the view.
|
|
69
|
-
* ___
|
|
70
|
-
* See this {@link https://github.com/angular/angular/issues/14988 issue}
|
|
71
|
-
*/
|
|
72
|
-
this.control.valueChanges?.pipe(tuiWatch(), take(1)).subscribe();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
get valueRatio() {
|
|
76
|
-
return (this.value - this.min) / (this.max - this.min) || 0;
|
|
77
|
-
}
|
|
78
|
-
get min() {
|
|
79
|
-
return Number(this.el.min);
|
|
80
|
-
}
|
|
81
|
-
set min(x) {
|
|
82
|
-
this.el.min = String(x);
|
|
83
|
-
}
|
|
84
|
-
get max() {
|
|
85
|
-
return Number(this.el.max || 100);
|
|
86
|
-
}
|
|
87
|
-
set max(x) {
|
|
88
|
-
this.el.max = String(x);
|
|
89
|
-
}
|
|
90
|
-
get step() {
|
|
91
|
-
if (!this.el.step) {
|
|
92
|
-
return 1;
|
|
93
|
-
}
|
|
94
|
-
return this.el.step === 'any' ? 0 : Number(this.el.step);
|
|
95
|
-
}
|
|
96
|
-
set step(x) {
|
|
97
|
-
this.el.step = String(x);
|
|
98
|
-
}
|
|
99
|
-
get value() {
|
|
100
|
-
/**
|
|
101
|
-
* If developer uses `[(ngModel)]` and programmatically change value,
|
|
102
|
-
* the `el.nativeElement.value` is equal to the previous value at this moment
|
|
103
|
-
* (it will be updated only in next microtask).
|
|
104
|
-
* @see https://github.com/angular/angular/issues/13568
|
|
105
|
-
*/
|
|
106
|
-
if (this.control instanceof NgModel) {
|
|
107
|
-
const transformer = this.keySteps?.transformer();
|
|
108
|
-
const value = this.keySteps && transformer
|
|
109
|
-
? this.keySteps.toSliderValue(transformer.fromControlValue(this.control.value))
|
|
110
|
-
: this.control.viewModel;
|
|
111
|
-
return this.step
|
|
112
|
-
? tuiRound(Math.round(value / this.step) * this.step, TUI_FLOATING_PRECISION)
|
|
113
|
-
: value;
|
|
114
|
-
}
|
|
115
|
-
return Number(this.el.value) || 0;
|
|
116
|
-
}
|
|
117
|
-
set value(newValue) {
|
|
118
|
-
this.el.value = `${newValue}`;
|
|
119
|
-
}
|
|
120
|
-
getTicksGradient(segments) {
|
|
121
|
-
if (segments.length <= 1) {
|
|
122
|
-
return 'linear-gradient(to right, transparent 0 100%)';
|
|
123
|
-
}
|
|
124
|
-
const percentages = segments
|
|
125
|
-
.filter((segment) => segment > 0 && segment < 1)
|
|
126
|
-
.map((segment) => segment * 100);
|
|
127
|
-
return percentages.reduce((acc, segment, index) => `${acc}
|
|
128
|
-
var(--tui-text-tertiary) ${segment}% calc(${segment}% + var(--t-tick-thickness)),
|
|
129
|
-
transparent ${segment}% ${percentages[index + 1] ?? 100}%${percentages[index + 1] ? ',' : ')'}
|
|
130
|
-
`, `linear-gradient(to right, transparent 0 ${percentages[0]}%,`);
|
|
131
|
-
}
|
|
132
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiSliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
133
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.18", type: TuiSliderComponent, isStandalone: true, selector: "input[type=range][tuiSlider]", inputs: { segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "input": "0" }, properties: { "style.--tui-ticks-gradient": "ticksGradient()", "style.--tui-slider-fill-ratio": "valueRatio" } }, providers: [tuiAsAuxiliary(TuiSliderComponent)], ngImport: i0, template: '', isInline: true, styles: [":host{--t-tick-thickness: .25rem;position:relative;display:block;inline-size:100%;color:var(--tui-background-accent-1);cursor:pointer;-webkit-appearance:none;appearance:none;block-size:max(var(--tui-thumb-size, .75rem),1rem);padding:calc((max(var(--tui-thumb-size, .75rem),1rem) - max(calc(calc(var(--tui-thumb-size, .75rem) / 2) - .25rem),.125rem))/2) 0;box-sizing:border-box;outline:none;border-radius:1rem/3rem;background:var(--tui-ticks-gradient) no-repeat calc((var(--tui-thumb-size, .75rem) - var(--t-tick-thickness)) / 2) / calc(100% - var(--tui-thumb-size, .75rem)),linear-gradient(to var(--tui-inline-end),currentColor calc(100% * var(--tui-slider-fill-ratio)),transparent calc(100% * var(--tui-slider-fill-ratio))),var(--tui-background-neutral-2);background-clip:content-box}:host:active{cursor:ew-resize}:host:active:before{opacity:.2;transform:var(--tui-slider-thumb-transform, scale(1)) scale(2.33)}:host:disabled{opacity:var(--tui-disabled-opacity);pointer-events:none}:host:before{transition-property:transform,opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;top:calc(max(calc(1rem - var(--tui-thumb-size, .75rem)),0rem)/2);inset-inline-start:var(--t-left);inline-size:var(--tui-thumb-size, .75rem);block-size:var(--tui-thumb-size, .75rem);border-radius:50%;transform:var(--tui-slider-thumb-transform, scale(1));cursor:ew-resize;background:currentColor;opacity:0;--t-left: calc(var(--tui-slider-fill-ratio) * 100% - var(--tui-slider-fill-ratio) * var(--tui-thumb-size, .75rem))}:host:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host:focus-visible::-moz-range-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host::-webkit-slider-thumb{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;isolation:isolate;-webkit-appearance:none;appearance:none;background-color:currentColor;box-shadow:none;border-radius:50%;block-size:var(--tui-thumb-size, .75rem);inline-size:var(--tui-thumb-size, .75rem);box-sizing:content-box;background-clip:content-box;border:calc(max(calc(1rem - var(--tui-thumb-size, .75rem)),0rem)/2) solid transparent;border-inline-start:0;border-inline-end:0;transform:var(--tui-slider-thumb-transform, scale(1))}:not(:disabled):host::-webkit-slider-thumb{cursor:ew-resize}:not(:disabled):host::-webkit-slider-thumb:hover,:active:not(:disabled):host::-webkit-slider-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.333)}:host::-moz-range-thumb{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;isolation:isolate;-webkit-appearance:none;appearance:none;background-color:currentColor;box-shadow:none;border-radius:50%;block-size:var(--tui-thumb-size, .75rem);inline-size:var(--tui-thumb-size, .75rem);box-sizing:content-box;background-clip:content-box;border:calc(max(calc(1rem - var(--tui-thumb-size, .75rem)),0rem)/2) solid transparent;border-inline-start:0;border-inline-end:0;transform:var(--tui-slider-thumb-transform, scale(1))}:not(:disabled):host::-moz-range-thumb{cursor:ew-resize}:not(:disabled):host::-moz-range-thumb:hover,:active:not(:disabled):host::-moz-range-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.333)}:host::-moz-range-progress{opacity:0}:host-context(tui-textfield) :host([type=\"range\"]){position:absolute;inset:100% var(--t-padding) 0;inline-size:auto;margin:calc(-.5*max(calc(calc(var(--tui-thumb-size, .75rem) / 2) - .25rem),.125rem)) 0 0;transform:translateY(-50%);background-color:transparent;pointer-events:auto}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
134
|
-
}
|
|
135
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiSliderComponent, decorators: [{
|
|
136
|
-
type: Component,
|
|
137
|
-
args: [{ selector: 'input[type=range][tuiSlider]', template: '', changeDetection: ChangeDetectionStrategy.OnPush, providers: [tuiAsAuxiliary(TuiSliderComponent)], host: {
|
|
138
|
-
/**
|
|
139
|
-
* For change detection.
|
|
140
|
-
* Webkit does not have built-in method for customization of filling progress (as Firefox).
|
|
141
|
-
* We draw filling of progress by `background: linear-gradient(...)` of the track.
|
|
142
|
-
* This function triggers change detection (for {@link valueRatio} getter) when we drag thumb of the input.
|
|
143
|
-
*/
|
|
144
|
-
'(input)': '0',
|
|
145
|
-
'[style.--tui-ticks-gradient]': 'ticksGradient()',
|
|
146
|
-
'[style.--tui-slider-fill-ratio]': 'valueRatio',
|
|
147
|
-
}, styles: [":host{--t-tick-thickness: .25rem;position:relative;display:block;inline-size:100%;color:var(--tui-background-accent-1);cursor:pointer;-webkit-appearance:none;appearance:none;block-size:max(var(--tui-thumb-size, .75rem),1rem);padding:calc((max(var(--tui-thumb-size, .75rem),1rem) - max(calc(calc(var(--tui-thumb-size, .75rem) / 2) - .25rem),.125rem))/2) 0;box-sizing:border-box;outline:none;border-radius:1rem/3rem;background:var(--tui-ticks-gradient) no-repeat calc((var(--tui-thumb-size, .75rem) - var(--t-tick-thickness)) / 2) / calc(100% - var(--tui-thumb-size, .75rem)),linear-gradient(to var(--tui-inline-end),currentColor calc(100% * var(--tui-slider-fill-ratio)),transparent calc(100% * var(--tui-slider-fill-ratio))),var(--tui-background-neutral-2);background-clip:content-box}:host:active{cursor:ew-resize}:host:active:before{opacity:.2;transform:var(--tui-slider-thumb-transform, scale(1)) scale(2.33)}:host:disabled{opacity:var(--tui-disabled-opacity);pointer-events:none}:host:before{transition-property:transform,opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;top:calc(max(calc(1rem - var(--tui-thumb-size, .75rem)),0rem)/2);inset-inline-start:var(--t-left);inline-size:var(--tui-thumb-size, .75rem);block-size:var(--tui-thumb-size, .75rem);border-radius:50%;transform:var(--tui-slider-thumb-transform, scale(1));cursor:ew-resize;background:currentColor;opacity:0;--t-left: calc(var(--tui-slider-fill-ratio) * 100% - var(--tui-slider-fill-ratio) * var(--tui-thumb-size, .75rem))}:host:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host:focus-visible::-moz-range-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host::-webkit-slider-thumb{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;isolation:isolate;-webkit-appearance:none;appearance:none;background-color:currentColor;box-shadow:none;border-radius:50%;block-size:var(--tui-thumb-size, .75rem);inline-size:var(--tui-thumb-size, .75rem);box-sizing:content-box;background-clip:content-box;border:calc(max(calc(1rem - var(--tui-thumb-size, .75rem)),0rem)/2) solid transparent;border-inline-start:0;border-inline-end:0;transform:var(--tui-slider-thumb-transform, scale(1))}:not(:disabled):host::-webkit-slider-thumb{cursor:ew-resize}:not(:disabled):host::-webkit-slider-thumb:hover,:active:not(:disabled):host::-webkit-slider-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.333)}:host::-moz-range-thumb{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;isolation:isolate;-webkit-appearance:none;appearance:none;background-color:currentColor;box-shadow:none;border-radius:50%;block-size:var(--tui-thumb-size, .75rem);inline-size:var(--tui-thumb-size, .75rem);box-sizing:content-box;background-clip:content-box;border:calc(max(calc(1rem - var(--tui-thumb-size, .75rem)),0rem)/2) solid transparent;border-inline-start:0;border-inline-end:0;transform:var(--tui-slider-thumb-transform, scale(1))}:not(:disabled):host::-moz-range-thumb{cursor:ew-resize}:not(:disabled):host::-moz-range-thumb:hover,:active:not(:disabled):host::-moz-range-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.333)}:host::-moz-range-progress{opacity:0}:host-context(tui-textfield) :host([type=\"range\"]){position:absolute;inset:100% var(--t-padding) 0;inline-size:auto;margin:calc(-.5*max(calc(calc(var(--tui-thumb-size, .75rem) / 2) - .25rem),.125rem)) 0 0;transform:translateY(-50%);background-color:transparent;pointer-events:auto}\n"] }]
|
|
148
|
-
}], ctorParameters: () => [] });
|
|
149
|
-
|
|
150
|
-
class TuiSliderKeyStepsBase {
|
|
151
|
-
constructor() {
|
|
152
|
-
this.injector = inject(INJECTOR);
|
|
153
|
-
this.control = inject(NgControl, { self: true, optional: true });
|
|
154
|
-
this.min = signal(undefined);
|
|
155
|
-
this.max = signal(undefined);
|
|
156
|
-
this.sync = effect(() => {
|
|
157
|
-
const steps = this.keySteps();
|
|
158
|
-
this.transformer.set(steps && tuiCreateKeyStepsTransformer(steps));
|
|
159
|
-
this.min.set(steps?.[0][1]);
|
|
160
|
-
this.max.set(steps?.[steps.length - 1]?.[1]);
|
|
161
|
-
});
|
|
162
|
-
this.step = input(1);
|
|
163
|
-
this.keySteps = input();
|
|
164
|
-
this.transformer = signal(undefined);
|
|
165
|
-
this.controlValue = toSignal(timer(0) // https://github.com/angular/angular/issues/54418
|
|
166
|
-
.pipe(switchMap(() => tuiControlValue(this.control))));
|
|
167
|
-
this.totalSteps = computed(() =>
|
|
168
|
-
/**
|
|
169
|
-
* Not-integer amount of steps is invalid usage of native sliders
|
|
170
|
-
* ```html
|
|
171
|
-
* <input type="range" [max]="100" [step]="3.33" />
|
|
172
|
-
* ```
|
|
173
|
-
* (impossible to select 100; 99.9 is max allowed value)
|
|
174
|
-
*/
|
|
175
|
-
Math.round(100 / this.step()));
|
|
176
|
-
}
|
|
177
|
-
ngOnInit() {
|
|
178
|
-
this.slider = this.injector.get(TuiSliderComponent);
|
|
179
|
-
}
|
|
180
|
-
takeStep(coefficient) {
|
|
181
|
-
const newValue = this.slider.value + coefficient;
|
|
182
|
-
return (this.transformer()?.toControlValue((this.slider.value + coefficient) / this.totalSteps()) ?? newValue);
|
|
183
|
-
}
|
|
184
|
-
toSliderValue(fraction) {
|
|
185
|
-
return this.transformer() ? fraction * this.totalSteps() : fraction;
|
|
186
|
-
}
|
|
187
|
-
setControlValue(controlValue) {
|
|
188
|
-
const fraction = this.transformer()?.fromControlValue(controlValue) ?? controlValue;
|
|
189
|
-
this.slider.value = this.toSliderValue(fraction);
|
|
190
|
-
}
|
|
191
|
-
getControlValue() {
|
|
192
|
-
const { value } = this.slider;
|
|
193
|
-
return this.transformer()?.toControlValue(value / this.totalSteps()) ?? value;
|
|
194
|
-
}
|
|
195
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiSliderKeyStepsBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
196
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.18", type: TuiSliderKeyStepsBase, isStandalone: true, selector: "input[tuiSlider][keySteps]", inputs: { step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, keySteps: { classPropertyName: "keySteps", publicName: "keySteps", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.min": "transformer() ? 0 : slider?.min", "attr.step": "transformer() ? 1 : step()", "attr.max": "transformer() ? totalSteps() : slider?.max", "attr.aria-valuemin": "min()", "attr.aria-valuemax": "max()", "attr.aria-valuenow": "controlValue()" } }, ngImport: i0 }); }
|
|
197
|
-
}
|
|
198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiSliderKeyStepsBase, decorators: [{
|
|
199
|
-
type: Directive,
|
|
200
|
-
args: [{
|
|
201
|
-
selector: 'input[tuiSlider][keySteps]',
|
|
202
|
-
host: {
|
|
203
|
-
'[attr.min]': 'transformer() ? 0 : slider?.min',
|
|
204
|
-
'[attr.step]': 'transformer() ? 1 : step()',
|
|
205
|
-
'[attr.max]': 'transformer() ? totalSteps() : slider?.max',
|
|
206
|
-
'[attr.aria-valuemin]': 'min()',
|
|
207
|
-
'[attr.aria-valuemax]': 'max()',
|
|
208
|
-
'[attr.aria-valuenow]': 'controlValue()',
|
|
209
|
-
},
|
|
210
|
-
}]
|
|
211
|
-
}] });
|
|
212
|
-
class TuiSliderKeySteps extends TuiControl {
|
|
213
|
-
constructor() {
|
|
214
|
-
super(...arguments);
|
|
215
|
-
this.base = inject(TuiSliderKeyStepsBase);
|
|
216
|
-
}
|
|
217
|
-
set keySteps(steps) {
|
|
218
|
-
this.transformer = steps
|
|
219
|
-
? tuiCreateKeyStepsTransformer(steps)
|
|
220
|
-
: TUI_IDENTITY_VALUE_TRANSFORMER;
|
|
221
|
-
}
|
|
222
|
-
setValue(sliderValue) {
|
|
223
|
-
this.onChange(this.base.transformer() ? sliderValue / this.base.totalSteps() : sliderValue);
|
|
224
|
-
}
|
|
225
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiSliderKeySteps, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
226
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: TuiSliderKeySteps, isStandalone: true, selector: "input[tuiSlider][keySteps][ngModel],input[tuiSlider][keySteps][formControl],input[tuiSlider][keySteps][formControlName]", inputs: { keySteps: "keySteps" }, host: { listeners: { "blur": "onTouched()", "input": "setValue($event.target.value)", "change": "setValue($event.target.value)" }, properties: { "value": "base.toSliderValue(value())", "disabled": "disabled()" } }, providers: [tuiFallbackValueProvider(0)], usesInheritance: true, ngImport: i0 }); }
|
|
227
|
-
}
|
|
228
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiSliderKeySteps, decorators: [{
|
|
229
|
-
type: Directive,
|
|
230
|
-
args: [{
|
|
231
|
-
selector: 'input[tuiSlider][keySteps][ngModel],input[tuiSlider][keySteps][formControl],input[tuiSlider][keySteps][formControlName]',
|
|
232
|
-
inputs: ['keySteps'],
|
|
233
|
-
providers: [tuiFallbackValueProvider(0)],
|
|
234
|
-
host: {
|
|
235
|
-
'[value]': 'base.toSliderValue(value())',
|
|
236
|
-
'[disabled]': 'disabled()',
|
|
237
|
-
'(blur)': 'onTouched()',
|
|
238
|
-
'(input)': 'setValue($event.target.value)',
|
|
239
|
-
'(change)': 'setValue($event.target.value)',
|
|
240
|
-
},
|
|
241
|
-
}]
|
|
242
|
-
}] });
|
|
243
|
-
|
|
244
|
-
const SLIDER_INTERACTION_KEYS = new Set([
|
|
245
|
-
'ArrowDown',
|
|
246
|
-
'ArrowLeft',
|
|
247
|
-
'ArrowRight',
|
|
248
|
-
'ArrowUp',
|
|
249
|
-
'End',
|
|
250
|
-
'Home',
|
|
251
|
-
'PageDown',
|
|
252
|
-
'PageUp',
|
|
253
|
-
]);
|
|
254
|
-
/**
|
|
255
|
-
* Native <input type='range' readonly> doesn't work.
|
|
256
|
-
* This directive imitates this native behaviour.
|
|
257
|
-
*/
|
|
258
|
-
class TuiSliderReadonly {
|
|
259
|
-
constructor() {
|
|
260
|
-
this.el = tuiInjectElement();
|
|
261
|
-
this.doc = inject(DOCUMENT);
|
|
262
|
-
this.readonly = input(true, { transform: coerceBooleanProperty });
|
|
263
|
-
const touchStart$ = tuiTypedFromEvent(this.el, 'touchstart', { passive: false });
|
|
264
|
-
const touchMove$ = tuiTypedFromEvent(this.doc, 'touchmove', { passive: false });
|
|
265
|
-
const touchEnd$ = tuiTypedFromEvent(this.doc, 'touchend', { passive: true });
|
|
266
|
-
const shouldPreventMove$ = merge(touchStart$.pipe(tap((e) => this.preventEvent(e)), map(TUI_TRUE_HANDLER)), touchEnd$.pipe(map(TUI_FALSE_HANDLER)));
|
|
267
|
-
/**
|
|
268
|
-
* @bad TODO think about another solution.
|
|
269
|
-
* Keep in mind that preventing touch event (on slider) inside `@HostListener('touchstart')` doesn't work for mobile chrome.
|
|
270
|
-
*/
|
|
271
|
-
combineLatest([touchMove$, shouldPreventMove$])
|
|
272
|
-
.pipe(filter(([_, shouldPreventMove]) => shouldPreventMove), takeUntilDestroyed())
|
|
273
|
-
.subscribe(([moveEvent]) => this.preventEvent(moveEvent));
|
|
274
|
-
}
|
|
275
|
-
preventEvent(event) {
|
|
276
|
-
if (event.cancelable && this.readonly()) {
|
|
277
|
-
event.preventDefault();
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
preventKeyboardInteraction(event) {
|
|
281
|
-
if (SLIDER_INTERACTION_KEYS.has(event.key)) {
|
|
282
|
-
this.preventEvent(event);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiSliderReadonly, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
286
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.18", type: TuiSliderReadonly, isStandalone: true, selector: "input[tuiSlider][readonly]", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "preventKeyboardInteraction($event)", "mousedown": "preventEvent($event)" } }, ngImport: i0 }); }
|
|
287
|
-
}
|
|
288
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiSliderReadonly, decorators: [{
|
|
289
|
-
type: Directive,
|
|
290
|
-
args: [{
|
|
291
|
-
selector: 'input[tuiSlider][readonly]',
|
|
292
|
-
host: {
|
|
293
|
-
'(keydown)': 'preventKeyboardInteraction($event)',
|
|
294
|
-
'(mousedown)': 'preventEvent($event)',
|
|
295
|
-
},
|
|
296
|
-
}]
|
|
297
|
-
}], ctorParameters: () => [] });
|
|
298
|
-
|
|
299
|
-
/// <reference types="@taiga-ui/tsconfig/ng-dev-mode" />
|
|
300
|
-
class TuiSliderThumbLabel {
|
|
301
|
-
constructor() {
|
|
302
|
-
this.slider = contentChild(TuiSliderComponent);
|
|
303
|
-
this.control = contentChild(NgControl);
|
|
304
|
-
}
|
|
305
|
-
ngAfterContentInit() {
|
|
306
|
-
ngDevMode &&
|
|
307
|
-
console.assert(Boolean(this.control()?.valueChanges), '\n[tuiSliderThumbLabel] expected <input tuiSlider type="range" /> to use Angular Forms.\n' +
|
|
308
|
-
'Use [(ngModel)] or [formControl] or formControlName for correct work.');
|
|
309
|
-
}
|
|
310
|
-
get ratio() {
|
|
311
|
-
return this.slider()?.valueRatio || 0;
|
|
312
|
-
}
|
|
313
|
-
get ghostStart() {
|
|
314
|
-
return this.ratio * (this.slider()?.el.offsetWidth || 0);
|
|
315
|
-
}
|
|
316
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiSliderThumbLabel, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
317
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TuiSliderThumbLabel, isStandalone: true, selector: "[tuiSliderThumbLabel]", providers: [tuiHintOptionsProvider({ direction: 'top', appearance: 'floating' })], queries: [{ propertyName: "slider", first: true, predicate: TuiSliderComponent, descendants: true, isSignal: true }, { propertyName: "control", first: true, predicate: NgControl, descendants: true, isSignal: true }], ngImport: i0, template: "@if (control()?.valueChanges | async) {}\n\n<div\n class=\"t-ghost\"\n [style.--tui-slider-thumb-ratio]=\"ratio\"\n [style.inset-inline-start.px]=\"ghostStart\"\n>\n <ng-content />\n</div>\n\n<ng-content select=\"input[type=range]\" />\n", styles: [":host{position:relative}.t-ghost{position:absolute;inset-block:0;margin:auto;border-radius:50%;pointer-events:none;inline-size:var(--tui-thumb-size, .75rem);block-size:var(--tui-thumb-size, .75rem);transform:translate(calc(var(--tui-slider-thumb-ratio) * var(--tui-thumb-size, .75rem) * -1 * var(--tui-inline)))}:host-context([dir=\"rtl\"]) .t-ghost{left:unset!important}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
318
|
-
}
|
|
319
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiSliderThumbLabel, decorators: [{
|
|
320
|
-
type: Component,
|
|
321
|
-
args: [{ selector: '[tuiSliderThumbLabel]', imports: [AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, providers: [tuiHintOptionsProvider({ direction: 'top', appearance: 'floating' })], template: "@if (control()?.valueChanges | async) {}\n\n<div\n class=\"t-ghost\"\n [style.--tui-slider-thumb-ratio]=\"ratio\"\n [style.inset-inline-start.px]=\"ghostStart\"\n>\n <ng-content />\n</div>\n\n<ng-content select=\"input[type=range]\" />\n", styles: [":host{position:relative}.t-ghost{position:absolute;inset-block:0;margin:auto;border-radius:50%;pointer-events:none;inline-size:var(--tui-thumb-size, .75rem);block-size:var(--tui-thumb-size, .75rem);transform:translate(calc(var(--tui-slider-thumb-ratio) * var(--tui-thumb-size, .75rem) * -1 * var(--tui-inline)))}:host-context([dir=\"rtl\"]) .t-ghost{left:unset!important}\n"] }]
|
|
322
|
-
}] });
|
|
323
|
-
|
|
324
|
-
const TuiSlider = [
|
|
325
|
-
TuiSliderComponent,
|
|
326
|
-
TuiSliderThumbLabel,
|
|
327
|
-
TuiSliderKeyStepsBase,
|
|
328
|
-
TuiSliderKeySteps,
|
|
329
|
-
TuiSliderReadonly,
|
|
330
|
-
];
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Generated bundle index. Do not edit.
|
|
334
|
-
*/
|
|
335
|
-
|
|
336
|
-
export { TUI_FLOATING_PRECISION, TuiSlider, TuiSliderComponent, TuiSliderKeySteps, TuiSliderKeyStepsBase, TuiSliderReadonly, TuiSliderThumbLabel, tuiCreateKeyStepsTransformer, tuiKeyStepValueToPercentage, tuiPercentageToKeyStepValue };
|
|
337
|
-
//# sourceMappingURL=taiga-ui-kit-components-slider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-slider.mjs","sources":["../../../projects/kit/components/slider/helpers/key-steps.ts","../../../projects/kit/components/slider/slider.component.ts","../../../projects/kit/components/slider/helpers/slider-key-steps.directive.ts","../../../projects/kit/components/slider/helpers/slider-readonly.directive.ts","../../../projects/kit/components/slider/helpers/slider-thumb-label.component.ts","../../../projects/kit/components/slider/helpers/slider-thumb-label.template.html","../../../projects/kit/components/slider/slider.ts","../../../projects/kit/components/slider/taiga-ui-kit-components-slider.ts"],"sourcesContent":["import {type TuiValueTransformer} from '@taiga-ui/cdk/classes';\nimport {tuiRound} from '@taiga-ui/cdk/utils/math';\n\n/**\n * Used as a limit for eliminating JS issues with floating point math\n */\nexport const TUI_FLOATING_PRECISION = 7;\n\n/**\n * Steps for splitting sliders into different linear dependencies.\n * Each element of the array has the form [percent, value]\n *\n * Thus, to set a field from 50,000 to 30,000,000 in steps:\n * 1) From 50 000 to 200 000 by 5000 per step (30 steps)\n * 2) From 200 000 to 1 000 000 by 50 000 per step (16 steps)\n * 3) From 1 000 000 to 30 000 000 by 500 000 per step (58 steps)\n *\n * You need to pass the following keyStep (where 104 = 30 + 16 + 58 is the total number of steps):\n * [\n * [0, 50_000],\n * [100 / 104 * 30, 200_000],\n * [100 / 104 * (30 + 16), 1_000_000],\n * [100, 30_000_000],\n * ];\n *\n */\nexport type TuiKeySteps = [[0, number], ...Array<[number, number]>, [100, number]];\n\nfunction tuiFindKeyStepsBoundariesByFn(\n keySteps: TuiKeySteps,\n fn: ([keyStepPercent, keyStepValue]: [number, number]) => boolean,\n): [[number, number], [number, number]] {\n const keyStepUpperIndex = keySteps.findIndex((keyStep, i) => i && fn(keyStep));\n\n const lowerStep = keySteps[keyStepUpperIndex - 1] || keySteps[0];\n const upperStep = keySteps[keyStepUpperIndex] ||\n keySteps[keySteps.length - 1] || [0, 0];\n\n return [lowerStep, upperStep];\n}\n\nexport function tuiPercentageToKeyStepValue(\n valuePercentage: number,\n keySteps: TuiKeySteps,\n): number {\n const [[lowerStepPercent, lowerStepValue], [upperStepPercent, upperStepValue]] =\n tuiFindKeyStepsBoundariesByFn(\n keySteps,\n ([keyStepPercentage, _]) => valuePercentage <= keyStepPercentage,\n );\n const ratio =\n (valuePercentage - lowerStepPercent) / (upperStepPercent - lowerStepPercent);\n const controlValue = (upperStepValue - lowerStepValue) * ratio + lowerStepValue;\n\n return tuiRound(controlValue, TUI_FLOATING_PRECISION);\n}\n\nexport function tuiKeyStepValueToPercentage(\n value: number,\n keySteps: TuiKeySteps,\n): number {\n const [[lowerStepPercent, lowerStepValue], [upperStepPercent, upperStepValue]] =\n tuiFindKeyStepsBoundariesByFn(\n keySteps,\n ([_, keyStepValue]) => value <= keyStepValue,\n );\n const ratio = (value - lowerStepValue) / (upperStepValue - lowerStepValue) || 0;\n\n return (upperStepPercent - lowerStepPercent) * ratio + lowerStepPercent;\n}\n\nexport function tuiCreateKeyStepsTransformer(\n keySteps: TuiKeySteps,\n): TuiValueTransformer<number, number> {\n return new (class implements TuiValueTransformer<number, number> {\n public fromControlValue(controlValue: number): number {\n return tuiKeyStepValueToPercentage(controlValue, keySteps) / 100;\n }\n\n public toControlValue(ratio: number): number {\n return tuiPercentageToKeyStepValue(ratio * 100, keySteps);\n }\n })();\n}\n","import {ChangeDetectionStrategy, Component, computed, inject, input} from '@angular/core';\nimport {NgControl, NgModel} from '@angular/forms';\nimport {tuiWatch} from '@taiga-ui/cdk/observables';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport {tuiRound} from '@taiga-ui/cdk/utils/math';\nimport {tuiIsNumber} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {tuiAsAuxiliary} from '@taiga-ui/core/tokens';\nimport {take} from 'rxjs';\n\nimport {TUI_FLOATING_PRECISION} from './helpers/key-steps';\nimport {TuiSliderKeyStepsBase} from './helpers/slider-key-steps.directive';\n\n@Component({\n selector: 'input[type=range][tuiSlider]',\n template: '',\n styleUrl: './slider.style.less',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [tuiAsAuxiliary(TuiSliderComponent)],\n host: {\n /**\n * For change detection.\n * Webkit does not have built-in method for customization of filling progress (as Firefox).\n * We draw filling of progress by `background: linear-gradient(...)` of the track.\n * This function triggers change detection (for {@link valueRatio} getter) when we drag thumb of the input.\n */\n '(input)': '0',\n '[style.--tui-ticks-gradient]': 'ticksGradient()',\n '[style.--tui-slider-fill-ratio]': 'valueRatio',\n },\n})\nexport class TuiSliderComponent {\n private readonly control = inject(NgControl, {self: true, optional: true});\n\n protected readonly ticksGradient = computed((segments = this.segments()) =>\n this.getTicksGradient(segments),\n );\n\n public readonly segments = input([1], {\n alias: 'segments',\n transform: (x: number | readonly number[]): readonly number[] =>\n tuiIsNumber(x) ? Array.from({length: x}, (_, i) => i / x) : x,\n });\n\n public readonly el = tuiInjectElement<HTMLInputElement>();\n public readonly keySteps = inject(TuiSliderKeyStepsBase, {\n self: true,\n optional: true,\n });\n\n constructor() {\n if (this.control instanceof NgModel) {\n /**\n * The ValueAccessor.writeValue method is called twice on any value accessor during component initialization,\n * when a control is bound using [(ngModel)], first time with a phantom null value.\n * With `changeDetection: ChangeDetectionStrategy.OnPush` the second call of writeValue with real value don't re-render the view.\n * ___\n * See this {@link https://github.com/angular/angular/issues/14988 issue}\n */\n this.control.valueChanges?.pipe(tuiWatch(), take(1)).subscribe();\n }\n }\n\n public get valueRatio(): number {\n return (this.value - this.min) / (this.max - this.min) || 0;\n }\n\n public get min(): number {\n return Number(this.el.min);\n }\n\n public set min(x: number) {\n this.el.min = String(x);\n }\n\n public get max(): number {\n return Number(this.el.max || 100);\n }\n\n public set max(x: number) {\n this.el.max = String(x);\n }\n\n public get step(): number {\n if (!this.el.step) {\n return 1;\n }\n\n return this.el.step === 'any' ? 0 : Number(this.el.step);\n }\n\n public set step(x: number) {\n this.el.step = String(x);\n }\n\n public get value(): number {\n /**\n * If developer uses `[(ngModel)]` and programmatically change value,\n * the `el.nativeElement.value` is equal to the previous value at this moment\n * (it will be updated only in next microtask).\n * @see https://github.com/angular/angular/issues/13568\n */\n if (this.control instanceof NgModel) {\n const transformer = this.keySteps?.transformer();\n const value =\n this.keySteps && transformer\n ? this.keySteps.toSliderValue(\n transformer.fromControlValue(this.control.value),\n )\n : this.control.viewModel;\n\n return this.step\n ? tuiRound(\n Math.round(value / this.step) * this.step,\n TUI_FLOATING_PRECISION,\n )\n : value;\n }\n\n return Number(this.el.value) || 0;\n }\n\n public set value(newValue: number) {\n this.el.value = `${newValue}`;\n }\n\n protected getTicksGradient(segments: readonly number[]): string {\n if (segments.length <= 1) {\n return 'linear-gradient(to right, transparent 0 100%)';\n }\n\n const percentages = segments\n .filter((segment) => segment > 0 && segment < 1)\n .map((segment) => segment * 100);\n\n return percentages.reduce(\n (acc, segment, index) =>\n `${acc}\n var(--tui-text-tertiary) ${segment}% calc(${segment}% + var(--t-tick-thickness)),\n transparent ${segment}% ${percentages[index + 1] ?? 100}%${percentages[index + 1] ? ',' : ')'}\n `,\n `linear-gradient(to right, transparent 0 ${percentages[0]}%,`,\n );\n }\n}\n","import {\n computed,\n Directive,\n effect,\n inject,\n INJECTOR,\n input,\n type OnInit,\n signal,\n} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {NgControl} from '@angular/forms';\nimport {\n TUI_IDENTITY_VALUE_TRANSFORMER,\n TuiControl,\n type TuiValueTransformer,\n} from '@taiga-ui/cdk/classes';\nimport {tuiControlValue} from '@taiga-ui/cdk/observables';\nimport {tuiFallbackValueProvider} from '@taiga-ui/cdk/tokens';\nimport {switchMap, timer} from 'rxjs';\n\nimport {TuiSliderComponent} from '../slider.component';\nimport {tuiCreateKeyStepsTransformer, type TuiKeySteps} from './key-steps';\n\n@Directive({\n selector: 'input[tuiSlider][keySteps]',\n host: {\n '[attr.min]': 'transformer() ? 0 : slider?.min',\n '[attr.step]': 'transformer() ? 1 : step()',\n '[attr.max]': 'transformer() ? totalSteps() : slider?.max',\n '[attr.aria-valuemin]': 'min()',\n '[attr.aria-valuemax]': 'max()',\n '[attr.aria-valuenow]': 'controlValue()',\n },\n})\nexport class TuiSliderKeyStepsBase implements OnInit {\n private readonly injector = inject(INJECTOR);\n private readonly control = inject(NgControl, {self: true, optional: true});\n\n protected readonly min = signal<number | undefined>(undefined);\n protected readonly max = signal<number | undefined>(undefined);\n protected readonly sync = effect(() => {\n const steps = this.keySteps();\n\n this.transformer.set(steps && tuiCreateKeyStepsTransformer(steps));\n this.min.set(steps?.[0][1]);\n this.max.set(steps?.[steps.length - 1]?.[1]);\n });\n\n public slider!: TuiSliderComponent;\n public readonly step = input(1);\n public readonly keySteps = input<TuiKeySteps>();\n public readonly transformer = signal<TuiValueTransformer<number, number> | undefined>(\n undefined,\n );\n\n public controlValue = toSignal(\n timer(0) // https://github.com/angular/angular/issues/54418\n .pipe(switchMap(() => tuiControlValue<number>(this.control))),\n );\n\n public readonly totalSteps = computed(() =>\n /**\n * Not-integer amount of steps is invalid usage of native sliders\n * ```html\n * <input type=\"range\" [max]=\"100\" [step]=\"3.33\" />\n * ```\n * (impossible to select 100; 99.9 is max allowed value)\n */\n Math.round(100 / this.step()),\n );\n\n public ngOnInit(): void {\n this.slider = this.injector.get(TuiSliderComponent);\n }\n\n public takeStep(coefficient: number): number {\n const newValue = this.slider.value + coefficient;\n\n return (\n this.transformer()?.toControlValue(\n (this.slider.value + coefficient) / this.totalSteps(),\n ) ?? newValue\n );\n }\n\n public toSliderValue(fraction: number): number {\n return this.transformer() ? fraction * this.totalSteps() : fraction;\n }\n\n public setControlValue(controlValue: number): void {\n const fraction =\n this.transformer()?.fromControlValue(controlValue) ?? controlValue;\n\n this.slider.value = this.toSliderValue(fraction);\n }\n\n public getControlValue(): number {\n const {value} = this.slider;\n\n return this.transformer()?.toControlValue(value / this.totalSteps()) ?? value;\n }\n}\n\n@Directive({\n selector:\n 'input[tuiSlider][keySteps][ngModel],input[tuiSlider][keySteps][formControl],input[tuiSlider][keySteps][formControlName]',\n inputs: ['keySteps'],\n providers: [tuiFallbackValueProvider(0)],\n host: {\n '[value]': 'base.toSliderValue(value())',\n '[disabled]': 'disabled()',\n '(blur)': 'onTouched()',\n '(input)': 'setValue($event.target.value)',\n '(change)': 'setValue($event.target.value)',\n },\n})\nexport class TuiSliderKeySteps extends TuiControl<number> {\n protected readonly base = inject(TuiSliderKeyStepsBase);\n\n public set keySteps(steps: TuiKeySteps | null | undefined) {\n this.transformer = steps\n ? tuiCreateKeyStepsTransformer(steps)\n : TUI_IDENTITY_VALUE_TRANSFORMER;\n }\n\n protected setValue(sliderValue: number): void {\n this.onChange(\n this.base.transformer() ? sliderValue / this.base.totalSteps() : sliderValue,\n );\n }\n}\n","import {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {DOCUMENT} from '@angular/common';\nimport {Directive, inject, input} from '@angular/core';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {TUI_FALSE_HANDLER, TUI_TRUE_HANDLER} from '@taiga-ui/cdk/constants';\nimport {tuiTypedFromEvent} from '@taiga-ui/cdk/observables';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport {combineLatest, filter, map, merge, tap} from 'rxjs';\n\nconst SLIDER_INTERACTION_KEYS = new Set([\n 'ArrowDown',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'End',\n 'Home',\n 'PageDown',\n 'PageUp',\n]);\n\n/**\n * Native <input type='range' readonly> doesn't work.\n * This directive imitates this native behaviour.\n */\n@Directive({\n selector: 'input[tuiSlider][readonly]',\n host: {\n '(keydown)': 'preventKeyboardInteraction($event)',\n '(mousedown)': 'preventEvent($event)',\n },\n})\nexport class TuiSliderReadonly {\n private readonly el = tuiInjectElement<HTMLInputElement>();\n private readonly doc = inject(DOCUMENT);\n\n public readonly readonly = input(true, {transform: coerceBooleanProperty});\n\n constructor() {\n const touchStart$ = tuiTypedFromEvent(this.el, 'touchstart', {passive: false});\n const touchMove$ = tuiTypedFromEvent(this.doc, 'touchmove', {passive: false});\n const touchEnd$ = tuiTypedFromEvent(this.doc, 'touchend', {passive: true});\n\n const shouldPreventMove$ = merge(\n touchStart$.pipe(\n tap((e) => this.preventEvent(e)),\n map(TUI_TRUE_HANDLER),\n ),\n touchEnd$.pipe(map(TUI_FALSE_HANDLER)),\n );\n\n /**\n * @bad TODO think about another solution.\n * Keep in mind that preventing touch event (on slider) inside `@HostListener('touchstart')` doesn't work for mobile chrome.\n */\n combineLatest([touchMove$, shouldPreventMove$])\n .pipe(\n filter(([_, shouldPreventMove]) => shouldPreventMove),\n takeUntilDestroyed(),\n )\n .subscribe(([moveEvent]) => this.preventEvent(moveEvent));\n }\n\n protected preventEvent(event: Event): void {\n if (event.cancelable && this.readonly()) {\n event.preventDefault();\n }\n }\n\n protected preventKeyboardInteraction(event: KeyboardEvent): void {\n if (SLIDER_INTERACTION_KEYS.has(event.key)) {\n this.preventEvent(event);\n }\n }\n}\n","/// <reference types=\"@taiga-ui/tsconfig/ng-dev-mode\" />\nimport {AsyncPipe} from '@angular/common';\nimport {\n type AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n contentChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {tuiHintOptionsProvider} from '@taiga-ui/core/portals/hint';\n\nimport {TuiSliderComponent} from '../slider.component';\n\n@Component({\n selector: '[tuiSliderThumbLabel]',\n imports: [AsyncPipe],\n templateUrl: './slider-thumb-label.template.html',\n styleUrl: './slider-thumb-label.style.less',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [tuiHintOptionsProvider({direction: 'top', appearance: 'floating'})],\n})\nexport class TuiSliderThumbLabel implements AfterContentInit {\n protected readonly slider = contentChild(TuiSliderComponent);\n protected readonly control = contentChild(NgControl);\n\n public ngAfterContentInit(): void {\n ngDevMode &&\n console.assert(\n Boolean(this.control()?.valueChanges),\n '\\n[tuiSliderThumbLabel] expected <input tuiSlider type=\"range\" /> to use Angular Forms.\\n' +\n 'Use [(ngModel)] or [formControl] or formControlName for correct work.',\n );\n }\n\n protected get ratio(): number {\n return this.slider()?.valueRatio || 0;\n }\n\n protected get ghostStart(): number {\n return this.ratio * (this.slider()?.el.offsetWidth || 0);\n }\n}\n","@if (control()?.valueChanges | async) {}\n\n<div\n class=\"t-ghost\"\n [style.--tui-slider-thumb-ratio]=\"ratio\"\n [style.inset-inline-start.px]=\"ghostStart\"\n>\n <ng-content />\n</div>\n\n<ng-content select=\"input[type=range]\" />\n","import {\n TuiSliderKeySteps,\n TuiSliderKeyStepsBase,\n} from './helpers/slider-key-steps.directive';\nimport {TuiSliderReadonly} from './helpers/slider-readonly.directive';\nimport {TuiSliderThumbLabel} from './helpers/slider-thumb-label.component';\nimport {TuiSliderComponent} from './slider.component';\n\nexport const TuiSlider = [\n TuiSliderComponent,\n TuiSliderThumbLabel,\n TuiSliderKeyStepsBase,\n TuiSliderKeySteps,\n TuiSliderReadonly,\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA;;AAEG;AACI,MAAM,sBAAsB,GAAG;AAsBtC,SAAS,6BAA6B,CAClC,QAAqB,EACrB,EAAiE,EAAA;IAEjE,MAAM,iBAAiB,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC;AAE9E,IAAA,MAAM,SAAS,GAAG,QAAQ,CAAC,iBAAiB,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC;AAChE,IAAA,MAAM,SAAS,GAAG,QAAQ,CAAC,iBAAiB,CAAC;AACzC,QAAA,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AAE3C,IAAA,OAAO,CAAC,SAAS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QAAA,EAAA,EAAA,EAAA,QAAA,ECvBvD,2PAWA,EAAA,MAAA,EAAA,CAAA,uXAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EDIc,SAAS,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;4FAMV,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAR/B,SAAS;+BACI,uBAAuB,EAAA,OAAA,EACxB,CAAC,SAAS,CAAC,mBAGH,uBAAuB,CAAC,MAAM,EAAA,SAAA,EACpC,CAAC,sBAAsB,CAAC,EAAC,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAC,CAAC,CAAC,EAAA,QAAA,EAAA,2PAAA,EAAA,MAAA,EAAA,CAAA,uXAAA,CAAA,EAAA;;;AEXtE,MAAA,SAAS,GAAG;IACrB,kBAAkB;IAClB,mBAAmB;IACnB,qBAAqB;IACrB,iBAAiB;IACjB,iBAAiB;;;ACbrB;;AAEG;;;;"}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
@import '@taiga-ui/core/styles/taiga-ui-local.less';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @name Avatar
|
|
5
|
-
* @selector [tuiAvatar]
|
|
6
|
-
*
|
|
7
|
-
* @description
|
|
8
|
-
* An avatar component which can be used with icons, text or images
|
|
9
|
-
* and is applicable to static elements as well as buttons and links
|
|
10
|
-
*
|
|
11
|
-
* @attributes
|
|
12
|
-
* data-size — size (default: 'l') ('xs' | 's' | 'm' | 'l' | 'xl' | 'xxl')
|
|
13
|
-
* data-shape — shape (default: 'round') ('round' | 'square')
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* <span tuiAvatar tuiIcons style="--t-icon-start: url('icon.svg')"></span>
|
|
17
|
-
* <button tuiAvatar>
|
|
18
|
-
* <img src="path/to/image" alt="Avatar" />
|
|
19
|
-
* </button>
|
|
20
|
-
*
|
|
21
|
-
* @see-also
|
|
22
|
-
* Icons, Icon, Appearance
|
|
23
|
-
*/
|
|
24
|
-
[tuiAvatar]:where(*&) {
|
|
25
|
-
--t-size: var(--tui-height-l);
|
|
26
|
-
--t-radius: 0.75rem;
|
|
27
|
-
--t-corner-offset: calc((var(--t-radius) * 1.4142 - var(--t-radius)) * 1 / 1.4142);
|
|
28
|
-
|
|
29
|
-
position: relative;
|
|
30
|
-
display: inline-flex;
|
|
31
|
-
flex-shrink: 0;
|
|
32
|
-
inline-size: var(--t-size);
|
|
33
|
-
block-size: var(--t-size);
|
|
34
|
-
align-items: center;
|
|
35
|
-
justify-content: center;
|
|
36
|
-
white-space: nowrap;
|
|
37
|
-
border-radius: var(--t-radius);
|
|
38
|
-
border: none;
|
|
39
|
-
background: var(--tui-background-neutral-1);
|
|
40
|
-
color: var(--tui-text-secondary);
|
|
41
|
-
vertical-align: middle;
|
|
42
|
-
box-sizing: border-box;
|
|
43
|
-
padding: 0.25rem;
|
|
44
|
-
font: var(--tui-font-body-l);
|
|
45
|
-
font-weight: bold;
|
|
46
|
-
opacity: 0.999; // Kick in hardware rendering layer to avoid artifacts on the edges
|
|
47
|
-
|
|
48
|
-
&::before {
|
|
49
|
-
inline-size: auto;
|
|
50
|
-
block-size: auto;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&:not(._initials)::before {
|
|
54
|
-
position: absolute;
|
|
55
|
-
inset: 0;
|
|
56
|
-
font-size: calc(var(--t-size) * 0.6);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&[data-size='xs'] {
|
|
60
|
-
--t-size: var(--tui-height-xs);
|
|
61
|
-
--t-radius: 0.5rem;
|
|
62
|
-
|
|
63
|
-
font: var(--tui-font-ui-xs);
|
|
64
|
-
font-size: 0.5625rem;
|
|
65
|
-
|
|
66
|
-
&._initials::before {
|
|
67
|
-
font: var(--tui-font-ui-xs);
|
|
68
|
-
font-weight: bold;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&[data-size='s'] {
|
|
73
|
-
--t-size: var(--tui-height-s);
|
|
74
|
-
--t-radius: 0.5rem;
|
|
75
|
-
|
|
76
|
-
font: var(--tui-font-ui-xs);
|
|
77
|
-
font-weight: bold;
|
|
78
|
-
|
|
79
|
-
&._initials::before {
|
|
80
|
-
font: var(--tui-font-body-s);
|
|
81
|
-
font-weight: bold;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
&[data-size='m'] {
|
|
86
|
-
--t-size: calc(var(--tui-height-m) - 0.25rem);
|
|
87
|
-
--t-radius: 0.75rem;
|
|
88
|
-
|
|
89
|
-
font: var(--tui-font-ui-m);
|
|
90
|
-
font-weight: bold;
|
|
91
|
-
|
|
92
|
-
&._initials::before {
|
|
93
|
-
font: var(--tui-font-body-m);
|
|
94
|
-
font-weight: bold;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
&[data-size='xl'] {
|
|
99
|
-
--t-size: 5rem;
|
|
100
|
-
--t-radius: 0.75rem;
|
|
101
|
-
|
|
102
|
-
font: var(--tui-font-heading-h4);
|
|
103
|
-
|
|
104
|
-
&._initials::before {
|
|
105
|
-
font: var(--tui-font-heading-h3);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
&[data-size='xxl'] {
|
|
110
|
-
--t-size: 6rem;
|
|
111
|
-
--t-radius: 1rem;
|
|
112
|
-
|
|
113
|
-
font: var(--tui-font-heading-h3);
|
|
114
|
-
|
|
115
|
-
&._initials::before {
|
|
116
|
-
font: var(--tui-font-heading-h3);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
&[data-size='xxxl'] {
|
|
121
|
-
--t-size: 8rem;
|
|
122
|
-
--t-radius: 1.25rem;
|
|
123
|
-
|
|
124
|
-
font: var(--tui-font-heading-h3);
|
|
125
|
-
|
|
126
|
-
&._initials::before {
|
|
127
|
-
font: var(--tui-font-heading-h2);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
&:not([data-shape='square']) {
|
|
132
|
-
--t-radius: calc(var(--t-size) / 2);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
&._initials {
|
|
136
|
-
&::before {
|
|
137
|
-
content: attr(data-icon-start);
|
|
138
|
-
mask: none;
|
|
139
|
-
background: none;
|
|
140
|
-
font: var(--tui-font-heading-h6);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
&._badge {
|
|
145
|
-
mask: radial-gradient(
|
|
146
|
-
circle at calc(100% - var(--t-corner-offset)) calc(100% - var(--t-corner-offset)),
|
|
147
|
-
black 0.23rem,
|
|
148
|
-
transparent 0.25rem,
|
|
149
|
-
transparent 0.375rem,
|
|
150
|
-
black 0.39rem
|
|
151
|
-
);
|
|
152
|
-
mask-clip: no-clip;
|
|
153
|
-
|
|
154
|
-
&::after {
|
|
155
|
-
content: '';
|
|
156
|
-
position: absolute;
|
|
157
|
-
top: calc(100% - var(--t-corner-offset));
|
|
158
|
-
left: calc(100% - var(--t-corner-offset));
|
|
159
|
-
display: block;
|
|
160
|
-
inline-size: 0.55rem;
|
|
161
|
-
block-size: 0.55rem;
|
|
162
|
-
border-radius: 100%;
|
|
163
|
-
background: var(--t-badge);
|
|
164
|
-
transform: translate3d(-50%, -50%, 0);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
&._fallback {
|
|
169
|
-
img,
|
|
170
|
-
video {
|
|
171
|
-
display: none;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
img,
|
|
176
|
-
video,
|
|
177
|
-
picture {
|
|
178
|
-
.fullsize();
|
|
179
|
-
|
|
180
|
-
object-fit: cover;
|
|
181
|
-
box-sizing: border-box;
|
|
182
|
-
border-radius: inherit;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
&:has(img, video):not(._fallback) {
|
|
186
|
-
background: none;
|
|
187
|
-
}
|
|
188
|
-
}
|