diff --git a/projects/demo/src/modules/components/cell/examples/8/index.html b/projects/demo/src/modules/components/cell/examples/8/index.html new file mode 100644 index 0000000000000..73895e9fb99d6 --- /dev/null +++ b/projects/demo/src/modules/components/cell/examples/8/index.html @@ -0,0 +1,82 @@ + + tuiConnected directive can be attached as host directive: + hostDirectives: [TuiConnected] + + +
+ + + +
diff --git a/projects/demo/src/modules/components/cell/examples/8/index.less b/projects/demo/src/modules/components/cell/examples/8/index.less new file mode 100644 index 0000000000000..4d422fdd30780 --- /dev/null +++ b/projects/demo/src/modules/components/cell/examples/8/index.less @@ -0,0 +1,6 @@ +:host { + display: flex; + flex-direction: column; + max-width: 20rem; + gap: 1rem; +} diff --git a/projects/demo/src/modules/components/cell/examples/8/index.ts b/projects/demo/src/modules/components/cell/examples/8/index.ts new file mode 100644 index 0000000000000..1f0056374a536 --- /dev/null +++ b/projects/demo/src/modules/components/cell/examples/8/index.ts @@ -0,0 +1,65 @@ +import {NgFor} from '@angular/common'; +import {Component} from '@angular/core'; +import {FormsModule} from '@angular/forms'; +import {changeDetection} from '@demo/emulate/change-detection'; +import {encapsulation} from '@demo/emulate/encapsulation'; +import {TuiIcon, TuiNotification, TuiSurface} from '@taiga-ui/core'; +import { + TuiAvatar, + TuiBadge, + TuiBadgedContent, + TuiConnected, + TuiDataListWrapper, + TuiSwitch, +} from '@taiga-ui/kit'; +import {TuiCardLarge, TuiCell} from '@taiga-ui/layout'; +import {TuiSelectModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy'; + +@Component({ + standalone: true, + imports: [ + TuiNotification, + TuiCell, + TuiAvatar, + TuiSelectModule, + TuiDataListWrapper, + TuiTextfieldControllerModule, + TuiCardLarge, + TuiSurface, + NgFor, + FormsModule, + TuiBadgedContent, + TuiIcon, + TuiConnected, + TuiBadge, + TuiSwitch, + ], + templateUrl: './index.html', + styleUrls: ['./index.less'], + encapsulation, + changeDetection, +}) +export default class Example { + protected readonly items = [ + { + icon: '@tui.eye', + title: 'Show more', + subtitle: 'Ctrl + Shift + M', + }, + { + icon: '@tui.mail', + title: 'Send message', + subtitle: 'Keep it short', + }, + { + icon: '@tui.lock', + title: 'Access', + subtitle: 'Block your account', + }, + ]; + + protected value = this.items[0]; + + protected incoming = false; + protected outgoing = true; +} diff --git a/projects/demo/src/modules/components/cell/index.ts b/projects/demo/src/modules/components/cell/index.ts index 53462076f6168..4142b1426a2d5 100644 --- a/projects/demo/src/modules/components/cell/index.ts +++ b/projects/demo/src/modules/components/cell/index.ts @@ -22,5 +22,6 @@ export default class Example { 'Long content', 'Actions', 'Combinations', + 'Connected', ]; } diff --git a/projects/demo/src/modules/components/stepper/examples/4/index.html b/projects/demo/src/modules/components/stepper/examples/4/index.html new file mode 100644 index 0000000000000..9a7a6532d655d --- /dev/null +++ b/projects/demo/src/modules/components/stepper/examples/4/index.html @@ -0,0 +1,12 @@ + + + diff --git a/projects/demo/src/modules/components/stepper/examples/4/index.less b/projects/demo/src/modules/components/stepper/examples/4/index.less new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/projects/demo/src/modules/components/stepper/examples/4/index.ts b/projects/demo/src/modules/components/stepper/examples/4/index.ts new file mode 100644 index 0000000000000..ceac6de6087e1 --- /dev/null +++ b/projects/demo/src/modules/components/stepper/examples/4/index.ts @@ -0,0 +1,16 @@ +import {NgForOf} from '@angular/common'; +import {Component} from '@angular/core'; +import {changeDetection} from '@demo/emulate/change-detection'; +import {encapsulation} from '@demo/emulate/encapsulation'; +import {TuiConnected, TuiStepper} from '@taiga-ui/kit'; + +@Component({ + standalone: true, + imports: [TuiStepper, TuiConnected, NgForOf], + templateUrl: './index.html', + encapsulation, + changeDetection, +}) +export default class Example { + protected readonly steps = ['Start Up', 'Cash In', 'Sell Out', 'Bro Down']; +} diff --git a/projects/demo/src/modules/components/stepper/index.ts b/projects/demo/src/modules/components/stepper/index.ts index 9645a5562d78f..84f9b47ba82ea 100644 --- a/projects/demo/src/modules/components/stepper/index.ts +++ b/projects/demo/src/modules/components/stepper/index.ts @@ -13,7 +13,12 @@ import {TuiStepper} from '@taiga-ui/kit'; export default class Page { protected activeItemIndex = 0; - protected readonly examples = ['Basic', 'Vertical', 'Vertical autoscroll']; + protected readonly examples = [ + 'Basic', + 'Vertical', + 'Vertical autoscroll', + 'Vertical connected', + ]; protected readonly orientationVariants: readonly TuiOrientation[] = [ 'horizontal', diff --git a/projects/kit/directives/connected/connected.directive.ts b/projects/kit/directives/connected/connected.directive.ts new file mode 100644 index 0000000000000..c2334d0ddb21b --- /dev/null +++ b/projects/kit/directives/connected/connected.directive.ts @@ -0,0 +1,30 @@ +import { + ChangeDetectionStrategy, + Component, + Directive, + ViewEncapsulation, +} from '@angular/core'; +import {tuiWithStyles} from '@taiga-ui/cdk/utils/miscellaneous'; + +@Component({ + standalone: true, + template: '', + styleUrls: ['./connected.style.less'], + encapsulation: ViewEncapsulation.None, + changeDetection: ChangeDetectionStrategy.OnPush, + host: { + class: 'tui-connected-styles', + }, +}) +class TuiConnectedStyles {} + +@Directive({ + standalone: true, + selector: '[tuiConnected]', + host: { + tuiConnected: '', + }, +}) +export class TuiConnected { + protected readonly nothing = tuiWithStyles(TuiConnectedStyles); +} diff --git a/projects/kit/directives/connected/connected.style.less b/projects/kit/directives/connected/connected.style.less new file mode 100644 index 0000000000000..2a4e3ecf7e381 --- /dev/null +++ b/projects/kit/directives/connected/connected.style.less @@ -0,0 +1,40 @@ +@import '@taiga-ui/core/styles/taiga-ui-local'; + +[tuiConnected] { + --tui-icon-height: 2rem; + --tui-icon-width: 2rem; + --tui-left-offset: 1rem; + --tui-vertical-offset: calc((100% + var(--tui-icon-height)) / 2 + 4px); + --tui-connected-height: calc(100% - var(--tui-vertical-offset)); + + &[tuiCardLarge] [tuiCell], + [tuiCell], + [tuiStep] { + &:not(:first-of-type):before, + &:not(:last-of-type):after { + content: ''; + position: absolute; + bottom: var(--tui-vertical-offset); + left: calc(var(--tui-icon-width) / 2 + var(--tui-left-offset)); + height: var(--tui-connected-height); + width: 1px; + background-color: var(--tui-border-normal); + } + + &:not(:last-of-type):after { + top: var(--tui-vertical-offset); + } + } + + &[tuiCardLarge] [tuiCell] { + --tui-left-offset: 0.5rem; + --tui-icon-height: 2.5rem; + --tui-icon-width: 2.5rem; + } + + [tuiStep] { + --tui-left-offset: 0rem; + --tui-vertical-margin: 1.25rem; + --tui-connected-height: calc(100% - var(--tui-vertical-offset) + var(--tui-vertical-margin) / 2); + } +} diff --git a/projects/kit/directives/connected/index.ts b/projects/kit/directives/connected/index.ts new file mode 100644 index 0000000000000..8ccc517cfdeae --- /dev/null +++ b/projects/kit/directives/connected/index.ts @@ -0,0 +1 @@ +export * from './connected.directive'; diff --git a/projects/kit/directives/connected/ng-package.json b/projects/kit/directives/connected/ng-package.json new file mode 100644 index 0000000000000..bebf62dcb5e51 --- /dev/null +++ b/projects/kit/directives/connected/ng-package.json @@ -0,0 +1,5 @@ +{ + "lib": { + "entryFile": "index.ts" + } +} diff --git a/projects/kit/directives/index.ts b/projects/kit/directives/index.ts index 4bb4dc14df831..e537964d134dd 100644 --- a/projects/kit/directives/index.ts +++ b/projects/kit/directives/index.ts @@ -3,6 +3,7 @@ export * from '@taiga-ui/kit/directives/button-group'; export * from '@taiga-ui/kit/directives/button-vertical'; export * from '@taiga-ui/kit/directives/chevron'; export * from '@taiga-ui/kit/directives/comment'; +export * from '@taiga-ui/kit/directives/connected'; export * from '@taiga-ui/kit/directives/data-list-dropdown-manager'; export * from '@taiga-ui/kit/directives/fade'; export * from '@taiga-ui/kit/directives/highlight';