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