This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web/src/elements/chips/Chip.ts
Jens L 8079952d47
web: rework and expand tooltips (#6435)
* web: replace custom tooltip with pfe-tooltip

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* add tooltips to all edit buttons

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* add tooltips to remaining table actions

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* add a bunch more tooltips

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* update locale

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2023-07-31 19:35:09 +02:00

52 lines
1.8 KiB
TypeScript

import { AKElement } from "@goauthentik/elements/Base";
import "@patternfly/elements/pf-tooltip/pf-tooltip.js";
import { msg } from "@lit/localize";
import { CSSResult, TemplateResult, html } from "lit";
import { customElement, property } from "lit/decorators.js";
import PFButton from "@patternfly/patternfly/components/Button/button.css";
import PFChip from "@patternfly/patternfly/components/Chip/chip.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css";
@customElement("ak-chip")
export class Chip extends AKElement {
@property()
value?: number | string;
@property({ type: Boolean })
removable = false;
static get styles(): CSSResult[] {
return [PFBase, PFButton, PFChip];
}
render(): TemplateResult {
return html`<li class="pf-c-chip-group__list-item">
<div class="pf-c-chip">
<span class="pf-c-chip__text">
<slot></slot>
</span>
${this.removable
? html`<button
class="pf-c-button pf-m-plain"
type="button"
@click=${() => {
this.dispatchEvent(
new CustomEvent("remove", {
bubbles: true,
composed: true,
}),
);
}}
>
<pf-tooltip position="top" content=${msg("Remove item")}>
<i class="fas fa-times" aria-hidden="true"></i>
</pf-tooltip>
</button>`
: html``}
</div>
</li>`;
}
}