Skip to content

Commit

Permalink
Add delegatesFocus property to components with tabindex (#6921)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdvg authored Oct 25, 2024
2 parents e26deaa + b0a56b8 commit ebf3939
Show file tree
Hide file tree
Showing 21 changed files with 320 additions and 20 deletions.
4 changes: 3 additions & 1 deletion packages/components/src/components/button-link/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import { KolButtonWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolButtonLink implements ButtonLinkProps, FocusableElement {
private buttonWcRef?: HTMLKolButtonWcElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/button/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import { KolButtonWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolButton implements ButtonProps, FocusableElement {
private buttonWcRef?: HTMLKolButtonWcElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/combobox/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ import clsx from 'clsx';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolCombobox implements ComboboxAPI {
@Element() private readonly host?: HTMLKolComboboxElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input-checkbox/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ import type { FocusableElement } from '../../schema/interfaces/FocusableElement'
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolInputCheckbox implements InputCheckboxAPI, FocusableElement {
@Element() private readonly host?: HTMLKolInputCheckboxElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input-color/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ import { KolInputWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolInputColor implements InputColorAPI, FocusableElement {
@Element() private readonly host?: HTMLKolInputColorElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input-date/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ import { KolInputWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolInputDate implements InputDateAPI, FocusableElement {
@Element() private readonly host?: HTMLKolInputDateElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input-email/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ import { KolInputWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolInputEmail implements InputEmailAPI, FocusableElement {
@Element() private readonly host?: HTMLKolInputEmailElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input-file/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ import { KolInputWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolInputFile implements InputFileAPI, FocusableElement {
@Element() private readonly host?: HTMLKolInputFileElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input-number/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ import { KolInputWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolInputNumber implements InputNumberAPI, FocusableElement {
@Element() private readonly host?: HTMLKolInputNumberElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input-password/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ import type { PasswordVariantPropType } from '../../schema/props/variant/passwor
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolInputPassword implements InputPasswordAPI, FocusableElement {
@Element() private readonly host?: HTMLKolInputPasswordElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input-radio/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ import { KolFormFieldMsgFc } from '../../functional-components';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolInputRadio implements InputRadioAPI, FocusableElement {
@Element() private readonly host?: HTMLKolInputRadioElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input-range/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ import { KolInputWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolInputRange implements InputRangeAPI, FocusableElement {
@Element() private readonly host?: HTMLKolInputRangeElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input-text/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ import { KolInputWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolInputText implements InputTextAPI, FocusableElement {
@Element() private readonly host?: HTMLKolInputTextElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/link-button/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import { KolLinkWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolLinkButton implements LinkButtonProps, FocusableElement {
private linkWcRef?: HTMLKolLinkWcElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/link/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import { KolLinkWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolLink implements LinkProps, FocusableElement {
private linkWcRef?: HTMLKolLinkWcElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/single-select/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ import clsx from 'clsx';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolSingleSelect implements SingleSelectAPI {
@Element() private readonly host?: HTMLKolSingleSelectElement;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/split-button/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ import { KolButtonWcTag, KolPopoverWcTag } from '../../core/component-names';
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolSplitButton implements SplitButtonProps /*, SplitButtonAPI*/ {
private readonly clickButtonHandler = {
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/textarea/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ const increaseTextareaHeight = (el: HTMLTextAreaElement): number => {
styleUrls: {
default: './style.scss',
},
shadow: true,
shadow: {
delegatesFocus: true,
},
})
export class KolTextarea implements TextareaAPI, FocusableElement {
@Element() private readonly host?: HTMLKolTextareaElement;
Expand Down
10 changes: 8 additions & 2 deletions packages/samples/react/src/hooks/useToasterService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { ToasterService } from '@public-ui/components';
export function useToasterService() {
const toaster = ToasterService.getInstance(document);

const message = () => {
const message = (message?: string) => {
void toaster.enqueue({
description: 'Hello',
description: message || 'Hello',
label: `Hello`,
type: 'info',
});
Expand All @@ -15,7 +15,13 @@ export function useToasterService() {
message();
};

const buttonWithTextClickEventHandler = (e: Event) => {
const text = (e.currentTarget as { textContent?: string }).textContent;
message(text);
};

return {
dummyClickEventHandler,
buttonWithTextClickEventHandler,
};
}
Loading

0 comments on commit ebf3939

Please sign in to comment.