Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(layout): Cell add disabled state #10307

Merged
merged 4 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions projects/demo/src/modules/components/cell/examples/9/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<button
disabled
tuiCell
>
<div tuiTitle>Disabled cell</div>
<tui-badge-notification size="l">1</tui-badge-notification>
<tui-icon
tuiTooltip="A cell can be a button"
(click.prevent)="(0)"
/>
<div tuiSubtitle>Hint enabled</div>
</button>

<label
tuiAppearance
tuiAppearanceState="disabled"
tuiCell
>
<div tuiTitle>
A disabled label
<div tuiSubtitle>Clicking it will not toggle checkbox</div>
</div>
<tui-loader />
<input
disabled
tuiCheckbox
type="checkbox"
[(ngModel)]="value"
/>
<tui-icon tuiTooltip="Hint enabled" />
</label>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
:host {
display: flex;
flex-direction: column;
gap: 1rem;
}

[tuiCell] {
max-inline-size: 25rem;
}
29 changes: 29 additions & 0 deletions projects/demo/src/modules/components/cell/examples/9/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {Component} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiAppearance, TuiIcon, TuiLoader, TuiTitle} from '@taiga-ui/core';
import {TuiBadgeNotification, TuiCheckbox, TuiTooltip} from '@taiga-ui/kit';
import {TuiCell} from '@taiga-ui/layout';

@Component({
standalone: true,
imports: [
FormsModule,
TuiAppearance,
TuiBadgeNotification,
TuiCell,
TuiCheckbox,
TuiIcon,
TuiLoader,
TuiTitle,
TuiTooltip,
],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
changeDetection,
})
export default class Example {
protected value = false;
}
1 change: 1 addition & 0 deletions projects/demo/src/modules/components/cell/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ export default class Example {
'Actions',
'Combinations',
'Connected',
'Disabled state',
];
}
30 changes: 27 additions & 3 deletions projects/layout/components/cell/cell.styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,23 @@
min-block-size: var(--t-height);
border-radius: var(--t-radius);

&:disabled {
&:disabled,
&[data-state='disabled'] {
opacity: initial;
pointer-events: none;

& > *:not([tuiTooltip]) {
opacity: var(--tui-disabled-opacity);
}
}

&:has(input:disabled) {
opacity: initial;
pointer-events: none;

& > *:not([tuiTooltip]) {
opacity: var(--tui-disabled-opacity);
}
}

[tuiAccessories] {
Expand Down Expand Up @@ -213,7 +228,16 @@
a[tuiCell]:not([tuiSurface]):hover,
button[tuiCell]:not([tuiSurface]):hover,
label[tuiCell]:not([tuiSurface]):hover {
background: var(--tui-background-neutral-1);
cursor: pointer;
&:not(:disabled, [data-state='disabled']) {
background: var(--tui-background-neutral-1);
cursor: pointer;
}
}

label[tuiCell]:not([tuiSurface]):hover {
&:not(:has(input:disabled)) {
background: var(--tui-background-neutral-1);
cursor: pointer;
}
}
}
Loading