@fluid-topics/ft-card 2.0.22 → 2.0.24

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.
@@ -17,4 +17,4 @@ export declare const FtCardCssVariables: {
17
17
  elevation02: import("@fluid-topics/ft-wc-utils").FtCssVariable;
18
18
  elevation04: import("@fluid-topics/ft-wc-utils").FtCssVariable;
19
19
  };
20
- export declare const styles: import("lit").CSSResult;
20
+ export declare const classicStyles: import("lit").CSSResult;
@@ -21,7 +21,7 @@ export const FtCardCssVariables = {
21
21
  elevation04: FtCssVariableFactory.extend("--ft-card-selected-elevation", "", designSystemVariables.elevation04),
22
22
  };
23
23
  // language=CSS
24
- export const styles = css `
24
+ export const classicStyles = css `
25
25
  :host {
26
26
  display: block;
27
27
  }
@@ -0,0 +1,9 @@
1
+ import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
2
+ import { FtdsCardLabelledInfoProperties } from "./ftds-card-labelled-info.properties";
3
+ export declare class FtdsCardLabelledInfo extends FtLitElement implements FtdsCardLabelledInfoProperties {
4
+ static elementDefinitions: ElementDefinitionsMap;
5
+ static styles: import("lit").CSSResult;
6
+ label: string;
7
+ info: string;
8
+ protected render(): import("lit-html").TemplateResult<1>;
9
+ }
@@ -0,0 +1,40 @@
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 { FtLitElement, } from "@fluid-topics/ft-wc-utils";
8
+ import { html } from "lit";
9
+ import { property } from "lit/decorators.js";
10
+ import { FtdsTypography, FtdsTypographyVariants, } from "@fluid-topics/ft-typography";
11
+ import { labelledInfoStyles } from "./ftds-card-labelled-info.styles";
12
+ export class FtdsCardLabelledInfo extends FtLitElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.label = "";
16
+ this.info = "";
17
+ }
18
+ render() {
19
+ return html `
20
+ <div id="container">
21
+ <ftds-typography class="label" variant="${FtdsTypographyVariants.caption2medium}">
22
+ ${this.label}
23
+ </ftds-typography>
24
+ <ftds-typography class="info" variant="${FtdsTypographyVariants.body2medium}">
25
+ ${this.info}
26
+ </ftds-typography>
27
+ </div>
28
+ `;
29
+ }
30
+ }
31
+ FtdsCardLabelledInfo.elementDefinitions = {
32
+ "ftds-typography": FtdsTypography,
33
+ };
34
+ FtdsCardLabelledInfo.styles = labelledInfoStyles;
35
+ __decorate([
36
+ property()
37
+ ], FtdsCardLabelledInfo.prototype, "label", void 0);
38
+ __decorate([
39
+ property()
40
+ ], FtdsCardLabelledInfo.prototype, "info", void 0);
@@ -0,0 +1,4 @@
1
+ export interface FtdsCardLabelledInfoProperties {
2
+ label: string;
3
+ info: string;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const labelledInfoStyles: import("lit").CSSResult;
@@ -0,0 +1,21 @@
1
+ import { css } from "lit";
2
+ import { foundation, semantic, } from "@fluid-topics/ft-wc-utils";
3
+ // language=CSS
4
+ export const labelledInfoStyles = css `
5
+ :host {
6
+ }
7
+
8
+ #container {
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: ${foundation.spacing1};
12
+ }
13
+
14
+ .label {
15
+ color: ${semantic.contentGlobalSecondary};
16
+ }
17
+
18
+ .info {
19
+ color: ${semantic.contentGlobalPrimary};
20
+ }
21
+ `;
@@ -0,0 +1,8 @@
1
+ import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
2
+ import { CardUserProfile, FtdsCardUserInfoProperties } from "./ftds-card-user-info.properties";
3
+ export declare class FtdsCardUserInfo extends FtLitElement implements FtdsCardUserInfoProperties {
4
+ static elementDefinitions: ElementDefinitionsMap;
5
+ static styles: import("lit").CSSResult;
6
+ user?: CardUserProfile;
7
+ protected render(): import("lit-html").TemplateResult<1>;
8
+ }
@@ -0,0 +1,38 @@
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 { FtLitElement, } from "@fluid-topics/ft-wc-utils";
8
+ import { html } from "lit";
9
+ import { property } from "lit/decorators.js";
10
+ import { userInfoStyles } from "./ftds-card-user-info.styles";
11
+ import { FtIcon, FtIcons, } from "@fluid-topics/ft-icon";
12
+ import { FtdsTypography, FtdsTypographyVariants, } from "@fluid-topics/ft-typography";
13
+ export class FtdsCardUserInfo extends FtLitElement {
14
+ render() {
15
+ var _a, _b;
16
+ return html `
17
+ <div id="container">
18
+ <ft-icon value="${FtIcons.USER}"></ft-icon>
19
+ <div id="info">
20
+ <ftds-typography class="name" variant="${FtdsTypographyVariants.caption1medium}">
21
+ ${(_a = this.user) === null || _a === void 0 ? void 0 : _a.displayName}
22
+ </ftds-typography>
23
+ <ftds-typography class="mail" variant="${FtdsTypographyVariants.caption1medium}">
24
+ ${(_b = this.user) === null || _b === void 0 ? void 0 : _b.emailAddress}
25
+ </ftds-typography>
26
+ </div>
27
+ </div>
28
+ `;
29
+ }
30
+ }
31
+ FtdsCardUserInfo.elementDefinitions = {
32
+ "ftds-typography": FtdsTypography,
33
+ "ft-icon": FtIcon,
34
+ };
35
+ FtdsCardUserInfo.styles = userInfoStyles;
36
+ __decorate([
37
+ property({ attribute: false })
38
+ ], FtdsCardUserInfo.prototype, "user", void 0);
@@ -0,0 +1,5 @@
1
+ import { FtUserProfile } from "@fluid-topics/public-api";
2
+ export type CardUserProfile = Pick<FtUserProfile, "displayName" | "emailAddress">;
3
+ export interface FtdsCardUserInfoProperties {
4
+ user?: CardUserProfile;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const userInfoStyles: import("lit").CSSResult;
@@ -0,0 +1,31 @@
1
+ import { css } from "lit";
2
+ import { foundation, semantic, } from "@fluid-topics/ft-wc-utils";
3
+ import { FtIconCssVariables } from "@fluid-topics/ft-icon";
4
+ // language=CSS
5
+ export const userInfoStyles = css `
6
+ :host {
7
+ }
8
+
9
+ #container {
10
+ display: flex;
11
+ align-items: center;
12
+ gap: ${foundation.spacing2};
13
+ }
14
+
15
+ ft-icon {
16
+ ${FtIconCssVariables.size.set(foundation.iconSize5)};
17
+ }
18
+
19
+ #info {
20
+ display: flex;
21
+ flex-direction: column;
22
+
23
+ .name {
24
+ color: ${semantic.contentGlobalPrimary};
25
+ }
26
+
27
+ .mail {
28
+ color: ${semantic.contentGlobalSecondary};
29
+ }
30
+ }
31
+ `;
@@ -0,0 +1,30 @@
1
+ import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
2
+ import { FtdsCardProperties } from "./ftds-card.properties";
3
+ export declare class FtdsCard extends FtLitElement implements FtdsCardProperties {
4
+ static elementDefinitions: ElementDefinitionsMap;
5
+ static styles: import("lit").CSSResult;
6
+ headerText?: string;
7
+ headerBorder: boolean;
8
+ headerHref?: string;
9
+ selectable: boolean;
10
+ selected: boolean;
11
+ private hasHeader;
12
+ private hasHeaderActions;
13
+ private hasBody;
14
+ private hasFooter;
15
+ private hasFooterActions;
16
+ private hasSideBar;
17
+ private headerContent;
18
+ private headerActionsContent;
19
+ private bodyContent?;
20
+ private footerContent;
21
+ private footerActionsContent;
22
+ private sideBarContent;
23
+ private get isClickable();
24
+ protected render(): import("lit-html").TemplateResult<1>;
25
+ private renderHeaderText;
26
+ private onKeydown;
27
+ private onKeyup;
28
+ private onClick;
29
+ private onSlotchange;
30
+ }
@@ -0,0 +1,180 @@
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 { FtLitElement, unslotText, } from "@fluid-topics/ft-wc-utils";
8
+ import { FtdsTypography } from "@fluid-topics/ft-typography";
9
+ import { designSystemStyles, FtdsCardTypographies, } from "./ftds-card.styles";
10
+ import { property, query, queryAssignedNodes, state, } from "lit/decorators.js";
11
+ import { html, nothing, } from "lit";
12
+ import { when } from "lit/directives/when.js";
13
+ import { classMap } from "lit/directives/class-map.js";
14
+ import { FtRipple } from "@fluid-topics/ft-ripple";
15
+ export class FtdsCard extends FtLitElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.headerBorder = false;
19
+ this.selectable = false;
20
+ this.selected = false;
21
+ this.hasHeader = true;
22
+ this.hasHeaderActions = false;
23
+ this.hasBody = true;
24
+ this.hasFooter = true;
25
+ this.hasFooterActions = false;
26
+ this.hasSideBar = false;
27
+ }
28
+ get isClickable() {
29
+ return this.selectable || !!this.headerHref;
30
+ }
31
+ render() {
32
+ const classes = {
33
+ "ftds-card--clickable": this.isClickable,
34
+ "ftds-card--selected": this.selected,
35
+ "ftds-card--selectable": this.selectable,
36
+ "ftds-card--header-border": this.headerBorder,
37
+ "ftds-card--no-header": !this.hasHeader,
38
+ "ftds-card--no-header-actions": !this.hasHeaderActions,
39
+ "ftds-card--no-body": !this.hasBody,
40
+ "ftds-card--no-footer": !this.hasFooter,
41
+ "ftds-card--no-footer-actions": !this.hasFooterActions,
42
+ "ftds-card--no-side-bar": !this.hasSideBar,
43
+ };
44
+ return html `
45
+ <div id="container"
46
+ role="${this.selectable ? "checkbox" : nothing}"
47
+ aria-checked="${this.selectable ? this.selected.toString() : nothing}"
48
+ aria-labelledby="${this.selectable ? "header-title" : nothing}"
49
+ tabindex="${this.selectable ? 0 : nothing}"
50
+ class="${classMap(classes)}"
51
+ @keydown=${this.onKeydown}
52
+ @keyup=${this.onKeyup}
53
+ @click=${this.onClick}
54
+ >
55
+ ${when(!!this.headerHref || this.selectable, () => html `
56
+ <ft-ripple ?selected=${this.selected}></ft-ripple>
57
+ `)}
58
+ <div id="main">
59
+ <div id="image">
60
+ <slot name="image" @slotchange=${this.onSlotchange}></slot>
61
+ </div>
62
+ <div id="header">
63
+ <div id="header-title">
64
+ ${when(!!this.headerHref, () => html `
65
+ <a href="${this.headerHref}">
66
+ ${this.renderHeaderText()}
67
+ </a>
68
+ `, () => html `
69
+ ${this.renderHeaderText()}
70
+ `)}
71
+ <slot name="header" @slotchange=${this.onSlotchange}></slot>
72
+ </div>
73
+ <div id="header-actions">
74
+ <slot name="header-actions" @slotchange=${this.onSlotchange}></slot>
75
+ </div>
76
+ </div>
77
+ <div id="body">
78
+ <slot @slotchange=${this.onSlotchange}></slot>
79
+ </div>
80
+ <div id="footer">
81
+ <div id="footer-text">
82
+ <slot name="footer" @slotchange=${this.onSlotchange}></slot>
83
+ </div>
84
+ <div id="footer-actions">
85
+ <slot name="footer-actions" @slotchange=${this.onSlotchange}></slot>
86
+ </div>
87
+ </div>
88
+ </div>
89
+ <div id="side-bar">
90
+ <slot name="side-bar" @slotchange=${this.onSlotchange}></slot>
91
+ </div>
92
+ </div>
93
+ `;
94
+ }
95
+ renderHeaderText() {
96
+ return html `
97
+ <ftds-typography variant="${FtdsCardTypographies.header}">${this.headerText}</ftds-typography>
98
+ `;
99
+ }
100
+ onKeydown(event) {
101
+ if (this.selectable && event.code === "Space") {
102
+ event.preventDefault();
103
+ }
104
+ }
105
+ onKeyup(event) {
106
+ if (this.selectable && event.code === "Space") {
107
+ this.dispatchEvent(new CustomEvent("change", { detail: !this.selected }));
108
+ }
109
+ }
110
+ onClick() {
111
+ if (this.selectable) {
112
+ this.dispatchEvent(new CustomEvent("change", { detail: !this.selected }));
113
+ }
114
+ }
115
+ onSlotchange() {
116
+ var _a, _b;
117
+ this.hasHeader = this.headerContent.length > 0 || !!this.headerText;
118
+ this.hasHeaderActions = this.headerActionsContent.length > 0;
119
+ this.hasBody = unslotText(this.bodyContent).trim().length > 0 || ((_b = (_a = this.bodyContent) === null || _a === void 0 ? void 0 : _a.assignedElements()) !== null && _b !== void 0 ? _b : []).length > 0;
120
+ this.hasFooter = this.footerContent.length > 0;
121
+ this.hasFooterActions = this.footerActionsContent.length > 0;
122
+ this.hasSideBar = this.sideBarContent.length > 0;
123
+ }
124
+ }
125
+ FtdsCard.elementDefinitions = {
126
+ "ftds-typography": FtdsTypography,
127
+ "ft-ripple": FtRipple,
128
+ };
129
+ FtdsCard.styles = designSystemStyles;
130
+ __decorate([
131
+ property()
132
+ ], FtdsCard.prototype, "headerText", void 0);
133
+ __decorate([
134
+ property({ type: Boolean })
135
+ ], FtdsCard.prototype, "headerBorder", void 0);
136
+ __decorate([
137
+ property()
138
+ ], FtdsCard.prototype, "headerHref", void 0);
139
+ __decorate([
140
+ property({ type: Boolean })
141
+ ], FtdsCard.prototype, "selectable", void 0);
142
+ __decorate([
143
+ property({ type: Boolean })
144
+ ], FtdsCard.prototype, "selected", void 0);
145
+ __decorate([
146
+ state()
147
+ ], FtdsCard.prototype, "hasHeader", void 0);
148
+ __decorate([
149
+ state()
150
+ ], FtdsCard.prototype, "hasHeaderActions", void 0);
151
+ __decorate([
152
+ state()
153
+ ], FtdsCard.prototype, "hasBody", void 0);
154
+ __decorate([
155
+ state()
156
+ ], FtdsCard.prototype, "hasFooter", void 0);
157
+ __decorate([
158
+ state()
159
+ ], FtdsCard.prototype, "hasFooterActions", void 0);
160
+ __decorate([
161
+ state()
162
+ ], FtdsCard.prototype, "hasSideBar", void 0);
163
+ __decorate([
164
+ queryAssignedNodes({ slot: "header" })
165
+ ], FtdsCard.prototype, "headerContent", void 0);
166
+ __decorate([
167
+ queryAssignedNodes({ slot: "header-actions" })
168
+ ], FtdsCard.prototype, "headerActionsContent", void 0);
169
+ __decorate([
170
+ query("#body slot")
171
+ ], FtdsCard.prototype, "bodyContent", void 0);
172
+ __decorate([
173
+ queryAssignedNodes({ slot: "footer" })
174
+ ], FtdsCard.prototype, "footerContent", void 0);
175
+ __decorate([
176
+ queryAssignedNodes({ slot: "footer-actions" })
177
+ ], FtdsCard.prototype, "footerActionsContent", void 0);
178
+ __decorate([
179
+ queryAssignedNodes({ slot: "side-bar" })
180
+ ], FtdsCard.prototype, "sideBarContent", void 0);
@@ -0,0 +1,7 @@
1
+ export interface FtdsCardProperties {
2
+ headerText?: string;
3
+ headerBorder?: boolean;
4
+ headerHref?: string;
5
+ selectable?: boolean;
6
+ selected?: boolean;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,55 @@
1
+ import { FtdsTypographyVariants } from "@fluid-topics/ft-typography";
2
+ export declare const FtdsCardCssVariables: {
3
+ borderRadius: import("@fluid-topics/design-system-variables").FtCssVariable;
4
+ focusFocusRingColor: import("@fluid-topics/design-system-variables").FtCssVariable;
5
+ focusOutlineWidth: import("@fluid-topics/design-system-variables").FtCssVariable;
6
+ focusOutlineOffset: import("@fluid-topics/design-system-variables").FtCssVariable;
7
+ headerTitleHorizontalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
8
+ headerTitleVerticalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
9
+ headerActionHorizontalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
10
+ headerActionVerticalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
11
+ headerActionGap: import("@fluid-topics/design-system-variables").FtCssVariable;
12
+ bodyHorizontalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
13
+ bodyVerticalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
14
+ footerActionHorizontalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
15
+ footerActionVerticalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
16
+ footerActionGap: import("@fluid-topics/design-system-variables").FtCssVariable;
17
+ footerContentHorizontalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
18
+ footerContentVerticalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
19
+ sideBarHorizontalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
20
+ sideBarVerticalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
21
+ sideBarGap: import("@fluid-topics/design-system-variables").FtCssVariable;
22
+ nonSelectableBorderWidth: import("@fluid-topics/design-system-variables").FtCssVariable;
23
+ nonSelectableStateLayerColor: import("@fluid-topics/design-system-variables").FtCssVariable;
24
+ nonSelectableDefaultBackgroundColor: import("@fluid-topics/design-system-variables").FtCssVariable;
25
+ nonSelectableDefaultBorderColor: import("@fluid-topics/design-system-variables").FtCssVariable;
26
+ nonSelectableHoverBackgroundColor: import("@fluid-topics/design-system-variables").FtCssVariable;
27
+ nonSelectableHoverBorderColor: import("@fluid-topics/design-system-variables").FtCssVariable;
28
+ nonSelectableHoverStateLayerOpacity: import("@fluid-topics/design-system-variables").FtCssVariable;
29
+ nonSelectableFocusBackgroundColor: import("@fluid-topics/design-system-variables").FtCssVariable;
30
+ nonSelectableFocusBorderColor: import("@fluid-topics/design-system-variables").FtCssVariable;
31
+ nonSelectableFocusStateLayerOpacity: import("@fluid-topics/design-system-variables").FtCssVariable;
32
+ internalBorderColor: import("@fluid-topics/design-system-variables").FtCssVariable;
33
+ selectableUnselectedBorderWidth: import("@fluid-topics/design-system-variables").FtCssVariable;
34
+ selectableUnselectedStateLayerColor: import("@fluid-topics/design-system-variables").FtCssVariable;
35
+ selectableUnselectedDefaultBackgroundColor: import("@fluid-topics/design-system-variables").FtCssVariable;
36
+ selectableUnselectedDefaultBorderColor: import("@fluid-topics/design-system-variables").FtCssVariable;
37
+ selectableUnselectedHoverBackgroundColor: import("@fluid-topics/design-system-variables").FtCssVariable;
38
+ selectableUnselectedHoverBorderColor: import("@fluid-topics/design-system-variables").FtCssVariable;
39
+ selectableUnselectedHoverStateLayerOpacity: import("@fluid-topics/design-system-variables").FtCssVariable;
40
+ selectableUnselectedFocusBackgroundColor: import("@fluid-topics/design-system-variables").FtCssVariable;
41
+ selectableUnselectedFocusBorderColor: import("@fluid-topics/design-system-variables").FtCssVariable;
42
+ selectableUnselectedFocusStateLayerOpacity: import("@fluid-topics/design-system-variables").FtCssVariable;
43
+ selectableSelectedBorderColor: import("@fluid-topics/design-system-variables").FtCssVariable;
44
+ selectableSelectedBorderWidth: import("@fluid-topics/design-system-variables").FtCssVariable;
45
+ selectableSelectedStateLayerColor: import("@fluid-topics/design-system-variables").FtCssVariable;
46
+ selectableSelectedBackgroundColor: import("@fluid-topics/design-system-variables").FtCssVariable;
47
+ selectableSelectedDefaultStateLayerOpacity: import("@fluid-topics/design-system-variables").FtCssVariable;
48
+ selectableSelectedHoverStateLayerOpacity: import("@fluid-topics/design-system-variables").FtCssVariable;
49
+ selectableSelectedFocusStateLayerOpacity: import("@fluid-topics/design-system-variables").FtCssVariable;
50
+ internalBorderWidth: import("@fluid-topics/design-system-variables").FtCssVariable;
51
+ };
52
+ export declare const FtdsCardTypographies: {
53
+ header: FtdsTypographyVariants;
54
+ };
55
+ export declare const designSystemStyles: import("lit").CSSResult;