From 3daaf2c83d7dff92315ccdec3fc9cfde6f444b9d Mon Sep 17 00:00:00 2001 From: Maximilian Franzke Date: Fri, 3 Nov 2023 22:24:10 +0100 Subject: [PATCH 01/14] feat: added possibility to visually hide the label #1932 --- .../src/components/db-checkbox/db-checkbox.tsx | 13 +++++++++++-- .../src/components/db-checkbox/readme.md | 2 +- .../stories/db-checkbox.intro.stories.mdx | 12 ++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/packages/db-ui-elements-stencil/src/components/db-checkbox/db-checkbox.tsx b/packages/db-ui-elements-stencil/src/components/db-checkbox/db-checkbox.tsx index ea7d970b2b..0980f8990c 100644 --- a/packages/db-ui-elements-stencil/src/components/db-checkbox/db-checkbox.tsx +++ b/packages/db-ui-elements-stencil/src/components/db-checkbox/db-checkbox.tsx @@ -52,10 +52,15 @@ export class DbCheckbox { @Prop({ reflect: true }) value: string; /** - * The indeterminate attribute is a boolean attribute. When specified, the element is is displayed in an indeterminate state (neither checked, nor unchecked). + * The indeterminate attribute is a boolean attribute. When specified, the element is displayed in an indeterminate state (neither checked, nor unchecked). */ @Prop({ reflect: false }) indeterminate: boolean; + /** + * The label-hidden attribute is a boolean attribute. When specified, the elements label visually hidden (it's important to still keep it displayed for accessibility reasons). + */ + @Prop({ reflect: false }) labelHidden: boolean; + /** * Method that acceps a boolean and sets the indeterminate state of the checkbox accordingly. */ @@ -91,7 +96,11 @@ export class DbCheckbox { onChange={(event) => this.handleChange(event)} /> - diff --git a/packages/db-ui-elements-stencil/src/components/db-input/readme.md b/packages/db-ui-elements-stencil/src/components/db-input/readme.md index 6c697d8c42..e194933d3d 100644 --- a/packages/db-ui-elements-stencil/src/components/db-input/readme.md +++ b/packages/db-ui-elements-stencil/src/components/db-input/readme.md @@ -18,6 +18,7 @@ | `disabled` | `disabled` | The disabled attribute can be set to keep a user from clicking on the input. | `boolean` | `false` | | `input_id` | `input_id` | The input_id of a labelable form-related element in the same document as the label element. The first element in the document with an id matching the value of the for attribute is the labeled control for this label element, if it is a labelable element. | `string` | `'input-' + uuid()` | | `label` _(required)_ | `label` | The label attribute specifies the caption of the input. | `string` | `undefined` | +| `labelHidden` | `label-hidden` | The label-hidden attribute is a boolean attribute. When specified, the elements label gets visually hidden (it's important to still keep it displayed for accessibility reasons). | `boolean` | `undefined` | | `list` | `list` | The list attribute is used to identify an element that lists predefined options suggested to the user. | `string` | `undefined` | | `max` | `max` | The max attribute specifies the maximum value that is sufficient for this input. | `number` | `undefined` | | `maxlength` | `maxlength` | /* The maxlength attribute, controlled by a dirty value flag, declares a limit on the number of characters a user can input. | `number` | `undefined` | diff --git a/packages/db-ui-elements-stencil/src/components/db-radio/db-radio.tsx b/packages/db-ui-elements-stencil/src/components/db-radio/db-radio.tsx index 09ff5c0921..d520a03184 100644 --- a/packages/db-ui-elements-stencil/src/components/db-radio/db-radio.tsx +++ b/packages/db-ui-elements-stencil/src/components/db-radio/db-radio.tsx @@ -47,6 +47,11 @@ export class DbRadio { */ @Prop({ reflect: true }) value: string; + /** + * The label-hidden attribute is a boolean attribute. When specified, the elements label gets visually hidden (it's important to still keep it displayed for accessibility reasons). + */ + @Prop({ reflect: false }) labelHidden: boolean; + private handleChange(event) { this.dbChange.emit(event); } @@ -72,7 +77,11 @@ export class DbRadio { onChange={(event) => this.handleChange(event)} /> -