diff --git a/.vscode/settings.json b/.vscode/settings.json index c41fe646b4..074b0b5ceb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "editor.formatOnSave": false, + "editor.formatOnSave": true, "editor.renderWhitespace": "all", // Configure glob patterns for excluding files and folders. // For example, the files explorer decides which files and folders to show diff --git a/packages/components/src/components.d.ts b/packages/components/src/components.d.ts index bec1fa5f7f..a283a61eb4 100644 --- a/packages/components/src/components.d.ts +++ b/packages/components/src/components.d.ts @@ -609,6 +609,10 @@ export namespace Components { interface KolIndentedText { } interface KolInput { + /** + * Defines the elements access key. + */ + "_accessKey"?: AccessKeyPropType; /** * Defines whether the screen-readers should read out the notification. * @TODO : Change type back to `AlertPropType` after Stencil#4663 has been resolved. @@ -1728,6 +1732,10 @@ export namespace Components { "_labeled"?: boolean; } interface KolLink { + /** + * Defines the elements access key. + */ + "_accessKey"?: AccessKeyPropType; /** * Tells the browser that the link contains a file. Optionally sets the filename. */ @@ -1779,6 +1787,10 @@ export namespace Components { "_tooltipAlign"?: TooltipAlignPropType; } interface KolLinkButton { + /** + * Defines the elements access key. + */ + "_accessKey"?: AccessKeyPropType; /** * Defines the custom class attribute if _variant="custom" is set. */ @@ -1856,6 +1868,10 @@ export namespace Components { "_orientation"?: Orientation; } interface KolLinkWc { + /** + * Defines the elements access key. + */ + "_accessKey"?: AccessKeyPropType; /** * Tells the browser that the link contains a file. Optionally sets the filename. */ @@ -3386,6 +3402,10 @@ declare namespace LocalJSX { interface KolIndentedText { } interface KolInput { + /** + * Defines the elements access key. + */ + "_accessKey"?: AccessKeyPropType; /** * Defines whether the screen-readers should read out the notification. * @TODO : Change type back to `AlertPropType` after Stencil#4663 has been resolved. @@ -4505,6 +4525,10 @@ declare namespace LocalJSX { "_labeled"?: boolean; } interface KolLink { + /** + * Defines the elements access key. + */ + "_accessKey"?: AccessKeyPropType; /** * Tells the browser that the link contains a file. Optionally sets the filename. */ @@ -4556,6 +4580,10 @@ declare namespace LocalJSX { "_tooltipAlign"?: TooltipAlignPropType; } interface KolLinkButton { + /** + * Defines the elements access key. + */ + "_accessKey"?: AccessKeyPropType; /** * Defines the custom class attribute if _variant="custom" is set. */ @@ -4633,6 +4661,10 @@ declare namespace LocalJSX { "_orientation"?: Orientation; } interface KolLinkWc { + /** + * Defines the elements access key. + */ + "_accessKey"?: AccessKeyPropType; /** * Tells the browser that the link contains a file. Optionally sets the filename. */ diff --git a/packages/components/src/components/badge/readme.md b/packages/components/src/components/badge/readme.md index 9ee61fd2df..bb1cf2e62e 100644 --- a/packages/components/src/components/badge/readme.md +++ b/packages/components/src/components/badge/readme.md @@ -82,12 +82,12 @@ Die zusätzliche Ausgabe eines **Icon** gewährleistet, dass der Nutzer auch hie ## Properties -| Property | Attribute | Description | Type | Default | -| --------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | -| `_color` | `_color` | Defines the backgroundColor and foregroundColor. | `string \| undefined \| { backgroundColor: string; foregroundColor: Stringified; }` | `'#000'` | -| `_icons` | `_icons` | Defines the icon classnames (e.g. `_icons="fa-solid fa-user"`). | `KoliBriHorizontalIcons & KoliBriVerticalIcons \| string \| undefined` | `undefined` | -| `_label` _(required)_ | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). | `string` | `undefined` | -| `_smartButton` | `_smart-button` | Allows to add a button with an arbitrary action within the element (\_hide-label only). | `string \| undefined \| { _label: string; } & { _tabIndex?: number \| undefined; _value?: Stringified; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; }` | `undefined` | +| Property | Attribute | Description | Type | Default | +| --------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `_color` | `_color` | Defines the backgroundColor and foregroundColor. | `string \| undefined \| { backgroundColor: string; foregroundColor: Stringified; }` | `'#000'` | +| `_icons` | `_icons` | Defines the icon classnames (e.g. `_icons="fa-solid fa-user"`). | `KoliBriHorizontalIcons & KoliBriVerticalIcons \| string \| undefined` | `undefined` | +| `_label` _(required)_ | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). | `string` | `undefined` | +| `_smartButton` | `_smart-button` | Allows to add a button with an arbitrary action within the element (\_hide-label only). | `string \| undefined \| { _label: string; } & { _tabIndex?: number \| undefined; _value?: Stringified; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; _accessKey?: string \| undefined; }` | `undefined` | ## Dependencies diff --git a/packages/components/src/components/button-link/readme.md b/packages/components/src/components/button-link/readme.md index 89e221965b..a056a5ff8a 100644 --- a/packages/components/src/components/button-link/readme.md +++ b/packages/components/src/components/button-link/readme.md @@ -30,6 +30,7 @@ Da der Link, nicht wie der Button, in mehrere Varianten (`primary` oder `seconda | Property | Attribute | Description | Type | Default | | --------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | +| `_accessKey` | `_access-key` | Defines the elements access key. | `string \| undefined` | `undefined` | | `_ariaControls` | `_aria-controls` | Defines which elements are controlled by this component. (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls) | `string \| undefined` | `undefined` | | `_ariaExpanded` | `_aria-expanded` | Defines whether the interactive element of the component expanded something. (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) | `boolean \| undefined` | `undefined` | | `_ariaSelected` | `_aria-selected` | Defines whether the interactive element of the component is selected (e.g. role=tab). (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) | `boolean \| undefined` | `undefined` | diff --git a/packages/components/src/components/button/component.tsx b/packages/components/src/components/button/component.tsx index 2121482695..6a42f1645b 100644 --- a/packages/components/src/components/button/component.tsx +++ b/packages/components/src/components/button/component.tsx @@ -100,10 +100,10 @@ export class KolButtonWc implements API { > diff --git a/packages/components/src/components/button/readme.md b/packages/components/src/components/button/readme.md index a858d07501..dc8db714a3 100644 --- a/packages/components/src/components/button/readme.md +++ b/packages/components/src/components/button/readme.md @@ -99,6 +99,7 @@ Probleme mit Disabled-Status | Property | Attribute | Description | Type | Default | | --------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | +| `_accessKey` | `_access-key` | Defines the elements access key. | `string \| undefined` | `undefined` | | `_ariaControls` | `_aria-controls` | Defines which elements are controlled by this component. (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls) | `string \| undefined` | `undefined` | | `_ariaExpanded` | `_aria-expanded` | Defines whether the interactive element of the component expanded something. (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) | `boolean \| undefined` | `undefined` | | `_ariaSelected` | `_aria-selected` | Defines whether the interactive element of the component is selected (e.g. role=tab). (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) | `boolean \| undefined` | `undefined` | diff --git a/packages/components/src/components/input-checkbox/component.tsx b/packages/components/src/components/input-checkbox/component.tsx index c982a77cbc..d43ee397e6 100644 --- a/packages/components/src/components/input-checkbox/component.tsx +++ b/packages/components/src/components/input-checkbox/component.tsx @@ -17,6 +17,7 @@ import { propagateFocus, showExpertSlot } from '../../utils/reuse'; import { getRenderStates } from '../input/controller'; import { InputCheckboxController } from './controller'; import { API, InputCheckboxIconsProp, InputCheckboxVariant, States } from './types'; +import { InternalUnderlinedAccessKey } from '../span/InternalUnderlinedAccessKey'; /** * @slot expert - Die Beschriftung der Checkbox. @@ -53,6 +54,7 @@ export class KolInputCheckbox implements API { data-role={this.state._variant === 'button' ? 'button' : undefined} onKeyPress={this.state._variant === 'button' ? this.onChange : undefined} tabIndex={this.state._variant === 'button' ? 0 : undefined} + _accessKey={this.state._accessKey} _alert={this.state._alert} _disabled={this.state._disabled} _error={this.state._error} @@ -65,7 +67,20 @@ export class KolInputCheckbox implements API { _tooltipAlign={this._tooltipAlign} _touched={this.state._touched} > - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this.state._accessKey === 'string' ? ( + + + + + ) : ( + {this.state._label} + )} +
this.ref?.focus()} > - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this.state._accessKey === 'string' ? ( + + + + + ) : ( + {this.state._label} + )} +
; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; }` | `undefined` | -| `_suggestions` | `_suggestions` | Suggestions to provide for the input. | `W3CInputValue[] \| string \| undefined` | `undefined` | -| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | -| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | -| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | -| `_value` | `_value` | Defines the value of the input. | `string \| undefined` | `undefined` | +| Property | Attribute | Description | Type | Default | +| --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `_accessKey` | `_access-key` | Defines which key combination can be used to trigger or focus the interactive element of the component. | `string \| undefined` | `undefined` | +| `_alert` | `_alert` | Defines whether the screen-readers should read out the notification. | `boolean \| undefined` | `true` | +| `_autoComplete` | `_auto-complete` | Defines whether the input can be auto-completed. | `"off" \| "on" \| undefined` | `undefined` | +| `_disabled` | `_disabled` | Makes the element not focusable and ignore all events. | `boolean \| undefined` | `false` | +| `_error` | `_error` | Defines the error message text. | `string \| undefined` | `undefined` | +| `_hideError` | `_hide-error` | Hides the error message but leaves it in the DOM for the input's aria-describedby. | `boolean \| undefined` | `false` | +| `_hideLabel` | `_hide-label` | Hides the caption by default and displays the caption text with a tooltip when the interactive element is focused or the mouse is over it. | `boolean \| undefined` | `false` | +| `_hint` | `_hint` | Defines the hint text. | `string \| undefined` | `''` | +| `_icons` | `_icons` | Defines the icon classnames (e.g. `_icons="fa-solid fa-user"`). | `string \| undefined \| { right?: IconOrIconClass \| undefined; left?: IconOrIconClass \| undefined; }` | `undefined` | +| `_id` | `_id` | Defines the internal ID of the primary component element. | `string \| undefined` | `undefined` | +| `_label` _(required)_ | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). Set to `false` to enable the expert slot. | `string` | `undefined` | +| `_name` | `_name` | Defines the technical name of an input field. | `string \| undefined` | `undefined` | +| `_on` | -- | Gibt die EventCallback-Funktionen für das Input-Event an. | `InputTypeOnBlur & InputTypeOnClick & InputTypeOnChange & InputTypeOnFocus \| undefined` | `undefined` | +| `_smartButton` | `_smart-button` | Allows to add a button with an arbitrary action within the element (\_hide-label only). | `string \| undefined \| { _label: string; } & { _tabIndex?: number \| undefined; _value?: Stringified; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; _accessKey?: string \| undefined; }` | `undefined` | +| `_suggestions` | `_suggestions` | Suggestions to provide for the input. | `W3CInputValue[] \| string \| undefined` | `undefined` | +| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | +| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | +| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | +| `_value` | `_value` | Defines the value of the input. | `string \| undefined` | `undefined` | ## Slots diff --git a/packages/components/src/components/input-date/component.tsx b/packages/components/src/components/input-date/component.tsx index 17a56afa5b..dcc722c1a6 100644 --- a/packages/components/src/components/input-date/component.tsx +++ b/packages/components/src/components/input-date/component.tsx @@ -20,6 +20,7 @@ import { propagateSubmitEventToForm } from '../form/controller'; import { getRenderStates } from '../input/controller'; import { InputDateController } from './controller'; import { ComponentApi, States } from './types'; +import { InternalUnderlinedAccessKey } from '../span/InternalUnderlinedAccessKey'; /** * @slot - Die Beschriftung des Eingabefeldes. @@ -63,6 +64,7 @@ export class KolInputDate implements ComponentApi { [this.state._type]: true, 'hide-label': !!this.state._hideLabel, }} + _accessKey={this.state._accessKey} _disabled={this.state._disabled} _error={this.state._error} _hideError={this.state._hideError} @@ -78,7 +80,20 @@ export class KolInputDate implements ComponentApi { _tooltipAlign={this._tooltipAlign} _touched={this.state._touched} > - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this.state._accessKey === 'string' ? ( + + + + + ) : ( + {this.state._label} + )} +
; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; }` | `undefined` | -| `_step` | `_step` | Defines the step size for value changes. | `number \| undefined` | `undefined` | -| `_suggestions` | `_suggestions` | Suggestions to provide for the input. | `W3CInputValue[] \| string \| undefined` | `undefined` | -| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | -| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | -| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | -| `_type` | `_type` | Defines either the type of the component or of the components interactive element. | `"date" \| "datetime-local" \| "month" \| "time" \| "week"` | `'date'` | -| `_value` | `_value` | Defines the value of the input. | `Date \| `${number}-${number}-${number}T${number}:${number}:${number}`\|`${number}-${number}-${number}T${number}:${number}` \| `${number}-${number}-${number}`\|`${number}-${number}`\|`${number}-W${number}`\|`${number}:${number}:${number}` \| `${number}:${number}` \| null \| undefined` | `undefined` | +| Property | Attribute | Description | Type | Default | +| --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `_accessKey` | `_access-key` | Defines which key combination can be used to trigger or focus the interactive element of the component. | `string \| undefined` | `undefined` | +| `_alert` | `_alert` | Defines whether the screen-readers should read out the notification. | `boolean \| undefined` | `true` | +| `_autoComplete` | `_auto-complete` | Defines whether the input can be auto-completed. | `"off" \| "on" \| undefined` | `undefined` | +| `_disabled` | `_disabled` | Makes the element not focusable and ignore all events. | `boolean \| undefined` | `false` | +| `_error` | `_error` | Defines the error message text. | `string \| undefined` | `undefined` | +| `_hideError` | `_hide-error` | Hides the error message but leaves it in the DOM for the input's aria-describedby. | `boolean \| undefined` | `false` | +| `_hideLabel` | `_hide-label` | Hides the caption by default and displays the caption text with a tooltip when the interactive element is focused or the mouse is over it. | `boolean \| undefined` | `false` | +| `_hint` | `_hint` | Defines the hint text. | `string \| undefined` | `''` | +| `_icons` | `_icons` | Defines the icon classnames (e.g. `_icons="fa-solid fa-user"`). | `string \| undefined \| { right?: IconOrIconClass \| undefined; left?: IconOrIconClass \| undefined; }` | `undefined` | +| `_id` | `_id` | Defines the internal ID of the primary component element. | `string \| undefined` | `undefined` | +| `_label` _(required)_ | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). Set to `false` to enable the expert slot. | `string` | `undefined` | +| `_max` | `_max` | Defines the largest possible input value. | `Date \| `${number}-${number}-${number}T${number}:${number}:${number}`\|`${number}-${number}-${number}T${number}:${number}` \| `${number}-${number}-${number}`\|`${number}-${number}`\|`${number}-W${number}`\|`${number}:${number}:${number}` \| `${number}:${number}` \| undefined` | `undefined` | +| `_min` | `_min` | Defines the smallest possible input value. | `Date \| `${number}-${number}-${number}T${number}:${number}:${number}`\|`${number}-${number}-${number}T${number}:${number}` \| `${number}-${number}-${number}`\|`${number}-${number}`\|`${number}-W${number}`\|`${number}:${number}:${number}` \| `${number}:${number}` \| undefined` | `undefined` | +| `_name` | `_name` | Defines the technical name of an input field. | `string \| undefined` | `undefined` | +| `_on` | -- | Gibt die EventCallback-Funktionen für das Input-Event an. | `InputTypeOnBlur & InputTypeOnClick & InputTypeOnChange & InputTypeOnFocus \| undefined` | `undefined` | +| `_readOnly` | `_read-only` | Makes the input element read only. | `boolean \| undefined` | `false` | +| `_required` | `_required` | Makes the input element required. | `boolean \| undefined` | `false` | +| `_smartButton` | `_smart-button` | Allows to add a button with an arbitrary action within the element (\_hide-label only). | `string \| undefined \| { _label: string; } & { _tabIndex?: number \| undefined; _value?: Stringified; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; _accessKey?: string \| undefined; }` | `undefined` | +| `_step` | `_step` | Defines the step size for value changes. | `number \| undefined` | `undefined` | +| `_suggestions` | `_suggestions` | Suggestions to provide for the input. | `W3CInputValue[] \| string \| undefined` | `undefined` | +| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | +| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | +| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | +| `_type` | `_type` | Defines either the type of the component or of the components interactive element. | `"date" \| "datetime-local" \| "month" \| "time" \| "week"` | `'date'` | +| `_value` | `_value` | Defines the value of the input. | `Date \| `${number}-${number}-${number}T${number}:${number}:${number}`\|`${number}-${number}-${number}T${number}:${number}` \| `${number}-${number}-${number}`\|`${number}-${number}`\|`${number}-W${number}`\|`${number}:${number}:${number}` \| `${number}:${number}` \| null \| undefined` | `undefined` | ## Slots diff --git a/packages/components/src/components/input-email/component.tsx b/packages/components/src/components/input-email/component.tsx index 628a60fadb..5c989fe5e6 100644 --- a/packages/components/src/components/input-email/component.tsx +++ b/packages/components/src/components/input-email/component.tsx @@ -19,6 +19,7 @@ import { propagateSubmitEventToForm } from '../form/controller'; import { getRenderStates } from '../input/controller'; import { InputEmailController } from './controller'; import { API, States } from './types'; +import { InternalUnderlinedAccessKey } from '../span/InternalUnderlinedAccessKey'; /** * @slot - Die Beschriftung des Eingabefeldes. @@ -64,6 +65,7 @@ export class KolInputEmail implements API { > this.ref?.focus()} > - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this.state._accessKey === 'string' ? ( + + + + + ) : ( + {this.state._label} + )} +
; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; }` | `undefined` | -| `_suggestions` | `_suggestions` | Suggestions to provide for the input. | `W3CInputValue[] \| string \| undefined` | `undefined` | -| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | -| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | -| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | -| `_value` | `_value` | Defines the value of the input. | `string \| undefined` | `undefined` | +| Property | Attribute | Description | Type | Default | +| --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `_accessKey` | `_access-key` | Defines which key combination can be used to trigger or focus the interactive element of the component. | `string \| undefined` | `undefined` | +| `_alert` | `_alert` | Defines whether the screen-readers should read out the notification. | `boolean \| undefined` | `true` | +| `_autoComplete` | `_auto-complete` | Defines whether the input can be auto-completed. | `"off" \| "on" \| undefined` | `undefined` | +| `_disabled` | `_disabled` | Makes the element not focusable and ignore all events. | `boolean \| undefined` | `false` | +| `_error` | `_error` | Defines the error message text. | `string \| undefined` | `undefined` | +| `_hasCounter` | `_has-counter` | Shows the character count on the lower border of the input. | `boolean \| undefined` | `false` | +| `_hideError` | `_hide-error` | Hides the error message but leaves it in the DOM for the input's aria-describedby. | `boolean \| undefined` | `false` | +| `_hideLabel` | `_hide-label` | Hides the caption by default and displays the caption text with a tooltip when the interactive element is focused or the mouse is over it. | `boolean \| undefined` | `false` | +| `_hint` | `_hint` | Defines the hint text. | `string \| undefined` | `''` | +| `_icons` | `_icons` | Defines the icon classnames (e.g. `_icons="fa-solid fa-user"`). | `string \| undefined \| { right?: IconOrIconClass \| undefined; left?: IconOrIconClass \| undefined; }` | `undefined` | +| `_id` | `_id` | Defines the internal ID of the primary component element. | `string \| undefined` | `undefined` | +| `_label` _(required)_ | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). Set to `false` to enable the expert slot. | `string` | `undefined` | +| `_maxLength` | `_max-length` | Defines the maximum number of input characters. | `number \| undefined` | `undefined` | +| `_multiple` | `_multiple` | Makes the input accept multiple inputs. | `boolean \| undefined` | `false` | +| `_name` | `_name` | Defines the technical name of an input field. | `string \| undefined` | `undefined` | +| `_on` | -- | Gibt die EventCallback-Funktionen für das Input-Event an. | `InputTypeOnBlur & InputTypeOnClick & InputTypeOnChange & InputTypeOnFocus \| undefined` | `undefined` | +| `_pattern` | `_pattern` | Defines a validation pattern for the input field. | `string \| undefined` | `undefined` | +| `_placeholder` | `_placeholder` | Defines the placeholder for input field. To be shown when there's no value. | `string \| undefined` | `undefined` | +| `_readOnly` | `_read-only` | Makes the input element read only. | `boolean \| undefined` | `false` | +| `_required` | `_required` | Makes the input element required. | `boolean \| undefined` | `false` | +| `_smartButton` | `_smart-button` | Allows to add a button with an arbitrary action within the element (\_hide-label only). | `string \| undefined \| { _label: string; } & { _tabIndex?: number \| undefined; _value?: Stringified; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; _accessKey?: string \| undefined; }` | `undefined` | +| `_suggestions` | `_suggestions` | Suggestions to provide for the input. | `W3CInputValue[] \| string \| undefined` | `undefined` | +| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | +| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | +| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | +| `_value` | `_value` | Defines the value of the input. | `string \| undefined` | `undefined` | ## Slots diff --git a/packages/components/src/components/input-file/component.tsx b/packages/components/src/components/input-file/component.tsx index d5c27ff385..86083934f6 100644 --- a/packages/components/src/components/input-file/component.tsx +++ b/packages/components/src/components/input-file/component.tsx @@ -16,6 +16,7 @@ import { Props as ButtonProps } from '../button/types'; import { getRenderStates } from '../input/controller'; import { InputFileController } from './controller'; import { API, States } from './types'; +import { InternalUnderlinedAccessKey } from '../span/InternalUnderlinedAccessKey'; /** * @slot - Die Beschriftung des Eingabefeldes. @@ -47,6 +48,7 @@ export class KolInputFile implements API { file: true, 'hide-label': !!this.state._hideLabel, }} + _accessKey={this.state._accessKey} _disabled={this.state._disabled} _error={this.state._error} _hideError={this.state._hideError} @@ -61,7 +63,20 @@ export class KolInputFile implements API { _touched={this.state._touched} onClick={() => this.ref?.focus()} > - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this.state._accessKey === 'string' ? ( + + + + + ) : ( + {this.state._label} + )} +
; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; }` | `undefined` | -| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | -| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | -| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | -| `_value` | `_value` | Defines the value of the input. | `string \| undefined` | `undefined` | +| Property | Attribute | Description | Type | Default | +| --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `_accept` | `_accept` | Defines which file formats are accepted. | `string \| undefined` | `undefined` | +| `_accessKey` | `_access-key` | Defines which key combination can be used to trigger or focus the interactive element of the component. | `string \| undefined` | `undefined` | +| `_alert` | `_alert` | Defines whether the screen-readers should read out the notification. | `boolean \| undefined` | `true` | +| `_disabled` | `_disabled` | Makes the element not focusable and ignore all events. | `boolean \| undefined` | `false` | +| `_error` | `_error` | Defines the error message text. | `string \| undefined` | `undefined` | +| `_hideError` | `_hide-error` | Hides the error message but leaves it in the DOM for the input's aria-describedby. | `boolean \| undefined` | `false` | +| `_hideLabel` | `_hide-label` | Hides the caption by default and displays the caption text with a tooltip when the interactive element is focused or the mouse is over it. | `boolean \| undefined` | `false` | +| `_hint` | `_hint` | Defines the hint text. | `string \| undefined` | `''` | +| `_icons` | `_icons` | Defines the icon classnames (e.g. `_icons="fa-solid fa-user"`). | `string \| undefined \| { right?: IconOrIconClass \| undefined; left?: IconOrIconClass \| undefined; }` | `undefined` | +| `_id` | `_id` | Defines the internal ID of the primary component element. | `string \| undefined` | `undefined` | +| `_label` _(required)_ | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). Set to `false` to enable the expert slot. | `string` | `undefined` | +| `_multiple` | `_multiple` | Makes the input accept multiple inputs. | `boolean \| undefined` | `false` | +| `_name` | `_name` | Defines the technical name of an input field. | `string \| undefined` | `undefined` | +| `_on` | -- | Gibt die EventCallback-Funktionen für das Input-Event an. | `InputTypeOnBlur & InputTypeOnClick & InputTypeOnChange & InputTypeOnFocus \| undefined` | `undefined` | +| `_required` | `_required` | Makes the input element required. | `boolean \| undefined` | `false` | +| `_smartButton` | `_smart-button` | Allows to add a button with an arbitrary action within the element (\_hide-label only). | `string \| undefined \| { _label: string; } & { _tabIndex?: number \| undefined; _value?: Stringified; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; _accessKey?: string \| undefined; }` | `undefined` | +| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | +| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | +| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | +| `_value` | `_value` | Defines the value of the input. | `string \| undefined` | `undefined` | ## Slots diff --git a/packages/components/src/components/input-number/component.tsx b/packages/components/src/components/input-number/component.tsx index 3de63ea6d6..a3efc4ef7c 100644 --- a/packages/components/src/components/input-number/component.tsx +++ b/packages/components/src/components/input-number/component.tsx @@ -18,6 +18,7 @@ import { propagateSubmitEventToForm } from '../form/controller'; import { getRenderStates } from '../input/controller'; import { InputNumberController } from './controller'; import { API, States } from './types'; +import { InternalUnderlinedAccessKey } from '../span/InternalUnderlinedAccessKey'; /** * @slot - Die Beschriftung des Eingabefeldes. @@ -65,6 +66,7 @@ export class KolInputNumber implements API { number: true, 'hide-label': !!this.state._hideLabel, }} + _accessKey={this.state._accessKey} _disabled={this.state._disabled} _error={this.state._error} _hideError={this.state._hideError} @@ -80,7 +82,20 @@ export class KolInputNumber implements API { _tooltipAlign={this._tooltipAlign} _touched={this.state._touched} > - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this.state._accessKey === 'string' ? ( + + + + + ) : ( + {this.state._label} + )} +
; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; }` | `undefined` | -| `_step` | `_step` | Defines the step size for value changes. | `number \| undefined` | `undefined` | -| `_suggestions` | `_suggestions` | Suggestions to provide for the input. | `W3CInputValue[] \| string \| undefined` | `undefined` | -| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | -| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | -| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | -| `_value` | `_value` | Defines the value of the input. | ``${number}-${number}-${number}T${number}:${number}:${number}` \| `${number}-${number}-${number}T${number}:${number}` \| `${number}-${number}-${number}` \| `${number}-${number}` \| `${number}-W${number}` \| `${number}:${number}:${number}` \| `${number}:${number}` \| null \| number \| undefined` | `undefined` | +| Property | Attribute | Description | Type | Default | +| --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `_accessKey` | `_access-key` | Defines which key combination can be used to trigger or focus the interactive element of the component. | `string \| undefined` | `undefined` | +| `_alert` | `_alert` | Defines whether the screen-readers should read out the notification. | `boolean \| undefined` | `true` | +| `_autoComplete` | `_auto-complete` | Defines whether the input can be auto-completed. | `"off" \| "on" \| undefined` | `undefined` | +| `_disabled` | `_disabled` | Makes the element not focusable and ignore all events. | `boolean \| undefined` | `false` | +| `_error` | `_error` | Defines the error message text. | `string \| undefined` | `undefined` | +| `_hideError` | `_hide-error` | Hides the error message but leaves it in the DOM for the input's aria-describedby. | `boolean \| undefined` | `false` | +| `_hideLabel` | `_hide-label` | Hides the caption by default and displays the caption text with a tooltip when the interactive element is focused or the mouse is over it. | `boolean \| undefined` | `false` | +| `_hint` | `_hint` | Defines the hint text. | `string \| undefined` | `''` | +| `_icons` | `_icons` | Defines the icon classnames (e.g. `_icons="fa-solid fa-user"`). | `string \| undefined \| { right?: IconOrIconClass \| undefined; left?: IconOrIconClass \| undefined; }` | `undefined` | +| `_id` | `_id` | Defines the internal ID of the primary component element. | `string \| undefined` | `undefined` | +| `_label` _(required)_ | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). Set to `false` to enable the expert slot. | `string` | `undefined` | +| `_max` | `_max` | Defines the largest possible input value. | ``${number}-${number}-${number}T${number}:${number}:${number}` \| `${number}-${number}-${number}T${number}:${number}` \| `${number}-${number}-${number}` \| `${number}-${number}` \| `${number}-W${number}` \| `${number}:${number}:${number}` \| `${number}:${number}` \| number \| undefined` | `undefined` | +| `_min` | `_min` | Defines the smallest possible input value. | ``${number}-${number}-${number}T${number}:${number}:${number}` \| `${number}-${number}-${number}T${number}:${number}` \| `${number}-${number}-${number}` \| `${number}-${number}` \| `${number}-W${number}` \| `${number}:${number}:${number}` \| `${number}:${number}` \| number \| undefined` | `undefined` | +| `_name` | `_name` | Defines the technical name of an input field. | `string \| undefined` | `undefined` | +| `_on` | -- | Gibt die EventCallback-Funktionen für das Input-Event an. | `InputTypeOnBlur & InputTypeOnClick & InputTypeOnChange & InputTypeOnFocus \| undefined` | `undefined` | +| `_placeholder` | `_placeholder` | Defines the placeholder for input field. To be shown when there's no value. | `string \| undefined` | `undefined` | +| `_readOnly` | `_read-only` | Makes the input element read only. | `boolean \| undefined` | `false` | +| `_required` | `_required` | Makes the input element required. | `boolean \| undefined` | `false` | +| `_smartButton` | `_smart-button` | Allows to add a button with an arbitrary action within the element (\_hide-label only). | `string \| undefined \| { _label: string; } & { _tabIndex?: number \| undefined; _value?: Stringified; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; _accessKey?: string \| undefined; }` | `undefined` | +| `_step` | `_step` | Defines the step size for value changes. | `number \| undefined` | `undefined` | +| `_suggestions` | `_suggestions` | Suggestions to provide for the input. | `W3CInputValue[] \| string \| undefined` | `undefined` | +| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | +| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | +| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | +| `_value` | `_value` | Defines the value of the input. | ``${number}-${number}-${number}T${number}:${number}:${number}` \| `${number}-${number}-${number}T${number}:${number}` \| `${number}-${number}-${number}` \| `${number}-${number}` \| `${number}-W${number}` \| `${number}:${number}:${number}` \| `${number}:${number}` \| null \| number \| undefined` | `undefined` | ## Slots diff --git a/packages/components/src/components/input-password/component.tsx b/packages/components/src/components/input-password/component.tsx index d69c4a2949..7ebfb40887 100644 --- a/packages/components/src/components/input-password/component.tsx +++ b/packages/components/src/components/input-password/component.tsx @@ -18,6 +18,7 @@ import { propagateSubmitEventToForm } from '../form/controller'; import { getRenderStates } from '../input/controller'; import { InputPasswordController } from './controller'; import { API, States } from './types'; +import { InternalUnderlinedAccessKey } from '../span/InternalUnderlinedAccessKey'; /** * @slot - Die Beschriftung des Eingabefeldes. @@ -65,6 +66,7 @@ export class KolInputPassword implements API { 'hide-label': !!this.state._hideLabel, password: true, }} + _accessKey={this.state._accessKey} _currentLength={this.state._currentLength} _disabled={this.state._disabled} _error={this.state._error} @@ -83,7 +85,20 @@ export class KolInputPassword implements API { _touched={this.state._touched} onClick={() => this.ref?.focus()} > - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this.state._accessKey === 'string' ? ( + + + + + ) : ( + {this.state._label} + )} +
; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; }` | `undefined` | -| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | -| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | -| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | -| `_value` | `_value` | Defines the value of the input. | `string \| undefined` | `undefined` | +| Property | Attribute | Description | Type | Default | +| --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `_accessKey` | `_access-key` | Defines which key combination can be used to trigger or focus the interactive element of the component. | `string \| undefined` | `undefined` | +| `_alert` | `_alert` | Defines whether the screen-readers should read out the notification. | `boolean \| undefined` | `true` | +| `_autoComplete` | `_auto-complete` | Defines whether the input can be auto-completed. | `"off" \| "on" \| undefined` | `undefined` | +| `_disabled` | `_disabled` | Makes the element not focusable and ignore all events. | `boolean \| undefined` | `false` | +| `_error` | `_error` | Defines the error message text. | `string \| undefined` | `undefined` | +| `_hasCounter` | `_has-counter` | Shows the character count on the lower border of the input. | `boolean \| undefined` | `false` | +| `_hideError` | `_hide-error` | Hides the error message but leaves it in the DOM for the input's aria-describedby. | `boolean \| undefined` | `false` | +| `_hideLabel` | `_hide-label` | Hides the caption by default and displays the caption text with a tooltip when the interactive element is focused or the mouse is over it. | `boolean \| undefined` | `false` | +| `_hint` | `_hint` | Defines the hint text. | `string \| undefined` | `''` | +| `_icons` | `_icons` | Defines the icon classnames (e.g. `_icons="fa-solid fa-user"`). | `string \| undefined \| { right?: IconOrIconClass \| undefined; left?: IconOrIconClass \| undefined; }` | `undefined` | +| `_id` | `_id` | Defines the internal ID of the primary component element. | `string \| undefined` | `undefined` | +| `_label` _(required)_ | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). Set to `false` to enable the expert slot. | `string` | `undefined` | +| `_maxLength` | `_max-length` | Defines the maximum number of input characters. | `number \| undefined` | `undefined` | +| `_name` | `_name` | Defines the technical name of an input field. | `string \| undefined` | `undefined` | +| `_on` | -- | Gibt die EventCallback-Funktionen für das Input-Event an. | `InputTypeOnBlur & InputTypeOnClick & InputTypeOnChange & InputTypeOnFocus \| undefined` | `undefined` | +| `_pattern` | `_pattern` | Defines a validation pattern for the input field. | `string \| undefined` | `undefined` | +| `_placeholder` | `_placeholder` | Defines the placeholder for input field. To be shown when there's no value. | `string \| undefined` | `undefined` | +| `_readOnly` | `_read-only` | Makes the input element read only. | `boolean \| undefined` | `false` | +| `_required` | `_required` | Makes the input element required. | `boolean \| undefined` | `false` | +| `_smartButton` | `_smart-button` | Allows to add a button with an arbitrary action within the element (\_hide-label only). | `string \| undefined \| { _label: string; } & { _tabIndex?: number \| undefined; _value?: Stringified; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; _accessKey?: string \| undefined; }` | `undefined` | +| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | +| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | +| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | +| `_value` | `_value` | Defines the value of the input. | `string \| undefined` | `undefined` | ## Slots diff --git a/packages/components/src/components/input-radio/component.tsx b/packages/components/src/components/input-radio/component.tsx index 7323d35b60..f69365d26a 100644 --- a/packages/components/src/components/input-radio/component.tsx +++ b/packages/components/src/components/input-radio/component.tsx @@ -18,6 +18,7 @@ import { propagateFocus, showExpertSlot } from '../../utils/reuse'; import { getRenderStates } from '../input/controller'; import { InputRadioController } from './controller'; import { API, States } from './types'; +import { InternalUnderlinedAccessKey } from '../span/InternalUnderlinedAccessKey'; /** * @slot - Die Legende/Überschrift der Radiobuttons. @@ -57,7 +58,15 @@ export class KolInputRadio implements API { {/* INFO: span is needed for css styling :after content like a star (*) or optional text ! */} {/* INFO: label comes with any html tag or as plain text! */} - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this._accessKey === 'string' ? ( + + ) : ( + this._label + )} + {this.state._options.map((option, index) => { @@ -72,6 +81,7 @@ export class KolInputRadio implements API { - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this.state._accessKey === 'string' ? ( + + + + + ) : ( + {this.state._label} + )} +
this.ref?.focus()} > - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this.state._accessKey === 'string' ? ( + + + + + ) : ( + {this.state._label} + )} +
; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; }` | `undefined` | -| `_suggestions` | `_suggestions` | Suggestions to provide for the input. | `W3CInputValue[] \| string \| undefined` | `undefined` | -| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | -| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | -| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | -| `_type` | `_type` | Defines either the type of the component or of the components interactive element. | `"search" \| "tel" \| "text" \| "url" \| undefined` | `'text'` | -| `_value` | `_value` | Defines the value of the input. | `string \| undefined` | `undefined` | +| Property | Attribute | Description | Type | Default | +| --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `_accessKey` | `_access-key` | Defines which key combination can be used to trigger or focus the interactive element of the component. | `string \| undefined` | `undefined` | +| `_alert` | `_alert` | Defines whether the screen-readers should read out the notification. | `boolean \| undefined` | `true` | +| `_autoComplete` | `_auto-complete` | Defines whether the input can be auto-completed. | `"off" \| "on" \| undefined` | `undefined` | +| `_disabled` | `_disabled` | Makes the element not focusable and ignore all events. | `boolean \| undefined` | `false` | +| `_error` | `_error` | Defines the error message text. | `string \| undefined` | `undefined` | +| `_hasCounter` | `_has-counter` | Shows the character count on the lower border of the input. | `boolean \| undefined` | `false` | +| `_hideError` | `_hide-error` | Hides the error message but leaves it in the DOM for the input's aria-describedby. | `boolean \| undefined` | `false` | +| `_hideLabel` | `_hide-label` | Hides the caption by default and displays the caption text with a tooltip when the interactive element is focused or the mouse is over it. | `boolean \| undefined` | `false` | +| `_hint` | `_hint` | Defines the hint text. | `string \| undefined` | `''` | +| `_icons` | `_icons` | Defines the icon classnames (e.g. `_icons="fa-solid fa-user"`). | `string \| undefined \| { right?: IconOrIconClass \| undefined; left?: IconOrIconClass \| undefined; }` | `undefined` | +| `_id` | `_id` | Defines the internal ID of the primary component element. | `string \| undefined` | `undefined` | +| `_label` _(required)_ | `_label` | Defines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). Set to `false` to enable the expert slot. | `string` | `undefined` | +| `_maxLength` | `_max-length` | Defines the maximum number of input characters. | `number \| undefined` | `undefined` | +| `_name` | `_name` | Defines the technical name of an input field. | `string \| undefined` | `undefined` | +| `_on` | -- | Gibt die EventCallback-Funktionen für das Input-Event an. | `InputTypeOnBlur & InputTypeOnClick & InputTypeOnChange & InputTypeOnFocus \| undefined` | `undefined` | +| `_pattern` | `_pattern` | Defines a validation pattern for the input field. | `string \| undefined` | `undefined` | +| `_placeholder` | `_placeholder` | Defines the placeholder for input field. To be shown when there's no value. | `string \| undefined` | `undefined` | +| `_readOnly` | `_read-only` | Makes the input element read only. | `boolean \| undefined` | `false` | +| `_required` | `_required` | Makes the input element required. | `boolean \| undefined` | `false` | +| `_smartButton` | `_smart-button` | Allows to add a button with an arbitrary action within the element (\_hide-label only). | `string \| undefined \| { _label: string; } & { _tabIndex?: number \| undefined; _value?: Stringified; _role?: AlternativeButtonLinkRolePropType \| undefined; _ariaControls?: string \| undefined; _ariaExpanded?: boolean \| undefined; _ariaSelected?: boolean \| undefined; _on?: ButtonCallbacksPropType \| undefined; _type?: ButtonTypePropType \| undefined; _variant?: ButtonVariantPropType \| undefined; _customClass?: string \| undefined; _disabled?: boolean \| undefined; _hideLabel?: boolean \| undefined; _icons?: IconsPropType \| undefined; _id?: string \| undefined; _name?: string \| undefined; _syncValueBySelector?: string \| undefined; _tooltipAlign?: AlignPropType \| undefined; _accessKey?: string \| undefined; }` | `undefined` | +| `_suggestions` | `_suggestions` | Suggestions to provide for the input. | `W3CInputValue[] \| string \| undefined` | `undefined` | +| `_tabIndex` | `_tab-index` | Defines which tab-index the primary element of the component has. (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | `number \| undefined` | `undefined` | +| `_tooltipAlign` | `_tooltip-align` | Defines where to show the Tooltip preferably: top, right, bottom or left. | `"bottom" \| "left" \| "right" \| "top" \| undefined` | `'top'` | +| `_touched` | `_touched` | Shows if the input was touched by a user. | `boolean \| undefined` | `false` | +| `_type` | `_type` | Defines either the type of the component or of the components interactive element. | `"search" \| "tel" \| "text" \| "url" \| undefined` | `'text'` | +| `_value` | `_value` | Defines the value of the input. | `string \| undefined` | `undefined` | ## Slots diff --git a/packages/components/src/components/input/component.tsx b/packages/components/src/components/input/component.tsx index 565db4c8a5..f2a6f3107a 100644 --- a/packages/components/src/components/input/component.tsx +++ b/packages/components/src/components/input/component.tsx @@ -4,6 +4,7 @@ import { Component, Element, Fragment, h, Host, JSX, Prop } from '@stencil/core' import { translate } from '../../i18n'; import { Stringified } from '../../types/common'; import { AnyIconFontClass, KoliBriCustomIcon, KoliBriHorizontalIcons } from '../../types/icons'; +import { AccessKeyPropType } from '../../types/props/access-key'; import { IdPropType } from '../../types/props/id'; import { LabelWithExpertSlotPropType } from '../../types/props/label'; import { SuggestionsPropType } from '../../types/props/suggestions'; @@ -102,6 +103,7 @@ export class KolInput implements Props { */ aria-hidden="true" class="input-tooltip" + _accessKey={this._accessKey} _align={this._tooltipAlign} _id={this._hideLabel ? `${this._id}-label` : undefined} _label={this._label} @@ -144,6 +146,11 @@ export class KolInput implements Props { ); } + /** + * Defines the elements access key. + */ + @Prop() public _accessKey?: AccessKeyPropType; + /** * Defines whether the screen-readers should read out the notification. * @TODO: Change type back to `AlertPropType` after Stencil#4663 has been resolved. diff --git a/packages/components/src/components/input/types.ts b/packages/components/src/components/input/types.ts index 318e486df4..19f40900f7 100644 --- a/packages/components/src/components/input/types.ts +++ b/packages/components/src/components/input/types.ts @@ -2,6 +2,7 @@ import { Generic } from '@a11y-ui/core'; import { Stringified } from '../../types/common'; import { KoliBriHorizontalIcons } from '../../types/icons'; +import { PropAccessKey } from '../../types/props/access-key'; import { PropAlert } from '../../types/props/alert'; import { PropDisabled } from '../../types/props/disabled'; import { PropHasCounter } from '../../types/props/has-counter'; @@ -26,7 +27,8 @@ type OptionalProps = { maxLength: number; slotName: string; smartButton: Stringified; -} & PropAlert & +} & PropAccessKey & + PropAlert & PropDisabled & PropHasCounter & PropHideError & diff --git a/packages/components/src/components/link-button/component.tsx b/packages/components/src/components/link-button/component.tsx index ef6680f3bf..bc130c7c32 100644 --- a/packages/components/src/components/link-button/component.tsx +++ b/packages/components/src/components/link-button/component.tsx @@ -14,6 +14,7 @@ import { LinkTargetPropType } from '../../types/props/link-target'; import { TooltipAlignPropType } from '../../types/props/tooltip-align'; import { propagateFocus } from '../../utils/reuse'; import { Props } from './types'; +import { AccessKeyPropType } from '../../types/props/access-key'; @Component({ tag: 'kol-link-button', @@ -41,6 +42,7 @@ export class KolLinkButton implements Props { [this._variant as string]: this._variant !== 'custom', [this._customClass as string]: this._variant === 'custom' && typeof this._customClass === 'string' && this._customClass.length > 0, }} + _accessKey={this._accessKey} _download={this._download} _hideLabel={this._hideLabel} _href={this._href} @@ -60,6 +62,11 @@ export class KolLinkButton implements Props { ); } + /** + * Defines the elements access key. + */ + @Prop() public _accessKey?: AccessKeyPropType; + /** * Defines the custom class attribute if _variant="custom" is set. */ diff --git a/packages/components/src/components/link-button/readme.md b/packages/components/src/components/link-button/readme.md index c2265026a0..3e7e173d7d 100644 --- a/packages/components/src/components/link-button/readme.md +++ b/packages/components/src/components/link-button/readme.md @@ -31,6 +31,7 @@ Weitere Informationen zum Aussehen finden Sie auf der - + {isExternal && } @@ -113,6 +120,7 @@ export class KolLinkWc implements API { */ aria-hidden="true" hidden={hasExpertSlot || !this.state._hideLabel} + _accessKey={this.state._accessKey} _align={this.state._tooltipAlign} _label={this.state._label || this.state._href} > @@ -120,6 +128,11 @@ export class KolLinkWc implements API { ); } + /** + * Defines the elements access key. + */ + @Prop() public _accessKey?: AccessKeyPropType; + /** * Tells the browser that the link contains a file. Optionally sets the filename. */ @@ -187,6 +200,11 @@ export class KolLinkWc implements API { _icons: {}, // ⚠ required }; + @Watch('_accessKey') + public validateAccessKey(value?: AccessKeyPropType): void { + validateAccessKey(this, value); + } + private validateAriaCurrent(value?: AriaCurrentPropType): void { validateAriaCurrent(this, value); } @@ -252,6 +270,7 @@ export class KolLinkWc implements API { } public componentWillLoad(): void { + this.validateAccessKey(this._accessKey); this.validateDownload(this._download); this.validateHideLabel(this._hideLabel); this.validateHref(this._href); diff --git a/packages/components/src/components/link/readme.md b/packages/components/src/components/link/readme.md index 68268da4e1..e250ae48e9 100644 --- a/packages/components/src/components/link/readme.md +++ b/packages/components/src/components/link/readme.md @@ -68,6 +68,7 @@ Eingabe von Leerzeichen eingefügt werden. Zusätzliche Leerzeichen vergrößern | Property | Attribute | Description | Type | Default | | -------------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------- | +| `_accessKey` | `_access-key` | Defines the elements access key. | `string \| undefined` | `undefined` | | `_download` | `_download` | Tells the browser that the link contains a file. Optionally sets the filename. | `string \| undefined` | `undefined` | | `_hideLabel` | `_hide-label` | Hides the caption by default and displays the caption text with a tooltip when the interactive element is focused or the mouse is over it. | `boolean \| undefined` | `false` | | `_href` _(required)_ | `_href` | Sets the target URI of the link or citation source. | `string` | `undefined` | diff --git a/packages/components/src/components/link/shadow.tsx b/packages/components/src/components/link/shadow.tsx index 7501839bea..02e962906a 100644 --- a/packages/components/src/components/link/shadow.tsx +++ b/packages/components/src/components/link/shadow.tsx @@ -12,6 +12,7 @@ import { LinkTargetPropType } from '../../types/props/link-target'; import { TooltipAlignPropType } from '../../types/props/tooltip-align'; import { propagateFocus } from '../../utils/reuse'; import { LinkProps } from './types'; +import { AccessKeyPropType } from '../../types/props/access-key'; @Component({ tag: 'kol-link', @@ -34,6 +35,7 @@ export class KolLink implements LinkProps { this.ref?.focus()} > - {hasExpertSlot ? : this.state._label} + + {hasExpertSlot ? ( + + ) : typeof this.state._accessKey === 'string' ? ( + + + + + ) : ( + {this.state._label} + )} +