Skip to content

Commit

Permalink
fix(ui-library): harmonised property names (#981)
Browse files Browse the repository at this point in the history
* fix(ui-library): harmonized property names

* fix(storybook): changed values after review

* fix(ui-library): harmonized naming in form-caption and dependencie files

---------

Co-authored-by: David Kennedy <[email protected]>
Co-authored-by: Thorben Hartmann <[email protected]>
  • Loading branch information
3 people authored and ChristianHoffmannS2 committed Mar 26, 2024
1 parent 0de56b9 commit 2579111
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 45 deletions.
6 changes: 3 additions & 3 deletions packages/ui-library/src/components/checkbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class BlrCheckbox extends LitElement {
${BlrFormCaptionRenderFunction({
variant: 'hint',
theme: this.theme,
size: this.size,
sizeVariant: this.size,
message: this.hintMessage,
icon: this.hintIcon,
})}
Expand All @@ -211,7 +211,7 @@ export class BlrCheckbox extends LitElement {
${BlrFormCaptionRenderFunction({
variant: 'error',
theme: this.theme,
size: this.size,
sizeVariant: this.size,
message: this.errorMessage,
icon: this.errorIcon,
})}
Expand Down Expand Up @@ -303,7 +303,7 @@ export class BlrCheckbox extends LitElement {
})}`
: nothing}
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ size: this.size }, captionContent)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.size }, captionContent)
: nothing}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../../index';
export default {
title: 'Components/Form Caption Group',
argTypes: {
size: {
sizeVariant: {
options: FormSizes,
control: { type: 'radio' },
description:
Expand All @@ -31,7 +31,7 @@ export default {
component: `<Markdown>
The Form Caption Group is a combination of two Form Caption components, which allow to show both a hint and an error message or only one of each.
Technically both instances of the Form Caption are placed inside slots that are stacked above each other. The Form Caption Group only has one property named size to change the spacing in between the slots depending on the size of the component. For more information have a look at the internal [Form Caption](/docs/design-system-web-components-internal-components-form-caption--docs) component
Technically both instances of the Form Caption are placed inside slots that are stacked above each other. The Form Caption Group only has one property named size to change the spacing in between the slots depending on the size of the component. For more information have a look at the internal [Form Caption](?path=/docs/components-form-caption--docs) component
The Form Caption Group is intended to be used when creating new components. Currently, it is used like this in the following components:
Expand All @@ -52,14 +52,14 @@ It is not intended to use the Form Caption Group directly when creating new appl
};

const hintCaption = BlrFormCaptionRenderFunction({
message: 'hint',
message: 'Hint-Message-Text',
variant: 'hint',
icon: 'blrInfo',
theme: 'Light',
});

const errorCaption = BlrFormCaptionRenderFunction({
message: 'error',
message: 'Error-Message-Text',
variant: 'error',
icon: 'blrErrorFilled',
theme: 'Light',
Expand All @@ -73,7 +73,7 @@ export const BlrFormCaptionGroup = (params: BlrFormCaptionGroupType) =>
BlrFormCaptionGroup.storyName = 'Form Caption Group';

const args: BlrFormCaptionGroupType = {
size: 'sm',
sizeVariant: 'sm',
};

BlrFormCaptionGroup.args = args;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { BlrFormCaptionRenderFunction } from '../form-caption/renderFunction';
import { html } from 'lit-html';

const sampleParams: BlrFormCaptionGroupType = {
size: 'md',
sizeVariant: 'md',
};

const hintCaption = BlrFormCaptionRenderFunction({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { TAG_NAME } from './renderFunction';
export class BlrFormCaptionGroup extends LitElement {
static styles = [formCaptionGroupStyle];

@property() size: FormSizesType = 'md';
@property() sizeVariant: FormSizesType = 'md';

protected render() {
const classes = classMap({
'blr-form-caption-group': true,
[this.size]: this.size,
[this.sizeVariant]: this.sizeVariant,
});

return html`
Expand Down
18 changes: 9 additions & 9 deletions packages/ui-library/src/components/form-caption/index.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const sharedStyles = html`
export default {
title: 'Components/Form Caption',
argTypes: {
size: {
sizeVariant: {
options: FormSizes,
control: { type: 'radio' },
description: ' Choose size of the component.',
Expand Down Expand Up @@ -101,7 +101,7 @@ const args: BlrFormCaptionType = {
message: 'Message-text',
icon: 'blr360',
variant: 'hint',
size: 'sm',
sizeVariant: 'sm',
};

BlrFormCaption.args = args;
Expand All @@ -119,7 +119,7 @@ export const Variant = () => {
${BlrFormCaptionRenderFunction({
variant: 'hint',
theme: 'Light',
size: 'sm',
sizeVariant: 'sm',
message: 'Hint',
icon: 'blr360',
})}
Expand All @@ -128,7 +128,7 @@ export const Variant = () => {
${BlrFormCaptionRenderFunction({
variant: 'error',
theme: 'Light',
size: 'sm',
sizeVariant: 'sm',
message: 'Error',
icon: 'blrErrorFilled',
})}
Expand All @@ -149,7 +149,7 @@ export const SizeVariant = () => {
${BlrFormCaptionRenderFunction({
variant: 'hint',
theme: 'Light',
size: 'sm',
sizeVariant: 'sm',
message: 'Form Caption SM',
icon: 'blr360',
})}
Expand All @@ -158,7 +158,7 @@ export const SizeVariant = () => {
${BlrFormCaptionRenderFunction({
variant: 'hint',
theme: 'Light',
size: 'md',
sizeVariant: 'md',
message: 'Form Caption MD',
icon: 'blr360',
})}
Expand All @@ -168,7 +168,7 @@ export const SizeVariant = () => {
${BlrFormCaptionRenderFunction({
variant: 'hint',
theme: 'Light',
size: 'lg',
sizeVariant: 'lg',
message: 'Form Caption LG',
icon: 'blr360',
})}
Expand All @@ -191,7 +191,7 @@ export const Icon = () => {
${BlrFormCaptionRenderFunction({
variant: 'hint',
theme: 'Light',
size: 'sm',
sizeVariant: 'sm',
message: 'With icon',
icon: 'blr360',
})}
Expand All @@ -200,7 +200,7 @@ export const Icon = () => {
${BlrFormCaptionRenderFunction({
variant: 'hint',
theme: 'Light',
size: 'sm',
sizeVariant: 'sm',
message: 'Without icon',
})}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const sampleParams: BlrFormCaptionType = {
message: 'hallo',
icon: 'blr360',
variant: 'hint',
size: 'sm',
sizeVariant: 'sm',
};

describe('blr-form-caption', () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/ui-library/src/components/form-caption/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ export class BlrFormCaption extends LitElement {
@property() message?: string;
@property() icon?: SizelessIconType;
@property() variant: CaptionVariantType = 'hint';
@property() size?: FormSizesType = 'md';
@property() sizeVariant?: FormSizesType = 'md';
@property() childElement?: TemplateResult<1>;
@property() theme: ThemeType = 'Light';

protected render() {
if (this.size) {
if (this.sizeVariant) {
const dynamicStyles = this.theme === 'Light' ? [captionLight] : [captionDark];

const classes = classMap({
'blr-form-caption': true,
[`${this.variant}`]: this.variant,
[`${this.size}`]: this.size,
[`${this.sizeVariant}`]: this.sizeVariant,
});

const iconClasses = classMap({
'blr-icon': true,
[this.size]: this.size,
[this.sizeVariant]: this.sizeVariant,
});

const iconSizeVariant = getComponentConfigToken([
'cmp',
'CaptionComponent',
'Icon',
'SizeVariant',
this.size.toUpperCase(),
this.sizeVariant.toUpperCase(),
]).toLowerCase() as SizesType;

return html`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export class BlrInputFieldNumber extends LitElement {
${BlrFormCaptionRenderFunction({
variant: 'hint',
theme: this.theme,
size: this.sizeVariant,
sizeVariant: this.sizeVariant,
message: this.hintMessage,
icon: this.hintIcon,
})}
Expand All @@ -288,7 +288,7 @@ export class BlrInputFieldNumber extends LitElement {
${BlrFormCaptionRenderFunction({
variant: 'error',
theme: this.theme,
size: this.sizeVariant,
sizeVariant: this.sizeVariant,
message: this.errorMessage,
icon: this.errorIcon,
})}
Expand Down Expand Up @@ -342,7 +342,7 @@ export class BlrInputFieldNumber extends LitElement {
</div>
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ size: this.sizeVariant }, captionContent)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, captionContent)
: nothing}
`;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-library/src/components/input-field-text/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class BlrInputFieldText extends LitElement {
? BlrFormCaptionRenderFunction({
variant: 'hint',
theme: this.theme,
size: this.size,
sizeVariant: this.size,
message: this.hintMessage,
icon: this.hintIcon,
})
Expand All @@ -153,7 +153,7 @@ export class BlrInputFieldText extends LitElement {
? BlrFormCaptionRenderFunction({
variant: 'error',
theme: this.theme,
size: this.size,
sizeVariant: this.size,
message: this.errorMessage,
icon: this.errorIcon,
})
Expand Down Expand Up @@ -238,7 +238,7 @@ export class BlrInputFieldText extends LitElement {
: nothing}
</div>
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ size: this.size }, captionContent)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.size }, captionContent)
: nothing}
</div>
`;
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-library/src/components/radio-group/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class BlrRadioGroup extends LitElement {
? BlrFormCaptionRenderFunction({
variant: 'hint',
theme: this.theme,
size: this.size,
sizeVariant: this.size,
message: this.groupHintMessage,
icon: this.groupHintIcon,
})
Expand All @@ -80,7 +80,7 @@ export class BlrRadioGroup extends LitElement {
? BlrFormCaptionRenderFunction({
variant: 'error',
theme: this.theme,
size: this.size,
sizeVariant: this.size,
message: this.groupErrorMessage,
icon: this.groupErrorIcon,
})
Expand Down Expand Up @@ -132,7 +132,7 @@ export class BlrRadioGroup extends LitElement {
${this.hasHint || this.hasError
? html` <div class="caption-group ${classes}">
${BlrFormCaptionGroupRenderFunction({ size: this.size }, captionContent)}
${BlrFormCaptionGroupRenderFunction({ sizeVariant: this.size }, captionContent)}
</div>`
: nothing} `;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-library/src/components/radio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class BlrRadio extends LitElement {
${BlrFormCaptionRenderFunction({
variant: 'hint',
theme: this.theme,
size: this.size,
sizeVariant: this.size,
message: this.hintMessage,
icon: this.hintIcon,
})}
Expand All @@ -67,7 +67,7 @@ export class BlrRadio extends LitElement {
${BlrFormCaptionRenderFunction({
variant: 'error',
theme: this.theme,
size: this.size,
sizeVariant: this.size,
message: this.errorMessage,
icon: this.errorIcon,
})}
Expand Down Expand Up @@ -102,7 +102,7 @@ export class BlrRadio extends LitElement {
labelSize: this.size,
})}
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ size: this.size }, captionContent)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.size }, captionContent)
: nothing}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-library/src/components/select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class BlrSelect extends LitElement {
? BlrFormCaptionRenderFunction({
variant: 'hint',
theme: this.theme,
size: this.sizeVariant,
sizeVariant: this.sizeVariant,
message: this.hintMessage,
icon: this.hintMessageIcon,
})
Expand All @@ -159,7 +159,7 @@ export class BlrSelect extends LitElement {
? BlrFormCaptionRenderFunction({
variant: 'error',
theme: this.theme,
size: this.sizeVariant,
sizeVariant: this.sizeVariant,
message: this.errorMessage,
icon: this.errorMessageIcon,
})
Expand Down Expand Up @@ -218,7 +218,7 @@ export class BlrSelect extends LitElement {
${this.renderIcon(iconClasses)}
</div>
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ size: this.sizeVariant }, captionContent)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, captionContent)
: nothing}
</div>
`;
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-library/src/components/textarea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class BlrTextarea extends LitElement {
? BlrFormCaptionRenderFunction({
variant: 'hint',
theme: this.theme,
size: this.sizeVariant,
sizeVariant: this.sizeVariant,
message: this.hintMessage,
icon: this.hintMessageIcon,
})
Expand All @@ -186,7 +186,7 @@ export class BlrTextarea extends LitElement {
? BlrFormCaptionRenderFunction({
variant: 'error',
theme: this.theme,
size: this.sizeVariant,
sizeVariant: this.sizeVariant,
message: this.errorMessage,
icon: this.errorMessageIcon,
})
Expand Down Expand Up @@ -232,7 +232,7 @@ export class BlrTextarea extends LitElement {
></textarea>
<div class="${textareaInfoContainer}">
${this.hasHint || this.hasError
? BlrFormCaptionGroupRenderFunction({ size: this.sizeVariant }, captionContent)
? BlrFormCaptionGroupRenderFunction({ sizeVariant: this.sizeVariant }, captionContent)
: nothing}
${this.hasCounter
? BlrCounterRenderFunction({
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-library/src/components/toggle-switch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class BlrToggleSwitch extends LitElement {
message: this.hintMessage,
variant: 'hint',
icon: this.hintIcon,
size: this.size || 'sm',
sizeVariant: this.size || 'sm',
theme: this.theme,
})
: nothing}
Expand Down

0 comments on commit 2579111

Please sign in to comment.