Skip to content

Commit 73585d2

Browse files
authored
fix/866-ensure-consistency-property-names (#891)
* fix(ui-library): harmonized property naming in iconButton
1 parent 32b184e commit 73585d2

File tree

8 files changed

+31
-38
lines changed

8 files changed

+31
-38
lines changed

packages/ui-library/src/components/icon-button/index.stories.ts

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,21 @@ const sharedStyles = html`
2424
const argTypesToDisable = [
2525
'theme',
2626
'variant',
27+
'sizeVariant',
2728
'icon',
28-
'size',
2929
'disabled',
3030
'loading',
3131
'readonly',
3232
'required',
33-
'buttonId',
33+
'iconButtonId',
3434
'hasError',
3535
'errorMessage',
3636
'errorIcon',
3737
'arialabel',
38-
'textareaId',
3938
'name',
4039
'onChange',
4140
'onFocus',
4241
'onBlur',
43-
'onSelect',
4442
];
4543

4644
const generateDisabledArgTypes = (argTypes: string[]) => {
@@ -62,17 +60,15 @@ export default {
6260
argTypes: {
6361
//Appearance
6462
variant: {
65-
name: 'variant',
6663
description: 'Select variant of the component.',
6764
options: ActionVariants,
6865
control: { type: 'select' },
6966
table: {
7067
category: 'Appearance',
7168
},
7269
},
73-
size: {
70+
sizeVariant: {
7471
options: ActionSizes,
75-
name: 'sizeVariant',
7672
description: 'Select size of the component.',
7773
control: { type: 'select' },
7874
table: {
@@ -103,7 +99,6 @@ export default {
10399
},
104100
},
105101
loading: {
106-
name: 'loading',
107102
description: 'Choose if the component is loading.',
108103
table: {
109104
category: 'States',
@@ -119,33 +114,32 @@ export default {
119114
},
120115
},
121116
//Technical attributes
122-
buttonId: {
117+
iconButtonId: {
123118
description: 'Unique identifier for this component.',
124119
table: {
125120
category: 'Technical Attributes',
126121
},
127122
},
128-
129123
// Events
130124
onChange: {
131125
description: 'Fires when the value changes.',
132126
action: 'onChange',
133127
table: {
134-
disable: true,
128+
category: 'Events',
135129
},
136130
},
137131
onFocus: {
138132
description: 'Fires when the component is focused.',
139133
action: 'onFocus',
140134
table: {
141-
disable: true,
135+
category: 'Events',
142136
},
143137
},
144138
onBlur: {
145139
description: 'Fires when the component lost focus.',
146140
action: 'onBlur',
147141
table: {
148-
disable: true,
142+
category: 'Events',
149143
},
150144
},
151145
},
@@ -183,12 +177,12 @@ BlrIconButton.storyName = 'Icon Button';
183177
const defaultParams: BlrIconButtonType = {
184178
theme: 'Light',
185179
variant: 'primary',
186-
size: 'md',
180+
sizeVariant: 'md',
187181
icon: 'blr360',
188182
disabled: false,
189183
loading: false,
190184
arialabel: 'Icon Button',
191-
buttonId: 'iconButtonId',
185+
iconButtonId: 'iconButtonId',
192186
};
193187
BlrIconButton.args = defaultParams;
194188

@@ -242,23 +236,23 @@ export const SizeVariant = () => {
242236
<div class="stories-icon-button">
243237
${BlrIconButtonRenderFunction({
244238
...defaultParams,
245-
size: 'xs',
239+
sizeVariant: 'xs',
246240
})}
247241
${BlrIconButtonRenderFunction({
248242
...defaultParams,
249-
size: 'sm',
243+
sizeVariant: 'sm',
250244
})}
251245
${BlrIconButtonRenderFunction({
252246
...defaultParams,
253-
size: 'md',
247+
sizeVariant: 'md',
254248
})}
255249
${BlrIconButtonRenderFunction({
256250
...defaultParams,
257-
size: 'lg',
251+
sizeVariant: 'lg',
258252
})}
259253
${BlrIconButtonRenderFunction({
260254
...defaultParams,
261-
size: 'xl',
255+
sizeVariant: 'xl',
262256
})}
263257
</div>
264258
`;

packages/ui-library/src/components/icon-button/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const sampleParams: BlrIconButtonType = {
1111
icon: 'blrChevronDown',
1212
loading: false,
1313
disabled: false,
14-
buttonId: 'button-id',
14+
iconButtonId: 'button-id',
1515
variant: 'cta',
1616
theme: 'Light',
1717
};
@@ -54,7 +54,7 @@ describe('blr-icon-button', () => {
5454
});
5555

5656
it('has a size sm when "size" is set to "sm" ', async () => {
57-
const element = await fixture(BlrIconButtonRenderFunction({ ...sampleParams, size: 'sm' }));
57+
const element = await fixture(BlrIconButtonRenderFunction({ ...sampleParams, sizeVariant: 'sm' }));
5858

5959
const iconButton = querySelectorDeep('.blr-icon-button', element.getRootNode() as HTMLElement);
6060
const className = iconButton?.className;

packages/ui-library/src/components/icon-button/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ export class BlrIconButton extends LitElement {
4040
@property() icon?: SizelessIconType;
4141
@property() loading?: boolean;
4242
@property() disabled!: boolean;
43-
@property() buttonId?: string;
43+
@property() iconButtonId?: string;
4444
@property() variant: ActionVariantType = 'primary';
45-
@property() size?: ActionSizesType = 'md';
45+
@property() sizeVariant?: ActionSizesType = 'md';
4646

4747
@property() theme: ThemeType = 'Light';
4848

@@ -69,12 +69,12 @@ export class BlrIconButton extends LitElement {
6969
};
7070

7171
protected render() {
72-
if (this.size) {
72+
if (this.sizeVariant) {
7373
const dynamicStyles = this.theme === 'Light' ? [actionLight] : [actionDark];
7474

7575
const classes = classMap({
7676
[this.variant]: this.variant,
77-
[this.size]: this.size,
77+
[this.sizeVariant]: this.sizeVariant,
7878
disabled: this.disabled,
7979
loading: this.loading || false,
8080
});
@@ -88,15 +88,15 @@ export class BlrIconButton extends LitElement {
8888
const loaderSizeVariant = getComponentConfigToken([
8989
'SizeVariant',
9090
'Actions',
91-
this.size.toUpperCase(),
91+
this.sizeVariant.toUpperCase(),
9292
'Loader',
9393
]).toLowerCase() as FormSizesType;
9494

9595
const iconSizeVariant = getComponentConfigToken([
9696
'SizeVariant',
9797
'Actions',
9898
'IconButton',
99-
this.size.toUpperCase(),
99+
this.sizeVariant.toUpperCase(),
100100
'Icon',
101101
]).toLowerCase() as SizesType;
102102

@@ -109,7 +109,7 @@ export class BlrIconButton extends LitElement {
109109
class="blr-semantic-action blr-icon-button ${classes}"
110110
aria-disabled=${this.disabled ? 'true' : nothing}
111111
@click=${this.handleClick}
112-
id=${this.buttonId || nothing}
112+
id=${this.iconButtonId || nothing}
113113
tabindex=${this.disabled ? nothing : '0'}
114114
@focus=${this.handleFocus}
115115
@blur=${this.handleBlur}

packages/ui-library/src/components/slider-single-value/range-legend-slider/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ export class BlrRangeLegendSlider extends LitElement {
5454
icon: iconName,
5555
loading: false,
5656
disabled: this.disabled || false,
57-
buttonId: btnId,
57+
iconButtonId: btnId,
5858
variant: this.btnVariant,
59-
size: this.size,
59+
sizeVariant: this.size,
6060
theme: this.theme,
6161
})}`;
6262

packages/ui-library/src/components/slider-single-value/range-slider/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ export class BlrRangeSlider extends LitElement {
5454
icon: iconName,
5555
loading: false,
5656
disabled: this.disabled || false,
57-
buttonId: btnId,
57+
iconButtonId: btnId,
5858
variant: this.btnVariant,
59-
size: this.size,
59+
sizeVariant: this.size,
6060
theme: this.theme,
6161
})}`;
6262

packages/ui-library/src/components/slider-two-values/range-legend-min-max-slider/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ export class BlrRangeLegendMinMaxSlider extends LitElement {
5656
icon: iconName,
5757
loading: false,
5858
disabled: this.disabled || false,
59-
buttonId: btnId,
59+
iconButtonId: btnId,
6060
variant: this.btnVariant,
61-
size: this.size,
61+
sizeVariant: this.size,
6262
theme: this.theme,
6363
});
6464

packages/ui-library/src/components/slider-two-values/range-min-max-slider/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ export class BlrRangeMinMaxSlider extends LitElement {
5656
icon: iconName,
5757
loading: false,
5858
disabled: this.disabled || false,
59-
buttonId: btnId,
59+
iconButtonId: btnId,
6060
variant: this.btnVariant,
61-
size: this.size,
61+
sizeVariant: this.size,
6262
theme: this.theme,
6363
})}`;
6464

packages/ui-library/src/components/text-button/index.stories.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ const generateDisabledArgTypes = (argTypes: string[]) => {
235235
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
236236
argTypes.forEach((argType: string) => {
237237
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
238-
// @ts-expect-error
239238
disabledArgTypes[argType] = {
240239
table: {
241240
disable: true,

0 commit comments

Comments
 (0)