@taiga-ui/kit 4.2.0 → 4.4.0-canary.6e6e993
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-range/calendar-range.component.d.ts +16 -6
- package/components/carousel/carousel.component.d.ts +1 -1
- package/components/input-phone-international/input-phone-international.options.d.ts +1 -1
- package/components/preview/preview.component.d.ts +1 -1
- package/components/segmented/segmented.directive.d.ts +2 -3
- package/components/slider/slider.component.d.ts +1 -1
- package/components/tiles/tile-handle.directive.d.ts +1 -1
- package/directives/button-close/index.d.ts +0 -1
- package/directives/button-select/button-select.directive.d.ts +12 -0
- package/directives/button-select/index.d.ts +1 -0
- package/directives/icon-badge/icon-badge.directive.d.ts +9 -0
- package/directives/icon-badge/index.d.ts +1 -0
- package/directives/index.d.ts +2 -0
- package/esm2022/components/accordion/accordion-item.component.mjs +10 -19
- package/esm2022/components/avatar/avatar-labeled.component.mjs +3 -6
- package/esm2022/components/avatar/avatar-stack.component.mjs +6 -7
- package/esm2022/components/breadcrumbs/breadcrumbs.component.mjs +6 -7
- package/esm2022/components/button-loading/button-loading.component.mjs +3 -5
- package/esm2022/components/calendar-month/calendar-month.component.mjs +6 -7
- package/esm2022/components/calendar-range/calendar-range.component.mjs +41 -46
- package/esm2022/components/carousel/carousel.component.mjs +17 -28
- package/esm2022/components/checkbox/checkbox.component.mjs +2 -2
- package/esm2022/components/checkbox/checkbox.options.mjs +3 -3
- package/esm2022/components/compass/compass.component.mjs +6 -7
- package/esm2022/components/elastic-container/elastic-container.component.mjs +8 -11
- package/esm2022/components/elastic-container/elastic-container.directive.mjs +2 -2
- package/esm2022/components/files/file/file.component.mjs +6 -7
- package/esm2022/components/files/input-files/input-files-validator.directive.mjs +6 -6
- package/esm2022/components/files/input-files/input-files.component.mjs +3 -5
- package/esm2022/components/files/input-files/input-files.directive.mjs +6 -3
- package/esm2022/components/filter/filter.component.mjs +6 -7
- package/esm2022/components/input-inline/input-inline.component.mjs +5 -6
- package/esm2022/components/input-phone-international/input-phone-international.component.mjs +3 -3
- package/esm2022/components/input-phone-international/input-phone-international.options.mjs +3 -3
- package/esm2022/components/items-with-more/items-with-more.service.mjs +4 -4
- package/esm2022/components/line-clamp/line-clamp-box.component.mjs +7 -8
- package/esm2022/components/line-clamp/line-clamp.component.mjs +5 -6
- package/esm2022/components/pagination/pagination.component.mjs +5 -13
- package/esm2022/components/pdf-viewer/pdf-viewer.component.mjs +4 -6
- package/esm2022/components/pin/pin.directive.mjs +6 -6
- package/esm2022/components/preview/pagination/preview-pagination.component.mjs +6 -9
- package/esm2022/components/preview/preview.component.mjs +4 -6
- package/esm2022/components/progress/progress-bar/progress-bar.component.mjs +7 -10
- package/esm2022/components/progress/progress-bar/progress-color-segments.directive.mjs +2 -2
- package/esm2022/components/progress/progress-circle/progress-circle.component.mjs +8 -13
- package/esm2022/components/push/push-alert.component.mjs +3 -3
- package/esm2022/components/radio/radio.component.mjs +2 -2
- package/esm2022/components/radio-list/radio-list.component.mjs +7 -10
- package/esm2022/components/range/range-change.directive.mjs +5 -5
- package/esm2022/components/range/range.component.mjs +10 -20
- package/esm2022/components/rating/rating.component.mjs +9 -19
- package/esm2022/components/segmented/segmented.component.mjs +8 -9
- package/esm2022/components/segmented/segmented.directive.mjs +17 -21
- package/esm2022/components/slider/helpers/key-steps.mjs +3 -2
- package/esm2022/components/slider/helpers/slider-key-steps.directive.mjs +5 -9
- package/esm2022/components/slider/helpers/slider-readonly.directive.mjs +7 -9
- package/esm2022/components/slider/slider.component.mjs +8 -12
- package/esm2022/components/stepper/step.component.mjs +12 -23
- package/esm2022/components/stepper/stepper.component.mjs +12 -21
- package/esm2022/components/switch/switch.component.mjs +6 -8
- package/esm2022/components/tabs/tabs-horizontal.directive.mjs +7 -13
- package/esm2022/components/tabs/tabs-vertical.directive.mjs +8 -12
- package/esm2022/components/tabs/tabs-with-more.component.mjs +7 -6
- package/esm2022/components/tabs/tabs.directive.mjs +7 -7
- package/esm2022/components/tiles/tile-handle.directive.mjs +15 -21
- package/esm2022/components/tiles/tile.component.mjs +9 -16
- package/esm2022/components/tiles/tiles.component.mjs +7 -10
- package/esm2022/components/tree/components/tree-item/tree-item.component.mjs +4 -6
- package/esm2022/components/tree/components/tree-item-content/tree-item-content.component.mjs +7 -8
- package/esm2022/directives/button-close/button-close.directive.mjs +5 -6
- package/esm2022/directives/button-close/index.mjs +1 -2
- package/esm2022/directives/button-select/button-select.directive.mjs +41 -0
- package/esm2022/directives/button-select/index.mjs +2 -0
- package/esm2022/directives/button-select/taiga-ui-kit-directives-button-select.mjs +5 -0
- package/esm2022/directives/fade/fade.directive.mjs +11 -19
- package/esm2022/directives/fluid-typography/fluid-typography.directive.mjs +2 -2
- package/esm2022/directives/highlight/highlight.directive.mjs +2 -2
- package/esm2022/directives/icon-badge/icon-badge.directive.mjs +41 -0
- package/esm2022/directives/icon-badge/index.mjs +2 -0
- package/esm2022/directives/icon-badge/taiga-ui-kit-directives-icon-badge.mjs +5 -0
- package/esm2022/directives/index.mjs +3 -1
- package/esm2022/directives/lazy-loading/lazy-loading.directive.mjs +15 -20
- package/esm2022/directives/lazy-loading/lazy-loading.service.mjs +2 -2
- package/esm2022/directives/present/present.directive.mjs +4 -8
- package/esm2022/directives/sensitive/sensitive.directive.mjs +5 -5
- package/esm2022/directives/skeleton/skeleton.directive.mjs +2 -2
- package/esm2022/directives/tooltip/tooltip.directive.mjs +7 -7
- package/fesm2022/taiga-ui-kit-components-accordion.mjs +9 -18
- package/fesm2022/taiga-ui-kit-components-accordion.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-avatar.mjs +6 -10
- package/fesm2022/taiga-ui-kit-components-avatar.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-breadcrumbs.mjs +5 -6
- package/fesm2022/taiga-ui-kit-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-button-loading.mjs +2 -4
- package/fesm2022/taiga-ui-kit-components-button-loading.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-calendar-month.mjs +5 -6
- package/fesm2022/taiga-ui-kit-components-calendar-month.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-calendar-range.mjs +40 -45
- package/fesm2022/taiga-ui-kit-components-calendar-range.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-carousel.mjs +16 -27
- package/fesm2022/taiga-ui-kit-components-carousel.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-checkbox.mjs +3 -3
- package/fesm2022/taiga-ui-kit-components-checkbox.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-compass.mjs +5 -6
- package/fesm2022/taiga-ui-kit-components-compass.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-elastic-container.mjs +8 -11
- package/fesm2022/taiga-ui-kit-components-elastic-container.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-files.mjs +15 -15
- package/fesm2022/taiga-ui-kit-components-files.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-filter.mjs +5 -6
- package/fesm2022/taiga-ui-kit-components-filter.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-inline.mjs +4 -5
- package/fesm2022/taiga-ui-kit-components-input-inline.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-phone-international.mjs +4 -4
- package/fesm2022/taiga-ui-kit-components-input-phone-international.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-items-with-more.mjs +3 -3
- package/fesm2022/taiga-ui-kit-components-items-with-more.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-line-clamp.mjs +9 -11
- package/fesm2022/taiga-ui-kit-components-line-clamp.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-pagination.mjs +4 -12
- package/fesm2022/taiga-ui-kit-components-pagination.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-pdf-viewer.mjs +3 -5
- package/fesm2022/taiga-ui-kit-components-pdf-viewer.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-pin.mjs +5 -5
- package/fesm2022/taiga-ui-kit-components-pin.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-preview.mjs +8 -13
- package/fesm2022/taiga-ui-kit-components-preview.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-progress.mjs +13 -21
- package/fesm2022/taiga-ui-kit-components-progress.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-push.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-push.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-radio-list.mjs +6 -9
- package/fesm2022/taiga-ui-kit-components-radio-list.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-radio.mjs +1 -1
- package/fesm2022/taiga-ui-kit-components-radio.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-range.mjs +13 -23
- package/fesm2022/taiga-ui-kit-components-range.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-rating.mjs +8 -18
- package/fesm2022/taiga-ui-kit-components-rating.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-segmented.mjs +22 -26
- package/fesm2022/taiga-ui-kit-components-segmented.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-slider.mjs +17 -26
- package/fesm2022/taiga-ui-kit-components-slider.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-stepper.mjs +21 -41
- package/fesm2022/taiga-ui-kit-components-stepper.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-switch.mjs +5 -7
- package/fesm2022/taiga-ui-kit-components-switch.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-tabs.mjs +23 -32
- package/fesm2022/taiga-ui-kit-components-tabs.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-tiles.mjs +26 -42
- package/fesm2022/taiga-ui-kit-components-tiles.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-tree.mjs +8 -11
- package/fesm2022/taiga-ui-kit-components-tree.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-button-close.mjs +5 -8
- package/fesm2022/taiga-ui-kit-directives-button-close.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-button-select.mjs +47 -0
- package/fesm2022/taiga-ui-kit-directives-button-select.mjs.map +1 -0
- package/fesm2022/taiga-ui-kit-directives-fade.mjs +10 -18
- package/fesm2022/taiga-ui-kit-directives-fade.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-fluid-typography.mjs +1 -1
- package/fesm2022/taiga-ui-kit-directives-fluid-typography.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-highlight.mjs +1 -1
- package/fesm2022/taiga-ui-kit-directives-highlight.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-icon-badge.mjs +47 -0
- package/fesm2022/taiga-ui-kit-directives-icon-badge.mjs.map +1 -0
- package/fesm2022/taiga-ui-kit-directives-lazy-loading.mjs +15 -20
- package/fesm2022/taiga-ui-kit-directives-lazy-loading.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-present.mjs +3 -7
- package/fesm2022/taiga-ui-kit-directives-present.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-sensitive.mjs +4 -4
- package/fesm2022/taiga-ui-kit-directives-sensitive.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-skeleton.mjs +1 -1
- package/fesm2022/taiga-ui-kit-directives-skeleton.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-tooltip.mjs +6 -6
- package/fesm2022/taiga-ui-kit-directives-tooltip.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives.mjs +2 -0
- package/fesm2022/taiga-ui-kit-directives.mjs.map +1 -1
- package/package.json +499 -487
- package/directives/button-close/button-close.options.d.ts +0 -1
- package/esm2022/directives/button-close/button-close.options.mjs +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, Component, ChangeDetectionStrategy,
|
|
3
|
+
import { inject, Component, ChangeDetectionStrategy, Input } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/forms';
|
|
5
5
|
import { FormsModule } from '@angular/forms';
|
|
6
6
|
import { TuiControl } from '@taiga-ui/cdk/classes';
|
|
@@ -53,33 +53,23 @@ class TuiRating extends TuiControl {
|
|
|
53
53
|
: 0;
|
|
54
54
|
}
|
|
55
55
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiRating, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
56
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiRating, isStandalone: true, selector: "tui-rating", inputs: { icon: "icon", max: "max" }, host: { listeners: { "keydown.capture": "onKeyDown($event)", "pointerdown": "onPointer(1)", "pointercancel": "onPointer(-1)", "document:pointerup": "onPointer(-1)" }, properties: { "class._disabled": "disabled()", "class._readonly": "readOnly()", "class._active": "
|
|
56
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiRating, isStandalone: true, selector: "tui-rating", inputs: { icon: "icon", max: "max" }, host: { listeners: { "keydown.capture": "onKeyDown($event)", "pointerdown": "onPointer(1)", "pointercancel": "onPointer(-1)", "document:pointerup": "onPointer(-1)" }, properties: { "class._disabled": "disabled()", "class._readonly": "readOnly()", "class._active": "active" } }, providers: [tuiFallbackValueProvider(0)], usesInheritance: true, ngImport: i0, template: "<input\n min=\"1\"\n type=\"range\"\n class=\"t-range\"\n [attr.aria-disabled]=\"readOnly()\"\n [disabled]=\"disabled()\"\n [max]=\"max\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{standalone: true}\"\n (blur)=\"onTouched()\"\n (ngModelChange)=\"onChange($event)\"\n/>\n<div class=\"t-items\">\n <div\n *tuiRepeatTimes=\"let index of max\"\n class=\"t-item\"\n [class.t-item_active]=\"isActive(index)\"\n (pointerup)=\"onClick(max - index)\"\n >\n <tui-icon\n *polymorpheusOutlet=\"icon as src; context: {$implicit: max - index}\"\n class=\"t-icon t-icon_blank\"\n [class.t-icon_fraction]=\"isFraction(index)\"\n [icon]=\"src.toString()\"\n [style.--t-cut.%]=\"100 - getCut(index)\"\n />\n <tui-icon\n *polymorpheusOutlet=\"icon as src; context: {$implicit: max - index}\"\n class=\"t-icon\"\n [icon]=\"src.toString()\"\n [style.--t-cut.%]=\"getCut(index)\"\n />\n </div>\n</div>\n", styles: [":host{position:relative;display:block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;min-width:-webkit-fit-content;min-width:-moz-fit-content;min-width:fit-content;font-size:1rem;color:var(--tui-chart-categorical-12);cursor:pointer;-webkit-user-select:none;user-select:none}:host._readonly{pointer-events:none}:host._disabled{pointer-events:none;opacity:var(--tui-disabled-opacity)}.t-range{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;box-sizing:border-box;padding:0 .75em;pointer-events:none}.t-range:focus-visible+.t-items{box-shadow:inset 0 0 0 .125rem var(--tui-border-focus)}.t-items{position:relative;display:flex;flex-direction:row-reverse}.t-items:hover .t-icon{clip-path:inset(0 0 0 0)}.t-items:hover .t-icon_blank{clip-path:inset(0 0 0 100%)}.t-item{position:relative;flex:1 0 0;color:var(--tui-text-tertiary);transition-property:color,transform;transition-duration:var(--tui-duration);transition-timing-function:ease-in-out,cubic-bezier(.35,1.5,.4,2.5)}.t-item:first-child{max-width:2.5em}.t-item:hover,.t-item:hover~.t-item,.t-items:not(:hover) .t-item_active{color:currentColor}.t-items:active .t-item:hover,.t-items:active .t-item:hover~.t-item{transform:scale(.85);transition-duration:var(--tui-duration),calc(var(--tui-duration) / 3);transition-timing-function:ease-in-out}.t-icon{transition-property:clip-path;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;width:2.5em;height:2.5em;font-size:inherit;clip-path:inset(0 var(--t-cut) 0 0)}.t-icon ::ng-deep>*{font-size:1rem}.t-icon_blank{position:absolute;top:0;left:0;display:none;color:var(--tui-text-tertiary);clip-path:inset(0 0 0 var(--t-cut))}.t-icon_fraction{display:block}@media (any-pointer: coarse){:host._active .t-item_active{transform:scale(.85);transition-timing-function:ease-in-out}.t-range{pointer-events:auto}.t-icon{transition:none}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: TuiIcon, selector: "tui-icon", inputs: ["icon", "background"] }, { kind: "directive", type: TuiRepeatTimes, selector: "[tuiRepeatTimes][tuiRepeatTimesOf]", inputs: ["tuiRepeatTimesOf"] }, { kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
57
57
|
}
|
|
58
58
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiRating, decorators: [{
|
|
59
59
|
type: Component,
|
|
60
60
|
args: [{ standalone: true, selector: 'tui-rating', imports: [CommonModule, FormsModule, TuiIcon, TuiRepeatTimes, PolymorpheusOutlet], changeDetection: ChangeDetectionStrategy.OnPush, providers: [tuiFallbackValueProvider(0)], host: {
|
|
61
61
|
'[class._disabled]': 'disabled()',
|
|
62
62
|
'[class._readonly]': 'readOnly()',
|
|
63
|
+
'[class._active]': 'active',
|
|
64
|
+
'(keydown.capture)': 'onKeyDown($event)',
|
|
65
|
+
'(pointerdown)': 'onPointer(1)',
|
|
66
|
+
'(pointercancel)': 'onPointer(-1)',
|
|
67
|
+
'(document:pointerup)': 'onPointer(-1)',
|
|
63
68
|
}, template: "<input\n min=\"1\"\n type=\"range\"\n class=\"t-range\"\n [attr.aria-disabled]=\"readOnly()\"\n [disabled]=\"disabled()\"\n [max]=\"max\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{standalone: true}\"\n (blur)=\"onTouched()\"\n (ngModelChange)=\"onChange($event)\"\n/>\n<div class=\"t-items\">\n <div\n *tuiRepeatTimes=\"let index of max\"\n class=\"t-item\"\n [class.t-item_active]=\"isActive(index)\"\n (pointerup)=\"onClick(max - index)\"\n >\n <tui-icon\n *polymorpheusOutlet=\"icon as src; context: {$implicit: max - index}\"\n class=\"t-icon t-icon_blank\"\n [class.t-icon_fraction]=\"isFraction(index)\"\n [icon]=\"src.toString()\"\n [style.--t-cut.%]=\"100 - getCut(index)\"\n />\n <tui-icon\n *polymorpheusOutlet=\"icon as src; context: {$implicit: max - index}\"\n class=\"t-icon\"\n [icon]=\"src.toString()\"\n [style.--t-cut.%]=\"getCut(index)\"\n />\n </div>\n</div>\n", styles: [":host{position:relative;display:block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;min-width:-webkit-fit-content;min-width:-moz-fit-content;min-width:fit-content;font-size:1rem;color:var(--tui-chart-categorical-12);cursor:pointer;-webkit-user-select:none;user-select:none}:host._readonly{pointer-events:none}:host._disabled{pointer-events:none;opacity:var(--tui-disabled-opacity)}.t-range{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;box-sizing:border-box;padding:0 .75em;pointer-events:none}.t-range:focus-visible+.t-items{box-shadow:inset 0 0 0 .125rem var(--tui-border-focus)}.t-items{position:relative;display:flex;flex-direction:row-reverse}.t-items:hover .t-icon{clip-path:inset(0 0 0 0)}.t-items:hover .t-icon_blank{clip-path:inset(0 0 0 100%)}.t-item{position:relative;flex:1 0 0;color:var(--tui-text-tertiary);transition-property:color,transform;transition-duration:var(--tui-duration);transition-timing-function:ease-in-out,cubic-bezier(.35,1.5,.4,2.5)}.t-item:first-child{max-width:2.5em}.t-item:hover,.t-item:hover~.t-item,.t-items:not(:hover) .t-item_active{color:currentColor}.t-items:active .t-item:hover,.t-items:active .t-item:hover~.t-item{transform:scale(.85);transition-duration:var(--tui-duration),calc(var(--tui-duration) / 3);transition-timing-function:ease-in-out}.t-icon{transition-property:clip-path;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;width:2.5em;height:2.5em;font-size:inherit;clip-path:inset(0 var(--t-cut) 0 0)}.t-icon ::ng-deep>*{font-size:1rem}.t-icon_blank{position:absolute;top:0;left:0;display:none;color:var(--tui-text-tertiary);clip-path:inset(0 0 0 var(--t-cut))}.t-icon_fraction{display:block}@media (any-pointer: coarse){:host._active .t-item_active{transform:scale(.85);transition-timing-function:ease-in-out}.t-range{pointer-events:auto}.t-icon{transition:none}}\n"] }]
|
|
64
|
-
}], propDecorators: {
|
|
65
|
-
type: HostBinding,
|
|
66
|
-
args: ['class._active']
|
|
67
|
-
}], icon: [{
|
|
69
|
+
}], propDecorators: { icon: [{
|
|
68
70
|
type: Input
|
|
69
71
|
}], max: [{
|
|
70
72
|
type: Input
|
|
71
|
-
}], onKeyDown: [{
|
|
72
|
-
type: HostListener,
|
|
73
|
-
args: ['keydown.capture', ['$event']]
|
|
74
|
-
}], onPointer: [{
|
|
75
|
-
type: HostListener,
|
|
76
|
-
args: ['pointerdown', ['1']]
|
|
77
|
-
}, {
|
|
78
|
-
type: HostListener,
|
|
79
|
-
args: ['pointercancel', ['-1']]
|
|
80
|
-
}, {
|
|
81
|
-
type: HostListener,
|
|
82
|
-
args: ['document:pointerup', ['-1']]
|
|
83
73
|
}] } });
|
|
84
74
|
|
|
85
75
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-rating.mjs","sources":["../../../projects/kit/components/rating/rating.options.ts","../../../projects/kit/components/rating/rating.component.ts","../../../projects/kit/components/rating/rating.template.html","../../../projects/kit/components/rating/taiga-ui-kit-components-rating.ts"],"sourcesContent":["import type {Provider} from '@angular/core';\nimport type {TuiContext} from '@taiga-ui/cdk/types';\nimport {tuiCreateToken, tuiProvideOptions} from '@taiga-ui/cdk/utils/miscellaneous';\nimport type {PolymorpheusContent} from '@taiga-ui/polymorpheus';\n\nexport interface TuiRatingOptions {\n readonly icon: PolymorpheusContent<TuiContext<number>>;\n readonly max: number;\n}\n\nexport const TUI_RATING_DEFAULT_OPTIONS: TuiRatingOptions = {\n icon: '@tui.star',\n max: 5,\n};\n\nexport const TUI_RATING_OPTIONS = tuiCreateToken(TUI_RATING_DEFAULT_OPTIONS);\n\nexport function tuiRatingOptionsProvider(options: Partial<TuiRatingOptions>): Provider {\n return tuiProvideOptions(TUI_RATING_OPTIONS, options, TUI_RATING_DEFAULT_OPTIONS);\n}\n","import {CommonModule} from '@angular/common';\nimport {
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-components-rating.mjs","sources":["../../../projects/kit/components/rating/rating.options.ts","../../../projects/kit/components/rating/rating.component.ts","../../../projects/kit/components/rating/rating.template.html","../../../projects/kit/components/rating/taiga-ui-kit-components-rating.ts"],"sourcesContent":["import type {Provider} from '@angular/core';\nimport type {TuiContext} from '@taiga-ui/cdk/types';\nimport {tuiCreateToken, tuiProvideOptions} from '@taiga-ui/cdk/utils/miscellaneous';\nimport type {PolymorpheusContent} from '@taiga-ui/polymorpheus';\n\nexport interface TuiRatingOptions {\n readonly icon: PolymorpheusContent<TuiContext<number>>;\n readonly max: number;\n}\n\nexport const TUI_RATING_DEFAULT_OPTIONS: TuiRatingOptions = {\n icon: '@tui.star',\n max: 5,\n};\n\nexport const TUI_RATING_OPTIONS = tuiCreateToken(TUI_RATING_DEFAULT_OPTIONS);\n\nexport function tuiRatingOptionsProvider(options: Partial<TuiRatingOptions>): Provider {\n return tuiProvideOptions(TUI_RATING_OPTIONS, options, TUI_RATING_DEFAULT_OPTIONS);\n}\n","import {CommonModule} from '@angular/common';\nimport {ChangeDetectionStrategy, Component, inject, Input} from '@angular/core';\nimport {FormsModule} from '@angular/forms';\nimport {TuiControl} from '@taiga-ui/cdk/classes';\nimport {TuiRepeatTimes} from '@taiga-ui/cdk/directives/repeat-times';\nimport {tuiFallbackValueProvider} from '@taiga-ui/cdk/tokens';\nimport {tuiClamp} from '@taiga-ui/cdk/utils/math';\nimport {TuiIcon} from '@taiga-ui/core/components/icon';\nimport {PolymorpheusOutlet} from '@taiga-ui/polymorpheus';\n\nimport type {TuiRatingOptions} from './rating.options';\nimport {TUI_RATING_OPTIONS} from './rating.options';\n\n@Component({\n standalone: true,\n selector: 'tui-rating',\n imports: [CommonModule, FormsModule, TuiIcon, TuiRepeatTimes, PolymorpheusOutlet],\n templateUrl: './rating.template.html',\n styleUrls: ['./rating.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [tuiFallbackValueProvider(0)],\n host: {\n '[class._disabled]': 'disabled()',\n '[class._readonly]': 'readOnly()',\n '[class._active]': 'active',\n '(keydown.capture)': 'onKeyDown($event)',\n '(pointerdown)': 'onPointer(1)',\n '(pointercancel)': 'onPointer(-1)',\n '(document:pointerup)': 'onPointer(-1)',\n },\n})\nexport class TuiRating extends TuiControl<number> {\n private readonly options = inject(TUI_RATING_OPTIONS);\n\n protected active = 0;\n\n @Input()\n public icon: TuiRatingOptions['icon'] = this.options.icon;\n\n @Input()\n public max = this.options.max;\n\n protected onKeyDown(event: KeyboardEvent): void {\n if (this.readOnly()) {\n event.preventDefault();\n }\n }\n\n protected onPointer(delta: number): void {\n this.active = tuiClamp(this.active + delta, 0, 1);\n }\n\n protected onClick(value: number): void {\n if (this.active) {\n this.onChange(value);\n }\n }\n\n protected isActive(index: number): boolean {\n return Math.ceil(this.value()) >= this.max - index;\n }\n\n protected isFraction(index: number): boolean {\n return this.value() > this.max - index - 1 && this.value() < this.max - index;\n }\n\n protected getCut(index: number): number {\n return this.isFraction(index)\n ? 100 * Math.max(this.max - index - this.value(), 0)\n : 0;\n }\n}\n","<input\n min=\"1\"\n type=\"range\"\n class=\"t-range\"\n [attr.aria-disabled]=\"readOnly()\"\n [disabled]=\"disabled()\"\n [max]=\"max\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{standalone: true}\"\n (blur)=\"onTouched()\"\n (ngModelChange)=\"onChange($event)\"\n/>\n<div class=\"t-items\">\n <div\n *tuiRepeatTimes=\"let index of max\"\n class=\"t-item\"\n [class.t-item_active]=\"isActive(index)\"\n (pointerup)=\"onClick(max - index)\"\n >\n <tui-icon\n *polymorpheusOutlet=\"icon as src; context: {$implicit: max - index}\"\n class=\"t-icon t-icon_blank\"\n [class.t-icon_fraction]=\"isFraction(index)\"\n [icon]=\"src.toString()\"\n [style.--t-cut.%]=\"100 - getCut(index)\"\n />\n <tui-icon\n *polymorpheusOutlet=\"icon as src; context: {$implicit: max - index}\"\n class=\"t-icon\"\n [icon]=\"src.toString()\"\n [style.--t-cut.%]=\"getCut(index)\"\n />\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAUa,MAAA,0BAA0B,GAAqB;AACxD,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,GAAG,EAAE,CAAC;EACR;MAEW,kBAAkB,GAAG,cAAc,CAAC,0BAA0B,EAAE;AAEvE,SAAU,wBAAwB,CAAC,OAAkC,EAAA;IACvE,OAAO,iBAAiB,CAAC,kBAAkB,EAAE,OAAO,EAAE,0BAA0B,CAAC,CAAC;AACtF;;ACNA,MAkBa,SAAU,SAAQ,UAAkB,CAAA;AAlBjD,IAAA,WAAA,GAAA;;AAmBqB,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAE5C,IAAM,CAAA,MAA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AAkB,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,CAAA,oBAAA,EAAA,2BAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA,EAAA;;4FAevE,SAAS,EAAA,UAAA,EAAA,CAAA;kBAlBrB,SAAS;iCACM,IAAI,EAAA,QAAA,EACN,YAAY,EAAA,OAAA,EACb,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,kBAAkB,CAAC,EAAA,eAAA,EAGhE,uBAAuB,CAAC,MAAM,EAAA,SAAA,EACpC,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,EAClC,IAAA,EAAA;AACF,wBAAA,mBAAmB,EAAE,YAAY;AACjC,wBAAA,mBAAmB,EAAE,YAAY;AACjC,wBAAA,iBAAiB,EAAE,QAAQ;AAC3B,wBAAA,mBAAmB,EAAE,mBAAmB;AACxC,wBAAA,eAAe,EAAE,cAAc;AAC/B,wBAAA,iBAAiB,EAAE,eAAe;AAClC,wBAAA,sBAAsB,EAAE,eAAe;AAC1C,qBAAA,EAAA,QAAA,EAAA,wjCAAA,EAAA,MAAA,EAAA,CAAA,y2DAAA,CAAA,EAAA,CAAA;8BAQM,IAAI,EAAA,CAAA;sBADV,KAAK;gBAIC,GAAG,EAAA,CAAA;sBADT,KAAK;;;AEvCV;;AAEG;;;;"}
|
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject,
|
|
2
|
+
import { inject, ElementRef, Directive, ContentChildren, NgZone, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { ResizeObserverService } from '@ng-web-apis/resize-observer';
|
|
5
|
-
import { tuiQueryListChanges, tuiZonefree } from '@taiga-ui/cdk/observables';
|
|
5
|
+
import { tuiQueryListChanges, tuiControlValue, tuiZonefree } from '@taiga-ui/cdk/observables';
|
|
6
6
|
import { tuiInjectElement, tuiIsHTMLElement } from '@taiga-ui/cdk/utils/dom';
|
|
7
7
|
import { tuiPx } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
8
8
|
import { tuiBadgeNotificationOptionsProvider } from '@taiga-ui/kit/components/badge-notification';
|
|
9
|
-
import {
|
|
10
|
-
import { NgControl } from '@angular/forms';
|
|
9
|
+
import { NgControl, RadioControlValueAccessor } from '@angular/forms';
|
|
11
10
|
import { RouterLinkActive } from '@angular/router';
|
|
12
11
|
import { EMPTY_QUERY } from '@taiga-ui/cdk/constants';
|
|
13
|
-
import { switchMap,
|
|
12
|
+
import { switchMap, map } from 'rxjs';
|
|
14
13
|
|
|
15
14
|
class TuiSegmentedDirective {
|
|
16
15
|
constructor() {
|
|
17
16
|
this.controls = EMPTY_QUERY;
|
|
17
|
+
this.radios = EMPTY_QUERY;
|
|
18
18
|
this.links = EMPTY_QUERY;
|
|
19
19
|
this.elements = EMPTY_QUERY;
|
|
20
|
-
this.destroyRef = inject(DestroyRef);
|
|
21
20
|
this.component = inject(TuiSegmented);
|
|
22
21
|
this.el = tuiInjectElement();
|
|
23
|
-
// TODO: Debug prerender
|
|
24
|
-
this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
25
22
|
}
|
|
26
23
|
ngAfterContentInit() {
|
|
27
24
|
tuiQueryListChanges(this.controls)
|
|
28
|
-
.pipe(switchMap((
|
|
29
|
-
.subscribe(() => {
|
|
30
|
-
this.update(
|
|
25
|
+
.pipe(switchMap(() => tuiControlValue(this.controls.first)), map((value) => this.radios.toArray().findIndex((c) => c.value === value)))
|
|
26
|
+
.subscribe((index) => {
|
|
27
|
+
this.component.update(index);
|
|
31
28
|
});
|
|
32
29
|
}
|
|
33
30
|
ngAfterContentChecked() {
|
|
@@ -36,10 +33,7 @@ class TuiSegmentedDirective {
|
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
35
|
update(target) {
|
|
39
|
-
|
|
40
|
-
if (index >= 0) {
|
|
41
|
-
this.component.update(index);
|
|
42
|
-
}
|
|
36
|
+
this.component.update(this.getIndex(target));
|
|
43
37
|
}
|
|
44
38
|
get linkIndex() {
|
|
45
39
|
return this.links.toArray().findIndex((link) => link.isActive);
|
|
@@ -48,31 +42,34 @@ class TuiSegmentedDirective {
|
|
|
48
42
|
return Array.from(this.el.children).findIndex((tab) => tab.contains(element));
|
|
49
43
|
}
|
|
50
44
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSegmentedDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
51
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiSegmentedDirective, isStandalone: true, host: { listeners: { "click": "update($event.target)" } }, queries: [{ propertyName: "controls", predicate: NgControl, descendants: true }, { propertyName: "links", predicate: RouterLinkActive }, { propertyName: "elements", predicate: RouterLinkActive, read: ElementRef }], ngImport: i0 }); }
|
|
45
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiSegmentedDirective, isStandalone: true, host: { listeners: { "click": "update($event.target)" } }, queries: [{ propertyName: "controls", predicate: NgControl, descendants: true }, { propertyName: "radios", predicate: RadioControlValueAccessor, descendants: true }, { propertyName: "links", predicate: RouterLinkActive }, { propertyName: "elements", predicate: RouterLinkActive, read: ElementRef }], ngImport: i0 }); }
|
|
52
46
|
}
|
|
53
47
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSegmentedDirective, decorators: [{
|
|
54
48
|
type: Directive,
|
|
55
49
|
args: [{
|
|
56
50
|
standalone: true,
|
|
51
|
+
host: {
|
|
52
|
+
'(click)': 'update($event.target)',
|
|
53
|
+
},
|
|
57
54
|
}]
|
|
58
55
|
}], propDecorators: { controls: [{
|
|
59
56
|
type: ContentChildren,
|
|
60
57
|
args: [NgControl, { descendants: true }]
|
|
58
|
+
}], radios: [{
|
|
59
|
+
type: ContentChildren,
|
|
60
|
+
args: [RadioControlValueAccessor, { descendants: true }]
|
|
61
61
|
}], links: [{
|
|
62
62
|
type: ContentChildren,
|
|
63
63
|
args: [RouterLinkActive]
|
|
64
64
|
}], elements: [{
|
|
65
65
|
type: ContentChildren,
|
|
66
66
|
args: [RouterLinkActive, { read: ElementRef }]
|
|
67
|
-
}], update: [{
|
|
68
|
-
type: HostListener,
|
|
69
|
-
args: ['click', ['$event.target']]
|
|
70
67
|
}] } });
|
|
71
68
|
|
|
72
69
|
class TuiSegmented {
|
|
73
70
|
constructor() {
|
|
74
71
|
this.el = tuiInjectElement();
|
|
75
|
-
this.sub = inject(ResizeObserverService)
|
|
72
|
+
this.sub = inject(ResizeObserverService, { self: true })
|
|
76
73
|
.pipe(tuiZonefree(inject(NgZone)), takeUntilDestroyed())
|
|
77
74
|
.subscribe(() => this.refresh());
|
|
78
75
|
this.size = 's';
|
|
@@ -83,7 +80,7 @@ class TuiSegmented {
|
|
|
83
80
|
this.refresh();
|
|
84
81
|
}
|
|
85
82
|
update(activeItemIndex) {
|
|
86
|
-
if (activeItemIndex === this.activeItemIndex) {
|
|
83
|
+
if (activeItemIndex === this.activeItemIndex || activeItemIndex < 0) {
|
|
87
84
|
return;
|
|
88
85
|
}
|
|
89
86
|
this.activeItemIndex = activeItemIndex;
|
|
@@ -106,16 +103,15 @@ class TuiSegmented {
|
|
|
106
103
|
this.el.style.setProperty('--t-width', tuiPx(this.width));
|
|
107
104
|
}
|
|
108
105
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSegmented, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
109
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiSegmented, isStandalone: true, selector: "tui-segmented", inputs: { size: "size", activeItemIndex: "activeItemIndex" }, outputs: { activeItemIndexChange: "activeItemIndexChange" }, host: { properties: { "attr.data-size": "
|
|
106
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiSegmented, isStandalone: true, selector: "tui-segmented", inputs: { size: "size", activeItemIndex: "activeItemIndex" }, outputs: { activeItemIndexChange: "activeItemIndexChange" }, host: { properties: { "attr.data-size": "size" } }, providers: [ResizeObserverService, tuiBadgeNotificationOptionsProvider({ size: 's' })], usesOnChanges: true, hostDirectives: [{ directive: TuiSegmentedDirective }], ngImport: i0, template: '<ng-content />', isInline: true, styles: ["tui-segmented{position:relative;display:flex;box-sizing:border-box;isolation:isolate;color:var(--tui-background-neutral-1);border:.125rem solid transparent}tui-segmented[data-size=s]{--t-padding: .625rem;--t-gap: .5rem;--t-margin: -.125rem;height:var(--tui-height-s);font:var(--tui-font-text-s);border-radius:var(--tui-radius-s)}tui-segmented[data-size=s]>*:before,tui-segmented[data-size=s]>*:after,tui-segmented[data-size=s] tui-icon{font-size:1rem}tui-segmented[data-size=m]{--t-padding: .875rem;--t-gap: 1rem;--t-margin: -.375rem;height:var(--tui-height-m);font:var(--tui-font-text-m);border-radius:var(--tui-radius-s)}tui-segmented[data-size=l]{--t-padding: 1.125rem;--t-gap: 1rem;--t-margin: -.375rem;height:var(--tui-height-l);font:var(--tui-font-text-l);border-radius:var(--tui-radius-m);border-width:.25rem}tui-segmented[data-size=l]:after{box-shadow:0 0 0 .25rem}tui-segmented>a,tui-segmented>button,tui-segmented>label,tui-segmented>label>input:not([tuiRadio]){transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;position:relative;display:flex;align-items:center;justify-content:center;white-space:nowrap;gap:var(--t-gap);margin:0;padding:0 var(--t-padding);color:var(--tui-text-primary);overflow:hidden;cursor:pointer;font:inherit;border-radius:inherit}tui-segmented>a>*,tui-segmented>button>*,tui-segmented>label>*,tui-segmented>label>input:not([tuiRadio])>*,tui-segmented>a:before,tui-segmented>button:before,tui-segmented>label:before,tui-segmented>label>input:not([tuiRadio]):before,tui-segmented>a:after,tui-segmented>button:after,tui-segmented>label:after,tui-segmented>label>input:not([tuiRadio]):after{margin:0 var(--t-margin)}tui-segmented>a:focus-visible,tui-segmented>button:focus-visible,tui-segmented>label:focus-visible,tui-segmented>label>input:not([tuiRadio]):focus-visible{outline:.125rem solid var(--tui-border-focus);outline-offset:-.125rem}tui-segmented>label>input:not([tuiRadio]){position:absolute;top:0;left:0;width:100%;height:100%}tui-segmented:after{position:absolute;top:0;left:0;width:100%;height:100%;content:\"\";z-index:-1;border-radius:inherit;background:currentColor;box-shadow:0 0 0 .125rem}tui-segmented:before{transition-property:left,width;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;left:var(--t-left);height:100%;width:var(--t-width);border-radius:inherit;background:currentColor;color:var(--tui-background-base);box-shadow:0 .25rem 1.25rem #0000001a}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
110
107
|
}
|
|
111
108
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSegmented, decorators: [{
|
|
112
109
|
type: Component,
|
|
113
|
-
args: [{ standalone: true, selector: 'tui-segmented', template: '<ng-content
|
|
110
|
+
args: [{ standalone: true, selector: 'tui-segmented', template: '<ng-content />', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [ResizeObserverService, tuiBadgeNotificationOptionsProvider({ size: 's' })], hostDirectives: [TuiSegmentedDirective], host: {
|
|
111
|
+
'[attr.data-size]': 'size',
|
|
112
|
+
}, styles: ["tui-segmented{position:relative;display:flex;box-sizing:border-box;isolation:isolate;color:var(--tui-background-neutral-1);border:.125rem solid transparent}tui-segmented[data-size=s]{--t-padding: .625rem;--t-gap: .5rem;--t-margin: -.125rem;height:var(--tui-height-s);font:var(--tui-font-text-s);border-radius:var(--tui-radius-s)}tui-segmented[data-size=s]>*:before,tui-segmented[data-size=s]>*:after,tui-segmented[data-size=s] tui-icon{font-size:1rem}tui-segmented[data-size=m]{--t-padding: .875rem;--t-gap: 1rem;--t-margin: -.375rem;height:var(--tui-height-m);font:var(--tui-font-text-m);border-radius:var(--tui-radius-s)}tui-segmented[data-size=l]{--t-padding: 1.125rem;--t-gap: 1rem;--t-margin: -.375rem;height:var(--tui-height-l);font:var(--tui-font-text-l);border-radius:var(--tui-radius-m);border-width:.25rem}tui-segmented[data-size=l]:after{box-shadow:0 0 0 .25rem}tui-segmented>a,tui-segmented>button,tui-segmented>label,tui-segmented>label>input:not([tuiRadio]){transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;position:relative;display:flex;align-items:center;justify-content:center;white-space:nowrap;gap:var(--t-gap);margin:0;padding:0 var(--t-padding);color:var(--tui-text-primary);overflow:hidden;cursor:pointer;font:inherit;border-radius:inherit}tui-segmented>a>*,tui-segmented>button>*,tui-segmented>label>*,tui-segmented>label>input:not([tuiRadio])>*,tui-segmented>a:before,tui-segmented>button:before,tui-segmented>label:before,tui-segmented>label>input:not([tuiRadio]):before,tui-segmented>a:after,tui-segmented>button:after,tui-segmented>label:after,tui-segmented>label>input:not([tuiRadio]):after{margin:0 var(--t-margin)}tui-segmented>a:focus-visible,tui-segmented>button:focus-visible,tui-segmented>label:focus-visible,tui-segmented>label>input:not([tuiRadio]):focus-visible{outline:.125rem solid var(--tui-border-focus);outline-offset:-.125rem}tui-segmented>label>input:not([tuiRadio]){position:absolute;top:0;left:0;width:100%;height:100%}tui-segmented:after{position:absolute;top:0;left:0;width:100%;height:100%;content:\"\";z-index:-1;border-radius:inherit;background:currentColor;box-shadow:0 0 0 .125rem}tui-segmented:before{transition-property:left,width;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;left:var(--t-left);height:100%;width:var(--t-width);border-radius:inherit;background:currentColor;color:var(--tui-background-base);box-shadow:0 .25rem 1.25rem #0000001a}\n"] }]
|
|
114
113
|
}], propDecorators: { size: [{
|
|
115
114
|
type: Input
|
|
116
|
-
}, {
|
|
117
|
-
type: HostBinding,
|
|
118
|
-
args: ['attr.data-size']
|
|
119
115
|
}], activeItemIndex: [{
|
|
120
116
|
type: Input
|
|
121
117
|
}], activeItemIndexChange: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-segmented.mjs","sources":["../../../projects/kit/components/segmented/segmented.directive.ts","../../../projects/kit/components/segmented/segmented.component.ts","../../../projects/kit/components/segmented/taiga-ui-kit-components-segmented.ts"],"sourcesContent":["import {isPlatformBrowser} from '@angular/common';\nimport type {AfterContentChecked, AfterContentInit, QueryList} from '@angular/core';\nimport {\n ContentChildren,\n DestroyRef,\n Directive,\n ElementRef,\n HostListener,\n inject,\n PLATFORM_ID,\n} from '@angular/core';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {NgControl} from '@angular/forms';\nimport {RouterLinkActive} from '@angular/router';\nimport {EMPTY_QUERY} from '@taiga-ui/cdk/constants';\nimport {tuiQueryListChanges} from '@taiga-ui/cdk/observables';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport {filter, merge, switchMap} from 'rxjs';\n\nimport {TuiSegmented} from './segmented.component';\n\n@Directive({\n standalone: true,\n})\nexport class TuiSegmentedDirective implements AfterContentChecked, AfterContentInit {\n @ContentChildren(NgControl, {descendants: true})\n private readonly controls: QueryList<NgControl> = EMPTY_QUERY;\n\n @ContentChildren(RouterLinkActive)\n private readonly links: QueryList<RouterLinkActive> = EMPTY_QUERY;\n\n @ContentChildren(RouterLinkActive, {read: ElementRef})\n private readonly elements: QueryList<ElementRef<HTMLElement>> = EMPTY_QUERY;\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly component = inject(TuiSegmented);\n private readonly el = tuiInjectElement();\n\n // TODO: Debug prerender\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n public ngAfterContentInit(): void {\n tuiQueryListChanges(this.controls)\n .pipe(\n switchMap((controls) => merge(controls.map((c) => c.valueChanges))),\n filter(() => this.isBrowser),\n takeUntilDestroyed(this.destroyRef),\n )\n .subscribe(() => {\n this.update(this.el.querySelector(':checked'));\n });\n }\n\n public ngAfterContentChecked(): void {\n if (this.links.length) {\n this.update(this.elements.get(this.linkIndex)?.nativeElement || null);\n }\n }\n\n @HostListener('click', ['$event.target'])\n protected update(target: Element | null): void {\n const index = this.getIndex(target);\n\n if (index >= 0) {\n this.component.update(index);\n }\n }\n\n private get linkIndex(): number {\n return this.links.toArray().findIndex((link) => link.isActive);\n }\n\n private getIndex(element: Element | null): number {\n return Array.from(this.el.children).findIndex((tab) => tab.contains(element));\n }\n}\n","import type {OnChanges} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n HostBinding,\n inject,\n Input,\n NgZone,\n Output,\n ViewEncapsulation,\n} from '@angular/core';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {ResizeObserverService} from '@ng-web-apis/resize-observer';\nimport {tuiZonefree} from '@taiga-ui/cdk/observables';\nimport {tuiInjectElement, tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\nimport {tuiPx} from '@taiga-ui/cdk/utils/miscellaneous';\nimport type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types';\nimport {tuiBadgeNotificationOptionsProvider} from '@taiga-ui/kit/components/badge-notification';\n\nimport {TuiSegmentedDirective} from './segmented.directive';\n\n@Component({\n standalone: true,\n selector: 'tui-segmented',\n template: '<ng-content></ng-content>',\n styleUrls: ['./segmented.style.less'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [ResizeObserverService, tuiBadgeNotificationOptionsProvider({size: 's'})],\n hostDirectives: [TuiSegmentedDirective],\n})\nexport class TuiSegmented implements OnChanges {\n private readonly el = tuiInjectElement();\n\n protected readonly sub = inject(ResizeObserverService)\n .pipe(tuiZonefree(inject(NgZone)), takeUntilDestroyed())\n .subscribe(() => this.refresh());\n\n @Input()\n @HostBinding('attr.data-size')\n public size: TuiSizeL | TuiSizeS = 's';\n\n @Input()\n public activeItemIndex = 0;\n\n @Output()\n public readonly activeItemIndexChange = new EventEmitter<number>();\n\n public ngOnChanges(): void {\n this.refresh();\n }\n\n public update(activeItemIndex: number): void {\n if (activeItemIndex === this.activeItemIndex) {\n return;\n }\n\n this.activeItemIndex = activeItemIndex;\n this.activeItemIndexChange.emit(activeItemIndex);\n this.refresh();\n }\n\n private get left(): number {\n const element = this.activeElement;\n\n return tuiIsHTMLElement(element) ? element.offsetLeft : 0;\n }\n\n private get width(): number {\n return this.activeElement?.clientWidth || 0;\n }\n\n private get activeElement(): Element | null {\n return this.el.children.item(this.activeItemIndex);\n }\n\n // TODO: Switch to HostBinding signals in Angular 17+\n private refresh(): void {\n this.el.style.setProperty('--t-left', tuiPx(this.left));\n this.el.style.setProperty('--t-width', tuiPx(this.width));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqBA,MAGa,qBAAqB,CAAA;AAHlC,IAAA,WAAA,GAAA;QAKqB,IAAQ,CAAA,QAAA,GAAyB,WAAW,CAAC;QAG7C,IAAK,CAAA,KAAA,GAAgC,WAAW,CAAC;QAGjD,IAAQ,CAAA,QAAA,GAAuC,WAAW,CAAC;AAE3D,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAChC,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QACjC,IAAE,CAAA,EAAA,GAAG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,MAAM,EACpC,SAAA,EAAA,CAAC,qBAAqB,EAAE,mCAAmC,CAAC,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC,EAAA,cAAA,EACpE,CAAC,qBAAqB,CAAC,EAAA,MAAA,EAAA,CAAA,6mFAAA,CAAA,EAAA,CAAA;8BAWhC,IAAI,EAAA,CAAA;sBAFV,KAAK;;sBACL,WAAW;uBAAC,gBAAgB,CAAA;gBAItB,eAAe,EAAA,CAAA;sBADrB,KAAK;gBAIU,qBAAqB,EAAA,CAAA;sBADpC,MAAM;;;AC9CX;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-components-segmented.mjs","sources":["../../../projects/kit/components/segmented/segmented.directive.ts","../../../projects/kit/components/segmented/segmented.component.ts","../../../projects/kit/components/segmented/taiga-ui-kit-components-segmented.ts"],"sourcesContent":["import type {AfterContentChecked, AfterContentInit, QueryList} from '@angular/core';\nimport {ContentChildren, Directive, ElementRef, inject} from '@angular/core';\nimport {NgControl, RadioControlValueAccessor} from '@angular/forms';\nimport {RouterLinkActive} from '@angular/router';\nimport {EMPTY_QUERY} from '@taiga-ui/cdk/constants';\nimport {tuiControlValue, tuiQueryListChanges} from '@taiga-ui/cdk/observables';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport {map, switchMap} from 'rxjs';\n\nimport {TuiSegmented} from './segmented.component';\n\n@Directive({\n standalone: true,\n host: {\n '(click)': 'update($event.target)',\n },\n})\nexport class TuiSegmentedDirective implements AfterContentChecked, AfterContentInit {\n @ContentChildren(NgControl, {descendants: true})\n private readonly controls: QueryList<NgControl> = EMPTY_QUERY;\n\n @ContentChildren(RadioControlValueAccessor, {descendants: true})\n private readonly radios: QueryList<RadioControlValueAccessor> = EMPTY_QUERY;\n\n @ContentChildren(RouterLinkActive)\n private readonly links: QueryList<RouterLinkActive> = EMPTY_QUERY;\n\n @ContentChildren(RouterLinkActive, {read: ElementRef})\n private readonly elements: QueryList<ElementRef<HTMLElement>> = EMPTY_QUERY;\n\n private readonly component = inject(TuiSegmented);\n private readonly el = tuiInjectElement();\n\n public ngAfterContentInit(): void {\n tuiQueryListChanges(this.controls)\n .pipe(\n switchMap(() => tuiControlValue(this.controls.first)),\n map((value) => this.radios.toArray().findIndex((c) => c.value === value)),\n )\n .subscribe((index) => {\n this.component.update(index);\n });\n }\n\n public ngAfterContentChecked(): void {\n if (this.links.length) {\n this.update(this.elements.get(this.linkIndex)?.nativeElement || null);\n }\n }\n\n protected update(target: Element | null): void {\n this.component.update(this.getIndex(target));\n }\n\n private get linkIndex(): number {\n return this.links.toArray().findIndex((link) => link.isActive);\n }\n\n private getIndex(element: Element | null): number {\n return Array.from(this.el.children).findIndex((tab) => tab.contains(element));\n }\n}\n","import type {OnChanges} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n inject,\n Input,\n NgZone,\n Output,\n ViewEncapsulation,\n} from '@angular/core';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {ResizeObserverService} from '@ng-web-apis/resize-observer';\nimport {tuiZonefree} from '@taiga-ui/cdk/observables';\nimport {tuiInjectElement, tuiIsHTMLElement} from '@taiga-ui/cdk/utils/dom';\nimport {tuiPx} from '@taiga-ui/cdk/utils/miscellaneous';\nimport type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types';\nimport {tuiBadgeNotificationOptionsProvider} from '@taiga-ui/kit/components/badge-notification';\n\nimport {TuiSegmentedDirective} from './segmented.directive';\n\n@Component({\n standalone: true,\n selector: 'tui-segmented',\n template: '<ng-content />',\n styleUrls: ['./segmented.style.less'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [ResizeObserverService, tuiBadgeNotificationOptionsProvider({size: 's'})],\n hostDirectives: [TuiSegmentedDirective],\n host: {\n '[attr.data-size]': 'size',\n },\n})\nexport class TuiSegmented implements OnChanges {\n private readonly el = tuiInjectElement();\n\n protected readonly sub = inject(ResizeObserverService, {self: true})\n .pipe(tuiZonefree(inject(NgZone)), takeUntilDestroyed())\n .subscribe(() => this.refresh());\n\n @Input()\n public size: TuiSizeL | TuiSizeS = 's';\n\n @Input()\n public activeItemIndex = 0;\n\n @Output()\n public readonly activeItemIndexChange = new EventEmitter<number>();\n\n public ngOnChanges(): void {\n this.refresh();\n }\n\n public update(activeItemIndex: number): void {\n if (activeItemIndex === this.activeItemIndex || activeItemIndex < 0) {\n return;\n }\n\n this.activeItemIndex = activeItemIndex;\n this.activeItemIndexChange.emit(activeItemIndex);\n this.refresh();\n }\n\n private get left(): number {\n const element = this.activeElement;\n\n return tuiIsHTMLElement(element) ? element.offsetLeft : 0;\n }\n\n private get width(): number {\n return this.activeElement?.clientWidth || 0;\n }\n\n private get activeElement(): Element | null {\n return this.el.children.item(this.activeItemIndex);\n }\n\n // TODO: Switch to HostBinding signals in Angular 17+\n private refresh(): void {\n this.el.style.setProperty('--t-left', tuiPx(this.left));\n this.el.style.setProperty('--t-width', tuiPx(this.width));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAWA,MAMa,qBAAqB,CAAA;AANlC,IAAA,WAAA,GAAA;QAQqB,IAAQ,CAAA,QAAA,GAAyB,WAAW,CAAC;QAG7C,IAAM,CAAA,MAAA,GAAyC,WAAW,CAAC;QAG3D,IAAK,CAAA,KAAA,GAAgC,WAAW,CAAC;QAGjD,IAAQ,CAAA,QAAA,GAAuC,WAAW,CAAC;AAE3D,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QACjC,IAAE,CAAA,EAAA,GAAG,gBAAgB,EAAE,CAAC;AA8B5C,KAAA;IA5BU,kBAAkB,GAAA;AACrB,QAAA,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC;aAC7B,IAAI,CACD,SAAS,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,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,wBAAA,kBAAkB,EAAE,MAAM;AAC7B,qBAAA,EAAA,MAAA,EAAA,CAAA,6mFAAA,CAAA,EAAA,CAAA;8BAUM,IAAI,EAAA,CAAA;sBADV,KAAK;gBAIC,eAAe,EAAA,CAAA;sBADrB,KAAK;gBAIU,qBAAqB,EAAA,CAAA;sBADpC,MAAM;;;AC/CX;;AAEG;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { tuiRound, tuiClamp } from '@taiga-ui/cdk/utils/math';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, INJECTOR, ChangeDetectorRef, Component, ChangeDetectionStrategy, Input,
|
|
3
|
+
import { inject, INJECTOR, ChangeDetectorRef, Component, ChangeDetectionStrategy, Input, forwardRef, Directive, ContentChild } from '@angular/core';
|
|
4
4
|
import { TuiControl } from '@taiga-ui/cdk/classes';
|
|
5
5
|
import { tuiFallbackValueProvider } from '@taiga-ui/cdk/tokens';
|
|
6
6
|
import { __decorate } from 'tslib';
|
|
@@ -21,7 +21,8 @@ const TUI_FLOATING_PRECISION = 7;
|
|
|
21
21
|
function tuiFindKeyStepsBoundariesByFn(keySteps, fn) {
|
|
22
22
|
const keyStepUpperIndex = keySteps.findIndex((keyStep, i) => i && fn(keyStep));
|
|
23
23
|
const lowerStep = keySteps[keyStepUpperIndex - 1] || keySteps[0];
|
|
24
|
-
const upperStep = keySteps[keyStepUpperIndex] ||
|
|
24
|
+
const upperStep = keySteps[keyStepUpperIndex] ||
|
|
25
|
+
keySteps[keySteps.length - 1] || [0, 0];
|
|
25
26
|
return [lowerStep, upperStep];
|
|
26
27
|
}
|
|
27
28
|
function tuiPercentageToKeyStepValue(valuePercentage, keySteps) {
|
|
@@ -91,17 +92,17 @@ class TuiSliderComponent {
|
|
|
91
92
|
set value(newValue) {
|
|
92
93
|
this.el.value = `${newValue}`;
|
|
93
94
|
}
|
|
94
|
-
get segmentWidth() {
|
|
95
|
-
return 100 / Math.max(1, this.segments);
|
|
96
|
-
}
|
|
97
95
|
get hasKeySteps() {
|
|
98
96
|
return Boolean(this.injector.get(TuiSliderKeySteps, null));
|
|
99
97
|
}
|
|
98
|
+
get segmentWidth() {
|
|
99
|
+
return 100 / Math.max(1, this.segments);
|
|
100
|
+
}
|
|
100
101
|
get step() {
|
|
101
102
|
return Number(this.el.step) || 1;
|
|
102
103
|
}
|
|
103
104
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
104
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiSliderComponent, isStandalone: true, selector: "input[type=range][tuiSlider]", inputs: { size: "size", segments: "segments" }, host: { listeners: { "input": "0" }, properties: { "style.--tui-slider-track-color": "options.trackColor", "
|
|
105
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiSliderComponent, isStandalone: true, selector: "input[type=range][tuiSlider]", inputs: { size: "size", segments: "segments" }, host: { listeners: { "input": "0" }, properties: { "style.--tui-slider-track-color": "options.trackColor", "style.--tui-slider-segment-width.%": "segmentWidth", "style.--tui-slider-fill-ratio": "valueRatio", "attr.data-size": "size" } }, ngImport: i0, template: '', isInline: true, styles: [":host{position:relative;display:block;width:100%;color:var(--tui-background-accent-1);cursor:pointer;-webkit-appearance:none;appearance:none;height:.125rem;padding:.4375rem 0;background-color:transparent;background-clip:content-box;outline:none;border-radius:var(--tui-radius-m)}:host:active{cursor:ew-resize}:host:disabled{opacity:var(--tui-disabled-opacity);cursor:auto}:host[data-size=s]:not(:disabled):before{transition-property:transform,opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:.25rem;left:calc(var(--tui-slider-fill-ratio) * 100% - var(--tui-slider-fill-ratio) * .5rem);width:.5rem;height:.5rem;border-radius:50%;transform:var(--tui-slider-thumb-transform, scale(1));content:\"\";cursor:ew-resize;background:currentColor;opacity:0}:host[data-size=s]:active:before{opacity:.2;transform:var(--tui-slider-thumb-transform, scale(1)) scale(2.33)}:host[data-size=m]:not(:disabled):before{transition-property:transform,opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:.125rem;left:calc(var(--tui-slider-fill-ratio) * 100% - var(--tui-slider-fill-ratio) * .75rem);width:.75rem;height:.75rem;border-radius:50%;transform:var(--tui-slider-thumb-transform, scale(1));content:\"\";cursor:ew-resize;background:currentColor;opacity:0}:host[data-size=m]:active:before{opacity:.2;transform:var(--tui-slider-thumb-transform, scale(1)) scale(2.33)}:host::-webkit-slider-container{border-radius:inherit}:host[data-size=m]::-webkit-slider-runnable-track{height:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .5rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width)),linear-gradient(to right,currentColor calc(100% * var(--tui-slider-fill-ratio)),transparent calc(100% * var(--tui-slider-fill-ratio)));background-position-x:0,.25rem,0;background-size:calc(100% - .75rem),calc(100% - .75rem),auto}:host[data-size=s]::-webkit-slider-runnable-track{height:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .375rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width)),linear-gradient(to right,currentColor calc(100% * var(--tui-slider-fill-ratio)),transparent calc(100% * var(--tui-slider-fill-ratio)));background-position-x:0,.125rem,0;background-size:calc(100% - .5rem),calc(100% - .5rem),auto}:host[data-size=m]::-moz-range-track{height:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .5rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width));background-position-x:0,.25rem;background-size:calc(100% - .75rem)}:host[data-size=s]::-moz-range-track{height:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .375rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width));background-position-x:0,.125rem;background-size:calc(100% - .5rem)}:host[data-size=m]::-webkit-slider-thumb{-webkit-transition-property:transform;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%;height:.75rem;width:.75rem;box-sizing:content-box;background-clip:content-box;border:.125rem solid transparent;border-left:0;border-right:0;transform:var(--tui-slider-thumb-transform, scale(1));margin-top:-.4375rem}:not(:disabled):host[data-size=m]::-webkit-slider-thumb{cursor:ew-resize}:not(:disabled):host[data-size=m]::-webkit-slider-thumb:hover,:active:not(:disabled):host[data-size=m]::-webkit-slider-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.333)}:focus-visible:host[data-size=m]::-webkit-slider-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host[data-size=s]::-webkit-slider-thumb{-webkit-transition-property:transform;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%;height:.5rem;width:.5rem;box-sizing:content-box;background-clip:content-box;border:.25rem solid transparent;border-left:0;border-right:0;transform:var(--tui-slider-thumb-transform, scale(1));margin-top:-.4375rem}:not(:disabled):host[data-size=s]::-webkit-slider-thumb{cursor:ew-resize}:not(:disabled):host[data-size=s]::-webkit-slider-thumb:hover,:active:not(:disabled):host[data-size=s]::-webkit-slider-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.5)}:focus-visible:host[data-size=s]::-webkit-slider-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host[data-size=m]::-moz-range-thumb{-moz-transition-property:transform;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%;height:.75rem;width:.75rem;box-sizing:content-box;background-clip:content-box;border:.125rem solid transparent;border-left:0;border-right:0;transform:var(--tui-slider-thumb-transform, scale(1))}:not(:disabled):host[data-size=m]::-moz-range-thumb{cursor:ew-resize}:not(:disabled):host[data-size=m]::-moz-range-thumb:hover,:active:not(:disabled):host[data-size=m]::-moz-range-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.333)}:focus-visible:host[data-size=m]::-moz-range-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host[data-size=s]::-moz-range-thumb{-moz-transition-property:transform;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%;height:.5rem;width:.5rem;box-sizing:content-box;background-clip:content-box;border:.25rem solid transparent;border-left:0;border-right:0;transform:var(--tui-slider-thumb-transform, scale(1))}:not(:disabled):host[data-size=s]::-moz-range-thumb{cursor:ew-resize}:not(:disabled):host[data-size=s]::-moz-range-thumb:hover,:active:not(:disabled):host[data-size=s]::-moz-range-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.5)}:focus-visible:host[data-size=s]::-moz-range-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host::-moz-range-progress{border-radius:inherit}:host::-moz-range-progress{height:.125rem;background:currentColor;border-top-right-radius:0;border-bottom-right-radius:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
105
106
|
}
|
|
106
107
|
__decorate([
|
|
107
108
|
tuiPure
|
|
@@ -117,18 +118,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
117
118
|
*/
|
|
118
119
|
'(input)': '0',
|
|
119
120
|
'[style.--tui-slider-track-color]': 'options.trackColor',
|
|
121
|
+
'[style.--tui-slider-segment-width.%]': 'segmentWidth',
|
|
122
|
+
'[style.--tui-slider-fill-ratio]': 'valueRatio',
|
|
120
123
|
'[attr.data-size]': 'size',
|
|
121
124
|
}, styles: [":host{position:relative;display:block;width:100%;color:var(--tui-background-accent-1);cursor:pointer;-webkit-appearance:none;appearance:none;height:.125rem;padding:.4375rem 0;background-color:transparent;background-clip:content-box;outline:none;border-radius:var(--tui-radius-m)}:host:active{cursor:ew-resize}:host:disabled{opacity:var(--tui-disabled-opacity);cursor:auto}:host[data-size=s]:not(:disabled):before{transition-property:transform,opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:.25rem;left:calc(var(--tui-slider-fill-ratio) * 100% - var(--tui-slider-fill-ratio) * .5rem);width:.5rem;height:.5rem;border-radius:50%;transform:var(--tui-slider-thumb-transform, scale(1));content:\"\";cursor:ew-resize;background:currentColor;opacity:0}:host[data-size=s]:active:before{opacity:.2;transform:var(--tui-slider-thumb-transform, scale(1)) scale(2.33)}:host[data-size=m]:not(:disabled):before{transition-property:transform,opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:.125rem;left:calc(var(--tui-slider-fill-ratio) * 100% - var(--tui-slider-fill-ratio) * .75rem);width:.75rem;height:.75rem;border-radius:50%;transform:var(--tui-slider-thumb-transform, scale(1));content:\"\";cursor:ew-resize;background:currentColor;opacity:0}:host[data-size=m]:active:before{opacity:.2;transform:var(--tui-slider-thumb-transform, scale(1)) scale(2.33)}:host::-webkit-slider-container{border-radius:inherit}:host[data-size=m]::-webkit-slider-runnable-track{height:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .5rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width)),linear-gradient(to right,currentColor calc(100% * var(--tui-slider-fill-ratio)),transparent calc(100% * var(--tui-slider-fill-ratio)));background-position-x:0,.25rem,0;background-size:calc(100% - .75rem),calc(100% - .75rem),auto}:host[data-size=s]::-webkit-slider-runnable-track{height:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .375rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width)),linear-gradient(to right,currentColor calc(100% * var(--tui-slider-fill-ratio)),transparent calc(100% * var(--tui-slider-fill-ratio)));background-position-x:0,.125rem,0;background-size:calc(100% - .5rem),calc(100% - .5rem),auto}:host[data-size=m]::-moz-range-track{height:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .5rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width));background-position-x:0,.25rem;background-size:calc(100% - .75rem)}:host[data-size=s]::-moz-range-track{height:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .375rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width));background-position-x:0,.125rem;background-size:calc(100% - .5rem)}:host[data-size=m]::-webkit-slider-thumb{-webkit-transition-property:transform;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%;height:.75rem;width:.75rem;box-sizing:content-box;background-clip:content-box;border:.125rem solid transparent;border-left:0;border-right:0;transform:var(--tui-slider-thumb-transform, scale(1));margin-top:-.4375rem}:not(:disabled):host[data-size=m]::-webkit-slider-thumb{cursor:ew-resize}:not(:disabled):host[data-size=m]::-webkit-slider-thumb:hover,:active:not(:disabled):host[data-size=m]::-webkit-slider-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.333)}:focus-visible:host[data-size=m]::-webkit-slider-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host[data-size=s]::-webkit-slider-thumb{-webkit-transition-property:transform;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%;height:.5rem;width:.5rem;box-sizing:content-box;background-clip:content-box;border:.25rem solid transparent;border-left:0;border-right:0;transform:var(--tui-slider-thumb-transform, scale(1));margin-top:-.4375rem}:not(:disabled):host[data-size=s]::-webkit-slider-thumb{cursor:ew-resize}:not(:disabled):host[data-size=s]::-webkit-slider-thumb:hover,:active:not(:disabled):host[data-size=s]::-webkit-slider-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.5)}:focus-visible:host[data-size=s]::-webkit-slider-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host[data-size=m]::-moz-range-thumb{-moz-transition-property:transform;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%;height:.75rem;width:.75rem;box-sizing:content-box;background-clip:content-box;border:.125rem solid transparent;border-left:0;border-right:0;transform:var(--tui-slider-thumb-transform, scale(1))}:not(:disabled):host[data-size=m]::-moz-range-thumb{cursor:ew-resize}:not(:disabled):host[data-size=m]::-moz-range-thumb:hover,:active:not(:disabled):host[data-size=m]::-moz-range-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.333)}:focus-visible:host[data-size=m]::-moz-range-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host[data-size=s]::-moz-range-thumb{-moz-transition-property:transform;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%;height:.5rem;width:.5rem;box-sizing:content-box;background-clip:content-box;border:.25rem solid transparent;border-left:0;border-right:0;transform:var(--tui-slider-thumb-transform, scale(1))}:not(:disabled):host[data-size=s]::-moz-range-thumb{cursor:ew-resize}:not(:disabled):host[data-size=s]::-moz-range-thumb:hover,:active:not(:disabled):host[data-size=s]::-moz-range-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.5)}:focus-visible:host[data-size=s]::-moz-range-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}:host::-moz-range-progress{border-radius:inherit}:host::-moz-range-progress{height:.125rem;background:currentColor;border-top-right-radius:0;border-bottom-right-radius:0}\n"] }]
|
|
122
125
|
}], ctorParameters: function () { return []; }, propDecorators: { size: [{
|
|
123
126
|
type: Input
|
|
124
127
|
}], segments: [{
|
|
125
128
|
type: Input
|
|
126
|
-
}], valueRatio: [{
|
|
127
|
-
type: HostBinding,
|
|
128
|
-
args: ['style.--tui-slider-fill-ratio']
|
|
129
|
-
}], segmentWidth: [{
|
|
130
|
-
type: HostBinding,
|
|
131
|
-
args: ['style.--tui-slider-segment-width.%']
|
|
132
129
|
}], hasKeySteps: [] } });
|
|
133
130
|
|
|
134
131
|
class TuiSliderKeySteps extends TuiControl {
|
|
@@ -149,7 +146,7 @@ class TuiSliderKeySteps extends TuiControl {
|
|
|
149
146
|
return this.keySteps[0][1];
|
|
150
147
|
}
|
|
151
148
|
get max() {
|
|
152
|
-
return this.keySteps[this.keySteps.length - 1][1];
|
|
149
|
+
return this.keySteps[this.keySteps.length - 1]?.[1] ?? 0;
|
|
153
150
|
}
|
|
154
151
|
updateControlValue() {
|
|
155
152
|
this.onChange(tuiPercentageToKeyStepValue(this.slider.valueRatio * 100, this.keySteps));
|
|
@@ -174,16 +171,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
174
171
|
'[attr.aria-valuemax]': 'max',
|
|
175
172
|
'[disabled]': 'disabled()',
|
|
176
173
|
'(blur)': 'onTouched()',
|
|
174
|
+
'(input)': 'updateControlValue()',
|
|
175
|
+
'(change)': 'updateControlValue()',
|
|
177
176
|
},
|
|
178
177
|
}]
|
|
179
178
|
}], propDecorators: { keySteps: [{
|
|
180
179
|
type: Input
|
|
181
|
-
}], updateControlValue: [{
|
|
182
|
-
type: HostListener,
|
|
183
|
-
args: ['input']
|
|
184
|
-
}, {
|
|
185
|
-
type: HostListener,
|
|
186
|
-
args: ['change']
|
|
187
180
|
}] } });
|
|
188
181
|
|
|
189
182
|
const SLIDER_INTERACTION_KEYS = new Set([
|
|
@@ -234,23 +227,21 @@ class TuiSliderReadonly {
|
|
|
234
227
|
}
|
|
235
228
|
}
|
|
236
229
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSliderReadonly, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
237
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "16.2.12", type: TuiSliderReadonly, isStandalone: true, selector: "input[tuiSlider][readonly]", inputs: { readonly: ["readonly", "readonly", coerceBooleanProperty] }, host: { listeners: { "
|
|
230
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "16.2.12", type: TuiSliderReadonly, isStandalone: true, selector: "input[tuiSlider][readonly]", inputs: { readonly: ["readonly", "readonly", coerceBooleanProperty] }, host: { listeners: { "keydown": "preventKeyboardInteraction($event)", "mousedown": "preventEvent($event)" } }, ngImport: i0 }); }
|
|
238
231
|
}
|
|
239
232
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiSliderReadonly, decorators: [{
|
|
240
233
|
type: Directive,
|
|
241
234
|
args: [{
|
|
242
235
|
standalone: true,
|
|
243
236
|
selector: 'input[tuiSlider][readonly]',
|
|
237
|
+
host: {
|
|
238
|
+
'(keydown)': 'preventKeyboardInteraction($event)',
|
|
239
|
+
'(mousedown)': 'preventEvent($event)',
|
|
240
|
+
},
|
|
244
241
|
}]
|
|
245
242
|
}], ctorParameters: function () { return []; }, propDecorators: { readonly: [{
|
|
246
243
|
type: Input,
|
|
247
244
|
args: [{ transform: coerceBooleanProperty }]
|
|
248
|
-
}], preventEvent: [{
|
|
249
|
-
type: HostListener,
|
|
250
|
-
args: ['mousedown', ['$event']]
|
|
251
|
-
}], preventKeyboardInteraction: [{
|
|
252
|
-
type: HostListener,
|
|
253
|
-
args: ['keydown', ['$event']]
|
|
254
245
|
}] } });
|
|
255
246
|
|
|
256
247
|
/// <reference types="@taiga-ui/tsconfig/ng-dev-mode" />
|