-
Notifications
You must be signed in to change notification settings - Fork 45
8714 add show prop to popover-button #8755
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
base: release/3
Are you sure you want to change the base?
Changes from 18 commits
0c35c01
584740a
20fb60f
b0aea25
ca0d0b4
8acf980
bbca1bb
299a231
2320871
80baa1b
f676770
4618725
13b93e8
5abd8cb
c27ec59
4c3c400
8dfd7e7
29e636c
7bfc129
6151652
dc534f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ import type { | |
| SyncValueBySelectorPropType, | ||
| TooltipAlignPropType, | ||
| } from '../../schema'; | ||
| import { validatePopoverAlign } from '../../schema'; | ||
| import { validatePopoverAlign, validateShow } from '../../schema'; | ||
| import type { PopoverButtonProps, PopoverButtonStates } from '../../schema/components/popover-button'; | ||
| import { alignFloatingElements } from '../../utils/align-floating-elements'; | ||
|
|
||
|
|
@@ -52,13 +52,20 @@ export class KolPopoverButton implements PopoverButtonProps { | |
| void this.refPopover?.hidePopover(); | ||
| } | ||
|
|
||
| /** | ||
| * Show the popover programmatically by calling the native showPopover method. | ||
| */ | ||
| @Method() | ||
| // eslint-disable-next-line @typescript-eslint/require-await | ||
| public async showPopover() { | ||
| void this.refPopover?.showPopover(); | ||
| } | ||
|
|
||
| /** | ||
| * Sets focus on the internal element. | ||
| */ | ||
| @Method() | ||
| public async kolFocus() { | ||
| // eslint-disable-next-line no-console | ||
| console.log('Focusing popover button', this.refButton); | ||
| await this.refButton?.kolFocus(); | ||
| } | ||
|
|
||
|
|
@@ -246,6 +253,11 @@ export class KolPopoverButton implements PopoverButtonProps { | |
| */ | ||
| @Prop() public _shortKey?: ShortKeyPropType; | ||
|
|
||
| /** | ||
| * Makes the element show up. | ||
| */ | ||
| @Prop() public _show?: boolean = false; | ||
deleonio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Selector for synchronizing the value with another input element. | ||
| * @internal | ||
|
|
@@ -282,6 +294,19 @@ export class KolPopoverButton implements PopoverButtonProps { | |
| validatePopoverAlign(this, value); | ||
| } | ||
|
|
||
| @Watch('_show') | ||
| public validateShow(value?: boolean): void { | ||
| validateShow(this, value); | ||
| } | ||
|
|
||
| public componentDidLoad() { | ||
|
||
| if (this._show) { | ||
| void this.showPopover(); | ||
| } else { | ||
| void this.hidePopover(); | ||
| } | ||
| } | ||
deleonio marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| public componentWillLoad() { | ||
| this.validatePopoverAlign(this._popoverAlign); | ||
| } | ||
|
|
||
deleonio marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.