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

Merge branch 'master' into next #3071

Merged
merged 31 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d52ab50
feat: allow list to be expressive
Akshat55 Nov 9, 2024
c8cb8db
fix: allow users to pass in aria-label for button
Akshat55 Nov 9, 2024
dd2895d
feat: add clickable tile Icon directive
Akshat55 Nov 10, 2024
d41aada
chore: lint fix
Akshat55 Nov 10, 2024
3793bfa
feat: add icon support
Akshat55 Nov 11, 2024
6543175
feat: create clickable/selectable tag components
Akshat55 Nov 11, 2024
50774c0
chore: remove icon input
Akshat55 Nov 11, 2024
a6db536
fix: set default value of disabled to false
Akshat55 Nov 11, 2024
008fddb
test: detect changes once component is created
Akshat55 Nov 11, 2024
b30eb0d
fix: export operational tag from directory
Akshat55 Nov 11, 2024
82e3628
feat: create link directive to pair icon with link
Akshat55 Nov 12, 2024
7db29d7
fix: export link icon directive
Akshat55 Nov 12, 2024
9222f6c
Merge pull request #3056 from Akshat55/link-icon
zvonimirfras Nov 12, 2024
71d30bd
Merge branch 'master' into clickable-tile-icon
zvonimirfras Nov 12, 2024
b858e05
Merge pull request #3054 from Akshat55/clickable-tile-icon
zvonimirfras Nov 12, 2024
a786eeb
Merge branch 'master' into expressive-list
zvonimirfras Nov 12, 2024
0e072f0
Merge pull request #3052 from Akshat55/expressive-list
zvonimirfras Nov 12, 2024
b36671c
Merge branch 'master' into toggle-aria
zvonimirfras Nov 12, 2024
a119742
Merge pull request #3053 from Akshat55/toggle-aria
zvonimirfras Nov 12, 2024
f25bfaa
Merge branch 'master' into tag-components
zvonimirfras Nov 12, 2024
6b449df
Merge pull request #3055 from Akshat55/tag-components
zvonimirfras Nov 14, 2024
8494242
doc: update codesandbox to stackblitz (#3061)
klaascuvelier Nov 19, 2024
9885e4b
fix: refresh view after content is initialized
Akshat55 Nov 21, 2024
a399c44
test: increase warning budget
Akshat55 Nov 21, 2024
ee240f2
Merge pull request #3069 from Akshat55/expressionchanged-input
zvonimirfras Nov 21, 2024
3bda789
feat: fluid state for combobox (#3010)
eduardmarcinco Nov 22, 2024
3108b90
feat: fluid state for dropdown (#3008)
eduardmarcinco Nov 22, 2024
bda34f7
chore(deps): bump cookie, socket.io and express in /integration/ng17 …
dependabot[bot] Nov 22, 2024
bcc505f
fix: allow tooltip disabled icon button (#3062)
klaascuvelier Nov 22, 2024
cd447b6
fix: map disabled values to itemValueKey on clearSelected (#3064)
stijndeschuymer Nov 22, 2024
369fff6
test: increase warning budget
Akshat55 Nov 22, 2024
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ That's it! Now we can run `npm start` and start building out our application!

> *Note:* This isn't the only way to bootstrap a `carbon-components-angular` application, but the combination of `@angular/cli` and the `carbon-components` scss is our recommended setup.

[![Edit Carbon Components Angular](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/0129r494ql)
[![Edit Carbon Components Angular](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/stackblitz-starters-exxkq4?file=src%2Fmain.ts)

### Support

Expand Down
92 changes: 78 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"@angular/platform-browser-dynamic": "18.2.12",
"@angular/router": "18.2.12",
"@babel/core": "7.9.6",
"@carbon/styles": "1.67.0",
"@carbon/styles": "1.70.0",
"@commitlint/cli": "17.0.3",
"@commitlint/config-conventional": "17.0.3",
"@compodoc/compodoc": "1.1.26",
Expand Down
6 changes: 5 additions & 1 deletion src/button/icon-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ButtonSize, ButtonType } from "./button.types";
<cds-tooltip
class="cds--icon-tooltip"
[description]="description"
[disabled]="disabled"
[disabled]="showTooltipWhenDisabled ? false : disabled"
[caret]="caret"
[dropShadow]="dropShadow"
[highContrast]="highContrast"
Expand Down Expand Up @@ -123,6 +123,10 @@ export class IconButton extends BaseIconButton implements AfterViewInit {
* The string or template content to be exposed by the tooltip.
*/
@Input() description: string | TemplateRef<any>;
/**
* Indicates whether the tooltip should be shown when the button is disabled
*/
@Input() showTooltipWhenDisabled = false;

/**
* Common button events
Expand Down
9 changes: 8 additions & 1 deletion src/button/icon-button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export default {
size: "md",
isExpressive: "false",
disabled: false,
autoAlign: false
autoAlign: false,
showTooltipWhenDisabled: false
},
argTypes: {
align: {
Expand Down Expand Up @@ -54,6 +55,9 @@ export default {
disabled: {
type: "boolean"
},
showTooltipWhenDisabled: {
type: "boolean"
},
// Actions
onClick: { action: "clicked" },
onMouseEnter: { action: "mouseenter" },
Expand All @@ -79,6 +83,7 @@ const Template = (args) => ({
[buttonNgClass]="buttonNgClass"
[buttonAttributes]="buttonAttributes"
[disabled]="disabled"
[showTooltipWhenDisabled]="showTooltipWhenDisabled"
description="Icon Description"
(click)="onClick($event)"
(mouseenter)="onMouseEnter($event)"
Expand Down Expand Up @@ -115,6 +120,7 @@ const AutoAlignTemplate = (args) => ({
[isOpen]="isOpen"
[buttonNgClass]="buttonNgClass"
[disabled]="disabled"
[showTooltipWhenDisabled]="showTooltipWhenDisabled"
[description]="description"
(click)="onClick($event)"
(mouseenter)="onMouseEnter($event)"
Expand All @@ -134,3 +140,4 @@ WithAutoAlign.args = {
align: "top",
isOpen: true
};

38 changes: 32 additions & 6 deletions src/combobox/combobox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ import { Observable } from "rxjs";
@Component({
selector: "cds-combo-box, ibm-combo-box",
template: `
<div class="cds--list-box__wrapper">
<div
class="cds--list-box__wrapper"
[ngClass]="{
'cds--list-box__wrapper--fluid': fluid,
'cds--list-box__wrapper--fluid--invalid': fluid && invalid,
'cds--list-box__wrapper--fluid--focus': fluid && _isFocused
}">
<label
*ngIf="label"
[for]="id"
Expand All @@ -64,7 +70,8 @@ import { Observable } from "rxjs";
'cds--list-box--lg': size === 'lg',
'cds--list-box--disabled': disabled,
'cds--combo-box--readonly': readonly,
'cds--combo-box--warning cds--list-box--warning': warn
'cds--combo-box--warning cds--list-box--warning': warn,
'cds--list-box--invalid': invalid
}"
class="cds--list-box cds--combo-box"
[attr.data-invalid]="(invalid ? true : null)">
Expand Down Expand Up @@ -109,7 +116,8 @@ import { Observable } from "rxjs";
[disabled]="disabled"
[readOnly]="readonly"
(input)="onSearch($event.target.value)"
(blur)="onBlur()"
(focus)="fluid ? handleFocus($event) : null"
(blur)="fluid ? handleFocus($event) : onBlur()"
(keydown.enter)="onSubmit($event)"
[value]="selectedValue"
class="cds--text-input"
Expand Down Expand Up @@ -166,8 +174,9 @@ import { Observable } from "rxjs";
<ng-content *ngIf="open"></ng-content>
</div>
</div>
<hr *ngIf="fluid" class="cds--list-box__divider" />
<div
*ngIf="helperText && !invalid && !warn"
*ngIf="helperText && !invalid && !warn && !fluid"
class="cds--form__helper-text"
[ngClass]="{'cds--form__helper-text--disabled': disabled}">
<ng-container *ngIf="!isTemplate(helperText)">{{helperText}}</ng-container>
Expand Down Expand Up @@ -368,6 +377,10 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
* Set to `true` for readonly state.
*/
@Input() readonly = false;
/**
* Experimental: enable fluid state
*/
@Input() fluid = false;
/**
* Emits a ListItem
*
Expand Down Expand Up @@ -426,7 +439,6 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
@ViewChild("input", { static: true }) input: ElementRef;
@ViewChild("listbox", { static: true }) listbox: ElementRef;
@HostBinding("class.cds--list-box__wrapper") hostClass = true;
@HostBinding("style.display") display = "block";

public open = false;

Expand Down Expand Up @@ -456,6 +468,8 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
protected _clearSelectionTitle = this.i18n.getOverridable("COMBOBOX.CLEAR_SELECTED");
protected _clearSelectionAria = this.i18n.getOverridable("COMBOBOX.A11Y.CLEAR_SELECTED");

protected _isFocused = false;

/**
* Creates an instance of ComboBox.
*/
Expand Down Expand Up @@ -680,7 +694,15 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
// clearSelected can only fire on type=multi
// so we just emit getSelected() (just in case there's any disabled but selected items)
const selected = this.view.getSelected();
this.propagateChangeCallback(selected);

// in case there are disabled items they should be mapped according to itemValueKey
if (this.itemValueKey && selected) {
const values = selected.map((item) => item[this.itemValueKey]);
this.propagateChangeCallback(values);
} else {
this.propagateChangeCallback(selected);
}

this.selected.emit(selected as any);
this.clear.emit(event);
}
Expand Down Expand Up @@ -877,6 +899,10 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
}
}

handleFocus(event: FocusEvent) {
this._isFocused = event.type === "focus";
}

protected updateSelected() {
const selected = this.view.getSelected();
if (this.type === "multi") {
Expand Down
9 changes: 8 additions & 1 deletion src/combobox/combobox.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export default {
dropUp: false,
selectionFeedback: "top-after-reopen",
size: "md",
theme: "dark"
theme: "dark",
fluid: false
},
argTypes: {
size: {
Expand Down Expand Up @@ -119,6 +120,7 @@ const Template = (args) => ({
[items]="items"
[theme]="theme"
[dropUp]="dropUp"
[fluid]="fluid"
(selected)="selected($event)"
(submit)="submit($event)"
(search)="search($event)"
Expand Down Expand Up @@ -176,6 +178,10 @@ Dynamic.parameters = {
}
};

export const Fluid = Template.bind({});
Fluid.args = {
fluid: true
};

const MultiTemplate = (args) => ({
props: args,
Expand All @@ -196,6 +202,7 @@ const MultiTemplate = (args) => ({
[selectionFeedback]="selectionFeedback"
[dropUp]="dropUp"
[appendInline]="appendInline"
[fluid]="fluid"
type="multi"
(selected)="selected($event)"
(submit)="submit($event)"
Expand Down
Loading
Loading