Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ShortKey Prop to Elements with AccessKey #6957

Merged
merged 63 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3671e99
renamed _accessKey to _badgeText for Span
AlexanderSchmidtCE Oct 23, 2024
7e388a3
renamed InternalUnderlinedAccessKey.tsx to InternalUnderlinedBadgeTex…
AlexanderSchmidtCE Oct 23, 2024
2107b7f
renamed _accessKey to _badgeKey for Tooltip
AlexanderSchmidtCE Oct 23, 2024
6ae5ac1
added ShortKeyPropType
AlexanderSchmidtCE Oct 23, 2024
6980432
added _shortKey to Button
AlexanderSchmidtCE Oct 23, 2024
79d89a8
added _shortKey to Link
AlexanderSchmidtCE Oct 23, 2024
f52cea6
added _shortKey to Input && InputText
AlexanderSchmidtCE Oct 23, 2024
07966c1
fixed error
AlexanderSchmidtCE Oct 23, 2024
6711773
added shortKey for Checkbox
AlexanderSchmidtCE Oct 24, 2024
818590c
added shortKey to InputColor
AlexanderSchmidtCE Oct 24, 2024
136e5d2
added shortKey to InputDate
AlexanderSchmidtCE Oct 24, 2024
c7afd0a
added shortKey to InputEmail
AlexanderSchmidtCE Oct 24, 2024
de54906
added shortKey to InputFile, -Number, -Password, -Radio, -Range
AlexanderSchmidtCE Oct 24, 2024
3b214d2
include renderNoLabel to hide label for inputs
AlexanderSchmidtCE Oct 24, 2024
2cc4a30
addes shortkey for select, single-select and textarea
AlexanderSchmidtCE Oct 24, 2024
ebd688a
Added scss
AlexanderSchmidtCE Oct 24, 2024
cd0084d
updated samples with access key and short key
AlexanderSchmidtCE Oct 25, 2024
8d867ae
skip tests
AlexanderSchmidtCE Oct 25, 2024
7c9696c
Addded Validation for using both access and shortkey
AlexanderSchmidtCE Oct 25, 2024
73a7778
Added Shortkey for LinkButton, Combobox & ButtonLink
AlexanderSchmidtCE Oct 26, 2024
ba0c218
Added Shortkey for LinkButton
AlexanderSchmidtCE Oct 26, 2024
75ebacd
skip combobox test
AlexanderSchmidtCE Oct 26, 2024
1e73121
dev merge
AlexanderSchmidtCE Oct 28, 2024
80ce964
formating
AlexanderSchmidtCE Oct 28, 2024
25b4658
lint fixes
AlexanderSchmidtCE Oct 28, 2024
04ce0c9
Update all snapshots$
AlexanderSchmidtCE Oct 28, 2024
6547a42
revert readme changes
AlexanderSchmidtCE Oct 29, 2024
0e144dd
dev merge and removed label from input components
AlexanderSchmidtCE Oct 29, 2024
4585c96
reverted style changes
AlexanderSchmidtCE Oct 29, 2024
7ec5b86
fixed shortkey accessKey and shortkey check in inputs
AlexanderSchmidtCE Oct 29, 2024
8bb05de
Merge branch 'develop' into 6251--feature-shortkey-ermglichen-bei-too…
AlexanderSchmidtCE Oct 29, 2024
c98d36e
lint
AlexanderSchmidtCE Oct 29, 2024
e99a29a
Update all snapshots$
AlexanderSchmidtCE Oct 29, 2024
7cafc83
devmerge
AlexanderSchmidtCE Oct 30, 2024
9d82937
review changes
AlexanderSchmidtCE Nov 3, 2024
6ac13a4
Merge branch 'develop' into 6251--feature-shortkey-ermglichen-bei-too…
AlexanderSchmidtCE Nov 3, 2024
d0ee6cc
reverted tests du execMode:default
AlexanderSchmidtCE Nov 7, 2024
1754ccd
lint fix
AlexanderSchmidtCE Nov 7, 2024
fce8dd2
refactor badgeText util function
AlexanderSchmidtCE Nov 7, 2024
3b33182
Merge branch 'develop' into 6251--feature-shortkey-ermglichen-bei-too…
AlexanderSchmidtCE Nov 7, 2024
bfd45bb
added pnpm lock
AlexanderSchmidtCE Nov 7, 2024
0b7fccd
pnpm lock revert
AlexanderSchmidtCE Nov 7, 2024
b18da21
expanded button-link sample
AlexanderSchmidtCE Nov 7, 2024
7366d0c
changed test in input
AlexanderSchmidtCE Nov 7, 2024
11e552f
pnpm-lock.yaml
AlexanderSchmidtCE Nov 7, 2024
be343a7
Update all snapshots$
AlexanderSchmidtCE Nov 7, 2024
eb54e58
packages revert
AlexanderSchmidtCE Nov 7, 2024
429f5e5
Merge remote-tracking branch 'origin/6251--feature-shortkey-ermgliche…
AlexanderSchmidtCE Nov 7, 2024
27ed176
added pnpm lock
AlexanderSchmidtCE Nov 7, 2024
a065f81
revert pnpm lock
AlexanderSchmidtCE Nov 7, 2024
594dc77
removed unused mixin
AlexanderSchmidtCE Nov 7, 2024
9831161
dev merge
AlexanderSchmidtCE Nov 12, 2024
d6e8291
review changes
AlexanderSchmidtCE Nov 12, 2024
fa66cf9
renaming
AlexanderSchmidtCE Nov 12, 2024
92c4f0f
Merge branch 'develop' into 6251--feature-shortkey-ermglichen-bei-too…
AlexanderSchmidtCE Nov 13, 2024
9da6c09
added missing shortkey optional prop
AlexanderSchmidtCE Nov 14, 2024
2c90a6c
Merge branch 'develop' into 6251--feature-shortkey-ermglichen-bei-too…
deleonio Nov 14, 2024
c56271a
fix: snapshot
deleonio Nov 14, 2024
b85ae57
testfix
AlexanderSchmidtCE Nov 14, 2024
3329a6a
updated executeInputSnapshotTests with shortKEy
AlexanderSchmidtCE Nov 14, 2024
e6835af
Merge remote-tracking branch 'origin/6251--feature-shortkey-ermgliche…
AlexanderSchmidtCE Nov 14, 2024
2933dc1
fix: span lint
deleonio Nov 14, 2024
371e250
Merge branch '6251--feature-shortkey-ermglichen-bei-tooltips' of http…
deleonio Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions packages/components/src/components/@deprecated/input/controller.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import type { Generic } from 'adopted-style-sheets';

import type {
AccessKeyPropType,
AdjustHeightPropType,
ButtonProps,
HideErrorPropType,
InputTypeOnDefault,
LabelWithExpertSlotPropType,
MsgPropType,
ShortKeyPropType,
StencilUnknown,
Stringified,
TooltipAlignPropType,
Expand All @@ -18,6 +20,7 @@ import {
objectObjectHandler,
parseJson,
setState,
validateAccessKey,
validateAdjustHeight,
validateHideError,
validateHideLabel,
Expand All @@ -27,13 +30,15 @@ import {
validateTooltipAlign,
watchBoolean,
watchString,
validateShortKey,
} from '../../../schema';

import { stopPropagation, tryToDispatchKoliBriEvent } from '../../../utils/events';
import { ControlledInputController } from '../../input-adapter-leanup/controller';

import type { Props as AdapterProps } from '../../input-adapter-leanup/types';
import type { Props, Watches } from './types';
import { validateAccessAndShortKey } from '../../../schema/validators/access-and-short-key';

type ValueChangeListener = (value: StencilUnknown) => void;

Expand All @@ -47,8 +52,9 @@ export class InputController extends ControlledInputController implements Watche
this.component = component;
}

public validateAccessKey(value?: string): void {
watchString(this.component, '_accessKey', value);
public validateAccessKey(value?: AccessKeyPropType): void {
validateAccessKey(this.component, value);
validateAccessAndShortKey(value, this.component._shortKey);
}

public validateAdjustHeight(value?: AdjustHeightPropType): void {
Expand Down Expand Up @@ -127,6 +133,11 @@ export class InputController extends ControlledInputController implements Watche
}
}

public validateShortKey(value?: ShortKeyPropType): void {
validateShortKey(this.component, value);
validateAccessAndShortKey(this.component._accessKey, value);
}

public validateSmartButton(value?: ButtonProps | string): void {
objectObjectHandler(value, () => {
try {
Expand Down Expand Up @@ -155,9 +166,11 @@ export class InputController extends ControlledInputController implements Watche
this.validateHint(this.component._hint);
this.validateId(this.component._id);
this.validateLabel(this.component._label);
this.validateShortKey(this.component._shortKey);
this.validateSmartButton(this.component._smartButton);
this.validateOn(this.component._on);
this.validateTabIndex(this.component._tabIndex);
validateAccessAndShortKey(this.component._accessKey, this.component._shortKey);
}

protected onBlur(event: Event): void {
Expand Down
5 changes: 3 additions & 2 deletions packages/components/src/components/@deprecated/input/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ButtonProps, InputTypeOnDefault, MsgPropType, PropLabelWithExpertSlot, Stringified } from '../../../schema';
import type { AccessKeyPropType, ButtonProps, InputTypeOnDefault, MsgPropType, PropLabelWithExpertSlot, ShortKeyPropType, Stringified } from '../../../schema';
import type { Generic } from 'adopted-style-sheets';

type RequiredProps = NonNullable<unknown>;
type OptionalProps = PropLabelWithExpertSlot & {
accessKey: string;
accessKey: AccessKeyPropType;
adjustHeight: boolean;
disabled: boolean;
error: string;
Expand All @@ -13,6 +13,7 @@ type OptionalProps = PropLabelWithExpertSlot & {
id: string;
msg: MsgPropType;
on: InputTypeOnDefault;
shortKey: ShortKeyPropType;
smartButton: Stringified<ButtonProps>;
syncValueBySelector: string;
tabIndex: number;
Expand Down
7 changes: 7 additions & 0 deletions packages/components/src/components/button-link/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
IdPropType,
LabelWithExpertSlotPropType,
NamePropType,
ShortKeyPropType,
StencilUnknown,
Stringified,
SyncValueBySelectorPropType,
Expand Down Expand Up @@ -72,6 +73,7 @@ export class KolButtonLink implements ButtonLinkProps, FocusableElement {
_name={this._name}
_on={this._on}
_role="link"
_shortKey={this._shortKey}
_syncValueBySelector={this._syncValueBySelector}
_tabIndex={this._tabIndex}
_tooltipAlign={this._tooltipAlign}
Expand Down Expand Up @@ -154,6 +156,11 @@ export class KolButtonLink implements ButtonLinkProps, FocusableElement {
*/
@Prop() public _role?: AlternativeButtonLinkRolePropType;

/**
* Adds a visual short key hint to the component.
*/
@Prop() public _shortKey?: ShortKeyPropType;

/**
* Selector for synchronizing the value with another input element.
* @internal
Expand Down
21 changes: 19 additions & 2 deletions packages/components/src/components/button/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
FocusableElement,
IconsPropType,
LabelWithExpertSlotPropType,
ShortKeyPropType,
StencilUnknown,
Stringified,
SyncValueBySelectorPropType,
Expand All @@ -37,6 +38,7 @@ import {
validateHideLabel,
validateIcons,
validateLabelWithExpertSlot,
validateShortKey,
validateTabIndex,
validateTooltipAlign,
watchString,
Expand All @@ -49,6 +51,7 @@ import { nonce } from '../../utils/dev.utils';
import { propagateResetEventToForm, propagateSubmitEventToForm } from '../form/controller';
import { AssociatedInputController } from '../input-adapter-leanup/associated.controller';
import { KolSpanWcTag, KolTooltipWcTag } from '../../core/component-names';
import { validateAccessAndShortKey } from '../../schema/validators/access-and-short-key';

/**
* @internal
Expand Down Expand Up @@ -134,7 +137,7 @@ export class KolButtonWc implements ButtonAPI, FocusableElement {
>
<KolSpanWcTag
class="button-inner"
_accessKey={this.state._accessKey}
_badgeText={this.state._accessKey || this.state._shortKey}
_icons={this.state._icons}
_hideLabel={this.state._hideLabel}
_label={hasExpertSlot ? '' : this.state._label}
Expand All @@ -149,7 +152,7 @@ export class KolButtonWc implements ButtonAPI, FocusableElement {
*/
aria-hidden="true"
hidden={hasExpertSlot || !this.state._hideLabel}
_accessKey={this._accessKey}
_badgeText={this.state._accessKey || this.state._shortKey}
_align={this.state._tooltipAlign}
_label={typeof this.state._label === 'string' ? this.state._label : ''}
></KolTooltipWcTag>
Expand Down Expand Up @@ -236,6 +239,11 @@ export class KolButtonWc implements ButtonAPI, FocusableElement {
*/
@Prop() public _role?: AlternativeButtonLinkRolePropType;

/**
* Adds a visual short key hint to the component.
*/
@Prop() public _shortKey?: ShortKeyPropType;

/**
* Selector for synchronizing the value with another input element.
* @internal
Expand Down Expand Up @@ -282,6 +290,7 @@ export class KolButtonWc implements ButtonAPI, FocusableElement {
@Watch('_accessKey')
public validateAccessKey(value?: AccessKeyPropType): void {
validateAccessKey(this, value);
validateAccessAndShortKey(value, this._shortKey);
}

@Watch('_ariaControls')
Expand Down Expand Up @@ -351,6 +360,12 @@ export class KolButtonWc implements ButtonAPI, FocusableElement {
validateAlternativeButtonLinkRole(this, value);
}

@Watch('_shortKey')
public validateShortKey(value?: ShortKeyPropType): void {
validateShortKey(this, value);
validateAccessAndShortKey(this._accessKey, value);
}

@Watch('_syncValueBySelector')
public validateSyncValueBySelector(value?: SyncValueBySelectorPropType): void {
this.controller.validateSyncValueBySelector(value);
Expand Down Expand Up @@ -397,11 +412,13 @@ export class KolButtonWc implements ButtonAPI, FocusableElement {
this.validateName(this._name);
this.validateOn(this._on);
this.validateRole(this._role);
this.validateShortKey(this._shortKey);
this.validateSyncValueBySelector(this._syncValueBySelector);
this.validateTabIndex(this._tabIndex);
this.validateTooltipAlign(this._tooltipAlign);
this.validateType(this._type);
this.validateValue(this._value);
this.validateVariant(this._variant);
validateAccessAndShortKey(this._accessKey, this._shortKey);
AlexanderSchmidtCE marked this conversation as resolved.
Show resolved Hide resolved
}
}
7 changes: 7 additions & 0 deletions packages/components/src/components/button/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
FocusableElement,
IconsPropType,
LabelWithExpertSlotPropType,
ShortKeyPropType,
StencilUnknown,
Stringified,
SyncValueBySelectorPropType,
Expand Down Expand Up @@ -78,6 +79,7 @@ export class KolButton implements ButtonProps, FocusableElement {
_name={this._name}
_on={this._on}
_role={this._role}
_shortKey={this._shortKey}
_syncValueBySelector={this._syncValueBySelector}
_tabIndex={this._tabIndex}
_tooltipAlign={this._tooltipAlign}
Expand Down Expand Up @@ -163,6 +165,11 @@ export class KolButton implements ButtonProps, FocusableElement {
*/
@Prop() public _role?: AlternativeButtonLinkRolePropType;

/**
* Defines the elements short key.
*/
@Prop() public _shortKey?: ShortKeyPropType;

/**
* Selector for synchronizing the value with another input element.
* @internal
Expand Down
22 changes: 17 additions & 5 deletions packages/components/src/components/combobox/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ import type {
LabelWithExpertSlotPropType,
MsgPropType,
NamePropType,
ShortKeyPropType,
Stringified,
SuggestionsPropType,
SyncValueBySelectorPropType,
TooltipAlignPropType,
W3CInputValue,
} from '../../schema';
import { showExpertSlot } from '../../schema';
import { buildBadgeTextString, showExpertSlot } from '../../schema';
import type { JSX } from '@stencil/core';
import { Component, Element, Fragment, h, Host, Listen, Method, Prop, State, Watch } from '@stencil/core';

import { nonce } from '../../utils/dev.utils';
import { stopPropagation, tryToDispatchKoliBriEvent } from '../../utils/events';
import { ComboboxController } from './controller';
import { KolIconTag, KolInputTag } from '../../core/component-names';
import { InternalUnderlinedAccessKey } from '../span/InternalUnderlinedAccessKey';
import { InternalUnderlinedBadgeText } from '../span/InternalUnderlinedBadgeText';
import { getRenderStates } from '../input/controller';
import { translate } from '../../i18n';
import clsx from 'clsx';
Expand Down Expand Up @@ -166,6 +167,7 @@ export class KolCombobox implements ComboboxAPI {
_label={this.state._label}
_msg={this.state._msg}
_required={this.state._required}
_shortKey={this.state._shortKey}
_tooltipAlign={this._tooltipAlign}
_touched={this.state._touched}
onClick={() => this.refInput?.focus()}
Expand All @@ -174,11 +176,11 @@ export class KolCombobox implements ComboboxAPI {
<span slot="label">
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
) : typeof this.state._accessKey === 'string' || typeof this.state._shortKey === 'string' ? (
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<InternalUnderlinedBadgeText badgeText={buildBadgeTextString(this.state._accessKey, this.state._shortKey)} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
{buildBadgeTextString(this.state._accessKey, this.state._shortKey)}
</span>
</>
) : (
Expand Down Expand Up @@ -445,6 +447,11 @@ export class KolCombobox implements ComboboxAPI {
*/
@Prop() public _required?: boolean = false;

/**
* Adds a visual short key hint to the component.
*/
@Prop() public _shortKey?: ShortKeyPropType;

/**
* Selector for synchronizing the value with another input element.
* @internal
Expand Down Expand Up @@ -560,6 +567,11 @@ export class KolCombobox implements ComboboxAPI {
this.controller.validateOn(value);
}

@Watch('_shortKey')
public validateShortKey(value?: ShortKeyPropType): void {
this.controller.validateShortKey(value);
}

@Watch('_suggestions')
public validateSuggestions(value?: SuggestionsPropType): void {
this.controller.validateSuggestions(value);
Expand Down
22 changes: 17 additions & 5 deletions packages/components/src/components/input-checkbox/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ import type {
LabelWithExpertSlotPropType,
MsgPropType,
NamePropType,
ShortKeyPropType,
StencilUnknown,
Stringified,
SyncValueBySelectorPropType,
TooltipAlignPropType,
} from '../../schema';
import { showExpertSlot } from '../../schema';
import { buildBadgeTextString, showExpertSlot } from '../../schema';
import type { JSX } from '@stencil/core';
import { Component, Element, Fragment, h, Host, Method, Prop, State, Watch } from '@stencil/core';

import { nonce } from '../../utils/dev.utils';
import { tryToDispatchKoliBriEvent } from '../../utils/events';
import { getRenderStates } from '../input/controller';
import { InternalUnderlinedAccessKey } from '../span/InternalUnderlinedAccessKey';
import { InternalUnderlinedBadgeText } from '../span/InternalUnderlinedBadgeText';
import { InputCheckboxController } from './controller';
import { KolIconTag, KolInputTag } from '../../core/component-names';
import type { FocusableElement } from '../../schema/interfaces/FocusableElement';
Expand Down Expand Up @@ -99,17 +100,18 @@ export class KolInputCheckbox implements InputCheckboxAPI, FocusableElement {
_id={this.state._id}
_label={this.state._label}
_required={this.state._required}
_shortKey={this.state._shortKey}
_tooltipAlign={this._tooltipAlign}
_touched={this.state._touched}
>
<span slot="label">
{hasExpertSlot ? (
<slot name="expert"></slot>
) : typeof this.state._accessKey === 'string' ? (
) : typeof this.state._accessKey === 'string' || typeof this.state._shortKey === 'string' ? (
<>
<InternalUnderlinedAccessKey accessKey={this.state._accessKey} label={this.state._label} />{' '}
<InternalUnderlinedBadgeText badgeText={buildBadgeTextString(this.state._accessKey, this.state._shortKey)} label={this.state._label} />{' '}
<span class="access-key-hint" aria-hidden="true">
{this.state._accessKey}
{buildBadgeTextString(this.state._accessKey || this.state._shortKey)}
</span>
</>
) : (
Expand Down Expand Up @@ -254,6 +256,11 @@ export class KolInputCheckbox implements InputCheckboxAPI, FocusableElement {
*/
@Prop() public _required?: boolean = false;

/**
* Adds a visual short key hint to the component.
*/
@Prop() public _shortKey?: ShortKeyPropType;

/**
* Selector for synchronizing the value with another input element.
* @internal
Expand Down Expand Up @@ -400,6 +407,11 @@ export class KolInputCheckbox implements InputCheckboxAPI, FocusableElement {
this.controller.validateRequired(value);
}

@Watch('_shortKey')
public validateShortKey(value?: ShortKeyPropType): void {
this.controller.validateShortKey(value);
}

@Watch('_syncValueBySelector')
public validateSyncValueBySelector(value?: SyncValueBySelectorPropType): void {
this.controller.validateSyncValueBySelector(value);
Expand Down
Loading
Loading