@fluid-topics/ft-popover 2.0.38 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,10 @@
1
- import { FtBasePopoverProperties } from "./ft-base-popover";
2
- export interface FtPopoverProperties extends FtBasePopoverProperties {
1
+ import { Position } from "@fluid-topics/ft-tooltip";
2
+ import { FtIcons } from "@fluid-topics/ft-icon";
3
+ export interface FtPopoverProperties {
4
+ opened?: boolean;
5
+ hidden?: boolean;
6
+ closeButtonLabel?: string;
7
+ openButtonLabel?: string;
8
+ openButtonIcon?: FtIcons;
9
+ openButtonTooltipPosition?: Position;
3
10
  }
@@ -1,4 +1,5 @@
1
1
  import { css } from "lit";
2
+ import { FtButtonCssVariables } from "@fluid-topics/ft-button";
2
3
  // language=css
3
4
  export const ftPopoverStyles = css `
4
5
  :host {
@@ -23,8 +24,8 @@ export const ftPopoverStyles = css `
23
24
  right: 8px;
24
25
 
25
26
  ft-button {
26
- --ft-button-icon-size: 12px;
27
- --ft-button-background-color: #fff;
27
+ ${FtButtonCssVariables.iconSize.set("12px")};
28
+ ${FtButtonCssVariables.backgroundColor.set("#fff")};
28
29
  }
29
30
  }
30
31
 
package/build/index.d.ts CHANGED
@@ -1,10 +1,4 @@
1
1
  export * from "./ft-popover.styles";
2
2
  export * from "./ft-popover";
3
3
  export * from "./ft-popover.properties";
4
- export * from "./ftds-popover";
5
- export * from "./ftds-popover.styles";
6
- export * from "./ftds-popover.properties";
7
- export * from "./ftds-popover-section";
8
- export * from "./ftds-popover-section.styles";
9
- export * from "./ftds-popover-section.properties";
10
4
  import "./define";
package/build/index.js CHANGED
@@ -1,10 +1,4 @@
1
1
  export * from "./ft-popover.styles";
2
2
  export * from "./ft-popover";
3
3
  export * from "./ft-popover.properties";
4
- export * from "./ftds-popover";
5
- export * from "./ftds-popover.styles";
6
- export * from "./ftds-popover.properties";
7
- export * from "./ftds-popover-section";
8
- export * from "./ftds-popover-section.styles";
9
- export * from "./ftds-popover-section.properties";
10
4
  import "./define";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-popover",
3
- "version": "2.0.38",
3
+ "version": "2.1.1",
4
4
  "description": "A simple popover component",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,13 +19,12 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/design-system-variables": "3.4.1",
23
- "@fluid-topics/ft-button": "2.0.38",
24
- "@fluid-topics/ft-icon": "2.0.38",
25
- "@fluid-topics/ft-link": "2.0.38",
26
- "@fluid-topics/ft-typography": "2.0.38",
27
- "@fluid-topics/ft-wc-utils": "2.0.38",
22
+ "@fluid-topics/design-system-variables": "3.5.0",
23
+ "@fluid-topics/ft-button": "2.1.1",
24
+ "@fluid-topics/ft-icon": "2.1.1",
25
+ "@fluid-topics/ft-typography": "2.1.1",
26
+ "@fluid-topics/ft-wc-utils": "2.1.1",
28
27
  "lit": "3.1.0"
29
28
  },
30
- "gitHead": "8a5f1d6fb69ac18ec2e6d05dcf82e036d7423c35"
29
+ "gitHead": "a9f1e471fb2dba9aeb8c12394a25460f675597dc"
31
30
  }
@@ -1,51 +0,0 @@
1
- import { Position } from "@fluid-topics/ft-tooltip";
2
- import { FtLitElement } from "@fluid-topics/ft-wc-utils";
3
- import { FtIcons } from "@fluid-topics/ft-icon";
4
- import { DesignSystemFamily, DesignSystemSize } from "@fluid-topics/design-system-variables";
5
- import { nothing, PropertyValues, TemplateResult } from "lit";
6
- import { ClassInfo } from "lit/directives/class-map.js";
7
- import { FtBaseButton } from "@fluid-topics/ft-button/build/ft-base-button";
8
- export interface FtBasePopoverProperties {
9
- opened?: boolean;
10
- hidden?: boolean;
11
- closeButtonLabel?: string;
12
- openButtonLabel?: string;
13
- openButtonTooltipPosition?: Position;
14
- }
15
- export declare abstract class FtBasePopover extends FtLitElement implements FtBasePopoverProperties {
16
- heading: string;
17
- closeButtonLabel: string;
18
- openButtonIcon: FtIcons;
19
- openButtonLabel: string;
20
- openButtonTooltipPosition: Position;
21
- opened: boolean;
22
- hidden: boolean;
23
- openButtonSize: DesignSystemSize;
24
- openButtonFamily: DesignSystemFamily;
25
- private isTriggerSlotAssigned;
26
- protected abstract openingButton?: FtBaseButton;
27
- protected abstract closingButton?: FtBaseButton;
28
- private popoverWrapper?;
29
- private triggerSlot?;
30
- protected abstract wrapperId: string;
31
- protected abstract headingId: string;
32
- protected abstract contentId: string;
33
- protected maxWidth: import("@fluid-topics/ft-wc-utils").FtCssVariable;
34
- protected abstract renderOpeningButton(): TemplateResult;
35
- protected abstract renderClosingButton(): TemplateResult;
36
- protected abstract renderFullContent(): TemplateResult;
37
- protected abstract hideUnusedSlots(): void;
38
- get openingElement(): HTMLElement | undefined;
39
- protected render(): typeof nothing | TemplateResult<1>;
40
- protected renderPopover(): typeof nothing | TemplateResult<1>;
41
- updated(properties: PropertyValues<FtBasePopover>): void;
42
- close(): void;
43
- open(): void;
44
- protected closeAndFocusOpeningButton(): void;
45
- private onTriggerSlotChange;
46
- private onTriggerKeydown;
47
- private watchFocusIn;
48
- private watchEscapeKey;
49
- private positionWrapper;
50
- protected getPopoverWrapperClasses(): ClassInfo;
51
- }
@@ -1,196 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { computeOffsetAutoPosition, FtLitElement, } from "@fluid-topics/ft-wc-utils";
8
- import { property, query, state, } from "lit/decorators.js";
9
- import { FtIcons } from "@fluid-topics/ft-icon";
10
- import { DesignSystemFamily, DesignSystemSize, } from "@fluid-topics/design-system-variables";
11
- import { html, nothing, } from "lit";
12
- import { classMap, } from "lit/directives/class-map.js";
13
- import { ifDefined } from "lit/directives/if-defined.js";
14
- import { FtBaseButton } from "@fluid-topics/ft-button/build/ft-base-button";
15
- import { FtCssVariableFactory } from "@fluid-topics/design-system-variables/build/FtCssVariables";
16
- export class FtBasePopover extends FtLitElement {
17
- constructor() {
18
- super(...arguments);
19
- this.heading = "";
20
- this.closeButtonLabel = "close info";
21
- this.openButtonIcon = FtIcons.CIRCLE_QUESTION;
22
- this.openButtonLabel = "more info";
23
- this.openButtonTooltipPosition = "bottom";
24
- this.opened = false;
25
- this.hidden = false;
26
- this.openButtonSize = DesignSystemSize.medium;
27
- this.openButtonFamily = DesignSystemFamily.info;
28
- this.isTriggerSlotAssigned = false;
29
- this.maxWidth = FtCssVariableFactory.create("--ft-popover-max-width", "", "SIZE", "464px");
30
- this.onTriggerSlotChange = () => {
31
- var _a, _b;
32
- const assignedTrigger = (_b = (_a = this.triggerSlot) === null || _a === void 0 ? void 0 : _a.assignedElements()) !== null && _b !== void 0 ? _b : [];
33
- this.isTriggerSlotAssigned = assignedTrigger.length > 0;
34
- };
35
- this.onTriggerKeydown = (event) => {
36
- if (event.key === "Enter" || event.key === " ") {
37
- event.preventDefault();
38
- this.open();
39
- }
40
- };
41
- this.watchFocusIn = (event) => {
42
- if (this.popoverWrapper && !event.composedPath().includes(this.popoverWrapper)) {
43
- this.close();
44
- }
45
- };
46
- this.watchEscapeKey = (event) => {
47
- var _a;
48
- if (event.key === "Escape") {
49
- this.close();
50
- (_a = this.openingElement) === null || _a === void 0 ? void 0 : _a.focus();
51
- }
52
- };
53
- }
54
- get openingElement() {
55
- var _a;
56
- const assignedTrigger = (_a = this.triggerSlot) === null || _a === void 0 ? void 0 : _a.assignedElements();
57
- if ((assignedTrigger === null || assignedTrigger === void 0 ? void 0 : assignedTrigger.length) && assignedTrigger[0] instanceof HTMLElement) {
58
- return assignedTrigger[0];
59
- }
60
- return this.openingButton;
61
- }
62
- render() {
63
- const classes = {
64
- opened: this.opened,
65
- };
66
- return this.hidden ? nothing : html `
67
- <div part="root-container" class="${classMap(classes)}">
68
- <slot name="trigger"
69
- @slotchange=${this.onTriggerSlotChange}
70
- @click=${this.open}
71
- @keydown=${this.onTriggerKeydown}
72
- @focusin=${this.close}
73
- ></slot>
74
- ${this.isTriggerSlotAssigned ? nothing : this.renderOpeningButton()}
75
- ${this.renderPopover()}
76
- </div>
77
- `;
78
- }
79
- renderPopover() {
80
- return this.opened ? html `
81
- <div part="popover-container">
82
- <div part="overlay" @click=${this.close}></div>
83
- <div id="${this.wrapperId}" part="wrapper" role="dialog"
84
- class="${classMap(this.getPopoverWrapperClasses())}"
85
- aria-labelledby="${ifDefined(this.heading ? `${this.headingId}` : undefined)}"
86
- aria-describedby="${this.contentId}">
87
- <div part="closing-button-container">
88
- ${this.renderClosingButton()}
89
- </div>
90
- ${this.renderFullContent()}
91
- </div>
92
- </div>
93
- ` : nothing;
94
- }
95
- updated(properties) {
96
- super.updated(properties);
97
- if (properties.has("opened")) {
98
- if (this.opened) {
99
- setTimeout(() => {
100
- this.positionWrapper();
101
- document.addEventListener("keydown", this.watchEscapeKey);
102
- document.addEventListener("focusin", this.watchFocusIn);
103
- }, 0);
104
- }
105
- else {
106
- document.removeEventListener("keydown", this.watchEscapeKey);
107
- document.removeEventListener("focusin", this.watchFocusIn);
108
- }
109
- }
110
- }
111
- close() {
112
- this.opened = false;
113
- this.dispatchEvent(new CustomEvent("opened-changed", { detail: { opened: false } }));
114
- }
115
- open() {
116
- this.opened = true;
117
- this.dispatchEvent(new CustomEvent("opened-changed", { detail: { opened: true } }));
118
- }
119
- closeAndFocusOpeningButton() {
120
- var _a;
121
- this.close();
122
- (_a = this.openingElement) === null || _a === void 0 ? void 0 : _a.focus();
123
- if (window.FluidTopicsA11yHints.isKeyboardNavigation) {
124
- if (this.openingElement instanceof FtBaseButton) {
125
- this.openingElement.showTooltip();
126
- }
127
- }
128
- }
129
- async positionWrapper() {
130
- var _a, _b;
131
- if (this.popoverWrapper) {
132
- this.popoverWrapper.classList.remove("positioned");
133
- this.popoverWrapper.style.left = "";
134
- this.popoverWrapper.style.top = "";
135
- if (this.openingElement) {
136
- const allowedPlacements = [
137
- "bottom-start",
138
- "right-start",
139
- "bottom-end",
140
- "right-end",
141
- "left-start",
142
- "left-end",
143
- "top-start",
144
- "top-end",
145
- ];
146
- const defaultPlacement = "bottom-start";
147
- const options = { placement: defaultPlacement, allowedPlacements: allowedPlacements, maxWidthCssVariable: this.maxWidth };
148
- const { x, y } = await computeOffsetAutoPosition(this.openingElement, this.popoverWrapper, options);
149
- this.popoverWrapper.style.left = `${x}px`;
150
- this.popoverWrapper.style.top = `${y}px`;
151
- }
152
- this.popoverWrapper.classList.add("positioned");
153
- }
154
- this.hideUnusedSlots();
155
- (_a = this.closingButton) === null || _a === void 0 ? void 0 : _a.focus();
156
- if (window.FluidTopicsA11yHints.isKeyboardNavigation) {
157
- (_b = this.closingButton) === null || _b === void 0 ? void 0 : _b.showTooltip();
158
- }
159
- }
160
- getPopoverWrapperClasses() {
161
- return {};
162
- }
163
- }
164
- __decorate([
165
- property()
166
- ], FtBasePopover.prototype, "closeButtonLabel", void 0);
167
- __decorate([
168
- property()
169
- ], FtBasePopover.prototype, "openButtonIcon", void 0);
170
- __decorate([
171
- property()
172
- ], FtBasePopover.prototype, "openButtonLabel", void 0);
173
- __decorate([
174
- property()
175
- ], FtBasePopover.prototype, "openButtonTooltipPosition", void 0);
176
- __decorate([
177
- property({ type: Boolean })
178
- ], FtBasePopover.prototype, "opened", void 0);
179
- __decorate([
180
- property({ type: Boolean })
181
- ], FtBasePopover.prototype, "hidden", void 0);
182
- __decorate([
183
- property({ type: DesignSystemSize })
184
- ], FtBasePopover.prototype, "openButtonSize", void 0);
185
- __decorate([
186
- property({ type: DesignSystemFamily })
187
- ], FtBasePopover.prototype, "openButtonFamily", void 0);
188
- __decorate([
189
- state()
190
- ], FtBasePopover.prototype, "isTriggerSlotAssigned", void 0);
191
- __decorate([
192
- query(`[part="wrapper"]`)
193
- ], FtBasePopover.prototype, "popoverWrapper", void 0);
194
- __decorate([
195
- query(`slot[name="trigger"]`)
196
- ], FtBasePopover.prototype, "triggerSlot", void 0);
@@ -1,13 +0,0 @@
1
- import { nothing, PropertyValues } from "lit";
2
- import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
3
- import { FtdsPopoverSectionProperties } from "./ftds-popover-section.properties";
4
- export declare class FtdsPopoverSection extends FtLitElement implements FtdsPopoverSectionProperties {
5
- static elementDefinitions: ElementDefinitionsMap;
6
- static styles: import("lit").CSSResult;
7
- heading: string;
8
- private popoverSectionLinkTypography;
9
- private popoverSectionLinkSlot;
10
- protected render(): import("lit-html").TemplateResult<1>;
11
- renderHeading(): typeof nothing | import("lit-html").TemplateResult<1>;
12
- protected updated(props: PropertyValues): void;
13
- }
@@ -1,61 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { html, nothing } from "lit";
8
- import { property, query } from "lit/decorators.js";
9
- import { FtLitElement, unslotText } from "@fluid-topics/ft-wc-utils";
10
- import { FtdsTypography, FtdsTypographyVariants } from "@fluid-topics/ft-typography";
11
- import { sectionStyles } from "./ftds-popover-section.styles";
12
- export class FtdsPopoverSection extends FtLitElement {
13
- constructor() {
14
- super(...arguments);
15
- this.heading = "";
16
- }
17
- render() {
18
- return html `
19
- <div class="ftds-popover-section--container">
20
- <slot name="heading">
21
- ${this.renderHeading()}
22
- </slot>
23
- <div class="ftds-popover-section--content" part="content" id="ftds-popover-section-content">
24
- <ftds-typography variant="${FtdsTypographyVariants.body2medium}">
25
- <slot></slot>
26
- </ftds-typography>
27
- </div>
28
- <ftds-typography variant="${FtdsTypographyVariants.body2medium}" part="popover-section-link-typography" class="ftds-popover-section--link">
29
- <slot name="link"
30
- part="popover-section-link"
31
- @slotchange=${() => this.requestUpdate()}
32
- ></slot>
33
- </ftds-typography>
34
- </div>
35
- `;
36
- }
37
- renderHeading() {
38
- return this.heading ? html `
39
- <div class="ftds-popover-section--heading" part="heading" id="ftds-popover-section-heading">
40
- <ftds-typography element="span" variant="${FtdsTypographyVariants.body2semibold}">${this.heading}</ftds-typography>
41
- </div>
42
- ` : nothing;
43
- }
44
- updated(props) {
45
- super.updated(props);
46
- this.popoverSectionLinkTypography.hidden = unslotText(this.popoverSectionLinkSlot).trim().length === 0;
47
- }
48
- }
49
- FtdsPopoverSection.elementDefinitions = {
50
- "ftds-typography": FtdsTypography,
51
- };
52
- FtdsPopoverSection.styles = sectionStyles;
53
- __decorate([
54
- property()
55
- ], FtdsPopoverSection.prototype, "heading", void 0);
56
- __decorate([
57
- query("[part=popover-section-link-typography]")
58
- ], FtdsPopoverSection.prototype, "popoverSectionLinkTypography", void 0);
59
- __decorate([
60
- query("[part=popover-section-link]")
61
- ], FtdsPopoverSection.prototype, "popoverSectionLinkSlot", void 0);
@@ -1,3 +0,0 @@
1
- export interface FtdsPopoverSectionProperties {
2
- heading?: string;
3
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare const sectionStyles: import("lit").CSSResult;
@@ -1,22 +0,0 @@
1
- import { css } from "lit";
2
- import { popover } from "@fluid-topics/design-system-variables";
3
- // language=css
4
- export const sectionStyles = css `
5
- .ftds-popover-section--heading ftds-typography {
6
- flex-grow: 1;
7
- flex-shrink: 1;
8
- text-overflow: ellipsis;
9
- overflow: hidden;
10
- white-space: nowrap;
11
- }
12
-
13
- .ftds-popover-section--content {
14
- color: ${popover.bodyColor};
15
- }
16
-
17
- .ftds-popover-section--container {
18
- display: flex;
19
- flex-direction: column;
20
- gap: ${popover.contentSectionVerticalGap};
21
- }
22
- `;
@@ -1,30 +0,0 @@
1
- import { TemplateResult } from "lit";
2
- import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
3
- import { FtdsButton } from "@fluid-topics/ft-button";
4
- import { FtdsPopoverMargins, FtdsPopoverProperties } from "./ftds-popover.properties";
5
- import { FtBasePopover } from "./ft-base-popover";
6
- import { ClassInfo } from "lit/directives/class-map";
7
- export declare class FtdsPopover extends FtBasePopover implements FtdsPopoverProperties {
8
- static styles: import("lit").CSSResult;
9
- static elementDefinitions: ElementDefinitionsMap;
10
- heading: string;
11
- margins: FtdsPopoverMargins;
12
- protected openingButton?: FtdsButton;
13
- protected closingButton?: FtdsButton;
14
- private popoverContentDiv?;
15
- private popoverContentSlot?;
16
- private slottedLinkContent?;
17
- private popoverLinkTypography?;
18
- private popoverSectionsDiv?;
19
- private popoverSectionsSlot?;
20
- protected wrapperId: string;
21
- protected headingId: string;
22
- protected contentId: string;
23
- maxWidth: import("@fluid-topics/ft-wc-utils").FtCssVariable;
24
- protected renderOpeningButton(): TemplateResult;
25
- protected renderClosingButton(): TemplateResult;
26
- protected renderFullContent(): TemplateResult;
27
- protected hideUnusedSlots(): void;
28
- private hasEmptySlot;
29
- protected getPopoverWrapperClasses(): ClassInfo;
30
- }
@@ -1,127 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { html, nothing, } from "lit";
8
- import { property, query, } from "lit/decorators.js";
9
- import { unslotText, } from "@fluid-topics/ft-wc-utils";
10
- import { FtdsTypography, FtdsTypographyVariants, } from "@fluid-topics/ft-typography";
11
- import { FtdsButton } from "@fluid-topics/ft-button";
12
- import { FtdsPopoverMargins, } from "./ftds-popover.properties";
13
- import { DesignSystemFamily, DesignSystemSize, popover, } from "@fluid-topics/design-system-variables";
14
- import { FtIcons } from "@fluid-topics/ft-icon";
15
- import { FtBasePopover } from "./ft-base-popover";
16
- import { styles } from "./ftds-popover.styles";
17
- export class FtdsPopover extends FtBasePopover {
18
- constructor() {
19
- super(...arguments);
20
- this.heading = "";
21
- this.margins = FtdsPopoverMargins.default;
22
- this.wrapperId = "ftds-popover-wrapper";
23
- this.headingId = "ftds-popover-heading";
24
- this.contentId = "ftds-popover-content";
25
- this.maxWidth = popover.maxWidth;
26
- }
27
- renderOpeningButton() {
28
- return html `
29
- <ftds-button @focusin=${this.close}
30
- part="opening-button"
31
- icon="${this.openButtonIcon}"
32
- size="${this.openButtonSize}" family="${this.openButtonFamily}"
33
- label="${this.openButtonLabel}" tooltipposition="${this.openButtonTooltipPosition}"
34
- aria-haspopup="true" aria-expanded="${this.opened}" aria-controls="${this.wrapperId}"
35
- @click=${this.open}>
36
- </ftds-button>
37
- `;
38
- }
39
- renderClosingButton() {
40
- return html `
41
- <ftds-button part="closing-button"
42
- icon="${FtIcons.CLOSE}"
43
- size="${DesignSystemSize.small}"
44
- family="${DesignSystemFamily.neutral}"
45
- label="${this.closeButtonLabel}"
46
- @click=${this.closeAndFocusOpeningButton}>
47
- </ftds-button>
48
- `;
49
- }
50
- renderFullContent() {
51
- return html `
52
- <slot name="heading">
53
- ${this.heading ? html `
54
- <div id="ftds-popover-heading" part="heading">
55
- <ftds-typography element="span" variant="${FtdsTypographyVariants.body2semibold}">
56
- ${this.heading}
57
- </ftds-typography>
58
- </div>
59
- ` : nothing}
60
- </slot>
61
- <div id="ftds-popover-content" part="content">
62
- <ftds-typography variant="${FtdsTypographyVariants.body2medium}">
63
- <slot part="popover-content-slot"></slot>
64
- </ftds-typography>
65
- </div>
66
- <ftds-typography variant="${FtdsTypographyVariants.body2medium}" part="popover-link-typography">
67
- <slot name="link"
68
- part="popover-link"
69
- @slotchange=${() => this.requestUpdate()}
70
- ></slot>
71
- </ftds-typography>
72
- <div part="popover-sections">
73
- <slot name="sections" part="popover-sections-slot"></slot>
74
- </div>
75
- `;
76
- }
77
- hideUnusedSlots() {
78
- var _a, _b, _c;
79
- (_a = this.popoverLinkTypography) === null || _a === void 0 ? void 0 : _a.classList.toggle("hidden", this.hasEmptySlot(this.slottedLinkContent));
80
- (_b = this.popoverContentDiv) === null || _b === void 0 ? void 0 : _b.classList.toggle("hidden", this.hasEmptySlot(this.popoverContentSlot));
81
- (_c = this.popoverSectionsDiv) === null || _c === void 0 ? void 0 : _c.classList.toggle("hidden", this.hasEmptySlot(this.popoverSectionsSlot));
82
- }
83
- hasEmptySlot(slot) {
84
- return unslotText(slot).trim().length === 0;
85
- }
86
- getPopoverWrapperClasses() {
87
- return {
88
- ...super.getPopoverWrapperClasses(),
89
- "ftds-popover--dense": this.margins === FtdsPopoverMargins.dense,
90
- };
91
- }
92
- }
93
- FtdsPopover.styles = styles;
94
- FtdsPopover.elementDefinitions = {
95
- "ftds-typography": FtdsTypography,
96
- "ftds-button": FtdsButton,
97
- };
98
- __decorate([
99
- property()
100
- ], FtdsPopover.prototype, "heading", void 0);
101
- __decorate([
102
- property()
103
- ], FtdsPopover.prototype, "margins", void 0);
104
- __decorate([
105
- query(`[part="opening-button"]`)
106
- ], FtdsPopover.prototype, "openingButton", void 0);
107
- __decorate([
108
- query(`[part="closing-button"]`)
109
- ], FtdsPopover.prototype, "closingButton", void 0);
110
- __decorate([
111
- query(`[part="content"]`)
112
- ], FtdsPopover.prototype, "popoverContentDiv", void 0);
113
- __decorate([
114
- query(`[part="popover-content-slot"]`)
115
- ], FtdsPopover.prototype, "popoverContentSlot", void 0);
116
- __decorate([
117
- query(`[part="popover-link"]`)
118
- ], FtdsPopover.prototype, "slottedLinkContent", void 0);
119
- __decorate([
120
- query(`[part="popover-link-typography"]`)
121
- ], FtdsPopover.prototype, "popoverLinkTypography", void 0);
122
- __decorate([
123
- query(`[part="popover-sections"]`)
124
- ], FtdsPopover.prototype, "popoverSectionsDiv", void 0);
125
- __decorate([
126
- query(`[part="popover-sections-slot"]`)
127
- ], FtdsPopover.prototype, "popoverSectionsSlot", void 0);
@@ -1,9 +0,0 @@
1
- import { FtBasePopoverProperties } from "./ft-base-popover";
2
- export interface FtdsPopoverProperties extends FtBasePopoverProperties {
3
- heading?: string;
4
- margins?: FtdsPopoverMargins;
5
- }
6
- export declare enum FtdsPopoverMargins {
7
- default = "default",
8
- dense = "dense"
9
- }
@@ -1,5 +0,0 @@
1
- export var FtdsPopoverMargins;
2
- (function (FtdsPopoverMargins) {
3
- FtdsPopoverMargins["default"] = "default";
4
- FtdsPopoverMargins["dense"] = "dense";
5
- })(FtdsPopoverMargins || (FtdsPopoverMargins = {}));
@@ -1 +0,0 @@
1
- export declare const styles: import("lit").CSSResult;