@fluid-topics/ft-collapsible 2.0.37 → 2.1.0
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.
- package/build/definitions.d.ts +0 -2
- package/build/definitions.js +0 -2
- package/build/ft-collapsible.d.ts +29 -3
- package/build/ft-collapsible.js +147 -5
- package/build/ft-collapsible.light.js +407 -1462
- package/build/ft-collapsible.min.js +411 -1477
- package/build/ft-collapsible.properties.d.ts +18 -3
- package/build/ft-collapsible.styles.d.ts +1 -1
- package/build/ft-collapsible.styles.js +1 -1
- package/build/index.d.ts +0 -2
- package/build/index.js +0 -2
- package/package.json +4 -4
- package/build/ft-base-collapsible.d.ts +0 -51
- package/build/ft-base-collapsible.js +0 -165
- package/build/ftds-collapsible.d.ts +0 -7
- package/build/ftds-collapsible.js +0 -10
- package/build/ftds-collapsible.properties.d.ts +0 -8
- package/build/ftds-collapsible.properties.js +0 -1
package/build/definitions.d.ts
CHANGED
package/build/definitions.js
CHANGED
|
@@ -1,7 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { FtIconVariants } from "@fluid-topics/ft-icon/build/ft-icon.properties";
|
|
3
|
+
import { Position } from "@fluid-topics/ft-tooltip/build/ft-tooltip.properties";
|
|
2
4
|
import { FtCollapsibleProperties } from "./ft-collapsible.properties";
|
|
3
|
-
|
|
4
|
-
export declare class FtCollapsible extends FtBaseCollapsible implements FtCollapsibleProperties {
|
|
5
|
+
export declare class FtCollapsible extends FtLitElement implements FtCollapsibleProperties {
|
|
5
6
|
static elementDefinitions: ElementDefinitionsMap;
|
|
6
7
|
static styles: import("lit").CSSResult;
|
|
8
|
+
open: boolean;
|
|
9
|
+
animated: boolean;
|
|
10
|
+
closeCollapsibleMatchers: string[];
|
|
11
|
+
primary: boolean;
|
|
12
|
+
dense: boolean;
|
|
13
|
+
round: boolean;
|
|
14
|
+
label?: string;
|
|
15
|
+
openLabel?: string;
|
|
16
|
+
closedLabel?: string;
|
|
17
|
+
text?: string;
|
|
18
|
+
openText?: string;
|
|
19
|
+
closedText?: string;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
tooltipPosition: Position;
|
|
22
|
+
iconVariant?: FtIconVariants;
|
|
23
|
+
openIcon: string;
|
|
24
|
+
closedIcon: string;
|
|
25
|
+
trailingIcon: boolean;
|
|
26
|
+
private animationInProgress;
|
|
27
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
28
|
+
private animationEndSafeguard;
|
|
29
|
+
private handleKeydown;
|
|
30
|
+
private toggleOpenAnimation;
|
|
31
|
+
private toggleOpen;
|
|
32
|
+
private onContentClick;
|
|
7
33
|
}
|
package/build/ft-collapsible.js
CHANGED
|
@@ -1,9 +1,151 @@
|
|
|
1
|
-
|
|
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 } from "lit";
|
|
8
|
+
import { property, state, } from "lit/decorators.js";
|
|
9
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
10
|
+
import { Debouncer, eventPathContainsMatchingElement, FtLitElement, jsonProperty, } from "@fluid-topics/ft-wc-utils";
|
|
2
11
|
import { FtButton } from "@fluid-topics/ft-button";
|
|
3
|
-
import {
|
|
4
|
-
export class FtCollapsible extends
|
|
12
|
+
import { collapsibleStyles } from "./ft-collapsible.styles";
|
|
13
|
+
export class FtCollapsible extends FtLitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.open = false;
|
|
17
|
+
this.animated = false;
|
|
18
|
+
this.closeCollapsibleMatchers = [];
|
|
19
|
+
// Button properties
|
|
20
|
+
this.primary = false;
|
|
21
|
+
this.dense = false;
|
|
22
|
+
this.round = false;
|
|
23
|
+
this.disabled = false;
|
|
24
|
+
this.tooltipPosition = "right";
|
|
25
|
+
this.openIcon = "THIN_ARROW";
|
|
26
|
+
this.closedIcon = "THIN_ARROW_RIGHT";
|
|
27
|
+
this.trailingIcon = false;
|
|
28
|
+
this.animationInProgress = false;
|
|
29
|
+
this.animationEndSafeguard = new Debouncer(800);
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
const contentClasses = {
|
|
33
|
+
"ft-collapsible--content": true,
|
|
34
|
+
"ft-collapsible--hidden": !this.open,
|
|
35
|
+
"ft-collapsible--animated": this.animated,
|
|
36
|
+
"ft-collapsible--animation-in-progress": this.animated && this.animationInProgress,
|
|
37
|
+
};
|
|
38
|
+
return html `
|
|
39
|
+
<slot name="toggle"
|
|
40
|
+
part="toggle"
|
|
41
|
+
@click=${this.toggleOpenAnimation}
|
|
42
|
+
@keydown=${this.handleKeydown}>
|
|
43
|
+
<ft-button
|
|
44
|
+
part="toggle"
|
|
45
|
+
.tooltipPosition=${this.tooltipPosition}
|
|
46
|
+
.iconVariant=${this.iconVariant}
|
|
47
|
+
.icon=${this.open ? this.openIcon : this.closedIcon}
|
|
48
|
+
.label=${(this.open ? this.openLabel : this.closedLabel) || this.label}
|
|
49
|
+
?primary=${this.primary}
|
|
50
|
+
?disabled=${this.disabled}
|
|
51
|
+
?dense=${this.dense}
|
|
52
|
+
?round=${this.round}
|
|
53
|
+
?trailingIcon=${this.trailingIcon}
|
|
54
|
+
aria-controls="ft-collapsible-content"
|
|
55
|
+
aria-expanded="${this.open}"
|
|
56
|
+
>
|
|
57
|
+
${(this.open ? this.openText : this.closedText) || this.text}
|
|
58
|
+
</ft-button>
|
|
59
|
+
</slot>
|
|
60
|
+
<slot id="ft-collapsible-content"
|
|
61
|
+
class="${classMap(contentClasses)}"
|
|
62
|
+
@click=${this.onContentClick}
|
|
63
|
+
@transitionend=${() => this.animationInProgress = false}></slot>
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
handleKeydown(event) {
|
|
67
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
this.toggleOpenAnimation();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
toggleOpenAnimation() {
|
|
73
|
+
this.animationInProgress = true;
|
|
74
|
+
setTimeout(() => this.toggleOpen(), 5);
|
|
75
|
+
this.animationEndSafeguard.run(() => this.animationInProgress = false);
|
|
76
|
+
}
|
|
77
|
+
toggleOpen() {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
this.open = !this.open;
|
|
80
|
+
const toggle = this.shadowRoot.querySelector("[part=toggle]");
|
|
81
|
+
const button = (_b = (_a = toggle === null || toggle === void 0 ? void 0 : toggle.querySelector("ft-button")) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("[part=button]");
|
|
82
|
+
button === null || button === void 0 ? void 0 : button.setAttribute("aria-expanded", `${this.open}`);
|
|
83
|
+
this.dispatchEvent(new CustomEvent("change", { detail: { open: this.open } }));
|
|
84
|
+
}
|
|
85
|
+
onContentClick(e) {
|
|
86
|
+
if (eventPathContainsMatchingElement(e, this.closeCollapsibleMatchers, this)) {
|
|
87
|
+
this.toggleOpenAnimation();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
5
90
|
}
|
|
6
91
|
FtCollapsible.elementDefinitions = {
|
|
7
|
-
"ft-
|
|
92
|
+
"ft-button": FtButton,
|
|
8
93
|
};
|
|
9
|
-
FtCollapsible.styles =
|
|
94
|
+
FtCollapsible.styles = collapsibleStyles;
|
|
95
|
+
__decorate([
|
|
96
|
+
property({ type: Boolean, reflect: true })
|
|
97
|
+
], FtCollapsible.prototype, "open", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
property({ type: Boolean })
|
|
100
|
+
], FtCollapsible.prototype, "animated", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
jsonProperty([])
|
|
103
|
+
], FtCollapsible.prototype, "closeCollapsibleMatchers", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
property({ type: Boolean })
|
|
106
|
+
], FtCollapsible.prototype, "primary", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
property({ type: Boolean })
|
|
109
|
+
], FtCollapsible.prototype, "dense", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ type: Boolean })
|
|
112
|
+
], FtCollapsible.prototype, "round", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
property()
|
|
115
|
+
], FtCollapsible.prototype, "label", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
property()
|
|
118
|
+
], FtCollapsible.prototype, "openLabel", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
property()
|
|
121
|
+
], FtCollapsible.prototype, "closedLabel", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
property()
|
|
124
|
+
], FtCollapsible.prototype, "text", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property()
|
|
127
|
+
], FtCollapsible.prototype, "openText", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
property()
|
|
130
|
+
], FtCollapsible.prototype, "closedText", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
property({ type: Boolean })
|
|
133
|
+
], FtCollapsible.prototype, "disabled", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
property()
|
|
136
|
+
], FtCollapsible.prototype, "tooltipPosition", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
property()
|
|
139
|
+
], FtCollapsible.prototype, "iconVariant", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
property()
|
|
142
|
+
], FtCollapsible.prototype, "openIcon", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
property()
|
|
145
|
+
], FtCollapsible.prototype, "closedIcon", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
property({ type: Boolean })
|
|
148
|
+
], FtCollapsible.prototype, "trailingIcon", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
state()
|
|
151
|
+
], FtCollapsible.prototype, "animationInProgress", void 0);
|