@leavittsoftware/web 2.26.0 → 2.27.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leavittsoftware/web",
3
- "version": "2.26.0",
3
+ "version": "2.27.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "files": [
@@ -40,5 +40,5 @@
40
40
  "url": "https://github.com/LeavittSoftware/titanium-elements/issues"
41
41
  },
42
42
  "homepage": "https://github.com/LeavittSoftware/titanium-elements/#readme",
43
- "gitHead": "d2f127c47727f67637cd6319879906b71fb554e2"
43
+ "gitHead": "7a023a67172ba9f62184df98a019cbf5874e44b3"
44
44
  }
@@ -0,0 +1,44 @@
1
+ import { Person } from '@leavittsoftware/lg-core-typescript';
2
+ import { LitElement, PropertyValues } from 'lit';
3
+ import '@leavittsoftware/web/leavitt/profile-picture/profile-picture';
4
+ import '@material/web/icon/icon';
5
+ /**
6
+ * A smart profile picture stack component
7
+ *
8
+ * @element titanium-profile-picture-stack
9
+ *
10
+ */
11
+ export declare class TitaniumProfilePictureStack extends LitElement {
12
+ #private;
13
+ /**
14
+ * Array of people to display in a stack.
15
+ */
16
+ accessor people: Array<Partial<Person | null | undefined>>;
17
+ /**
18
+ * Number to define the max number of people to display in a stack.
19
+ */
20
+ accessor max: number;
21
+ /**
22
+ * Enable a link to directory for each person visible in the stack.
23
+ * This will open a new tab to the directory profile of the person.
24
+ * This will only work if the person has an Id.
25
+ */
26
+ accessor enableDirectoryHref: boolean;
27
+ /**
28
+ * Enable auto resizing of the profile picture stack. Setting this will supersede the max property.
29
+ */
30
+ accessor autoResize: boolean;
31
+ /**
32
+ * Size of the profile picture.
33
+ */
34
+ accessor size: number;
35
+ /**
36
+ * Used internally by the resize observer to keep track of the max number of people to display in a stack.
37
+ * @ignore
38
+ */
39
+ private accessor autoMax;
40
+ updated(changedProperties: PropertyValues<this>): void;
41
+ static styles: import("lit").CSSResult[];
42
+ render(): import("lit-html").TemplateResult<1>;
43
+ }
44
+ //# sourceMappingURL=profile-picture-stack.d.ts.map
@@ -0,0 +1,166 @@
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement, nothing } from 'lit';
3
+ import { property, customElement, state } from 'lit/decorators.js';
4
+ import { isDevelopment } from '../helpers/is-development';
5
+ import { p } from '../styles/p';
6
+ import { ellipsis } from '../styles/ellipsis';
7
+ import '@leavittsoftware/web/leavitt/profile-picture/profile-picture';
8
+ import '@material/web/icon/icon';
9
+ /**
10
+ * A smart profile picture stack component
11
+ *
12
+ * @element titanium-profile-picture-stack
13
+ *
14
+ */
15
+ let TitaniumProfilePictureStack = class TitaniumProfilePictureStack extends LitElement {
16
+ #people_accessor_storage;
17
+ /**
18
+ * Array of people to display in a stack.
19
+ */
20
+ get people() { return this.#people_accessor_storage; }
21
+ set people(value) { this.#people_accessor_storage = value; }
22
+ #max_accessor_storage = 5;
23
+ /**
24
+ * Number to define the max number of people to display in a stack.
25
+ */
26
+ get max() { return this.#max_accessor_storage; }
27
+ set max(value) { this.#max_accessor_storage = value; }
28
+ #enableDirectoryHref_accessor_storage = false;
29
+ /**
30
+ * Enable a link to directory for each person visible in the stack.
31
+ * This will open a new tab to the directory profile of the person.
32
+ * This will only work if the person has an Id.
33
+ */
34
+ get enableDirectoryHref() { return this.#enableDirectoryHref_accessor_storage; }
35
+ set enableDirectoryHref(value) { this.#enableDirectoryHref_accessor_storage = value; }
36
+ #autoResize_accessor_storage = false;
37
+ /**
38
+ * Enable auto resizing of the profile picture stack. Setting this will supersede the max property.
39
+ */
40
+ get autoResize() { return this.#autoResize_accessor_storage; }
41
+ set autoResize(value) { this.#autoResize_accessor_storage = value; }
42
+ #size_accessor_storage = 30;
43
+ /**
44
+ * Size of the profile picture.
45
+ */
46
+ get size() { return this.#size_accessor_storage; }
47
+ set size(value) { this.#size_accessor_storage = value; }
48
+ #autoMax_accessor_storage = 0;
49
+ /**
50
+ * Used internally by the resize observer to keep track of the max number of people to display in a stack.
51
+ * @ignore
52
+ */
53
+ get autoMax() { return this.#autoMax_accessor_storage; }
54
+ set autoMax(value) { this.#autoMax_accessor_storage = value; }
55
+ #resizeObserver;
56
+ updated(changedProperties) {
57
+ if (changedProperties.has('autoResize')) {
58
+ if (this.autoResize) {
59
+ this.#setUpResizeObserver();
60
+ }
61
+ else {
62
+ this.#resizeObserver?.disconnect?.();
63
+ }
64
+ }
65
+ }
66
+ #setUpResizeObserver() {
67
+ this.#resizeObserver = new ResizeObserver((entries) => {
68
+ for (const entry of entries) {
69
+ if (entry.contentBoxSize) {
70
+ const inlineSize = entry.contentBoxSize[0].inlineSize;
71
+ this.autoMax = Math.floor(inlineSize / this.size);
72
+ }
73
+ }
74
+ });
75
+ this.#resizeObserver.observe(this);
76
+ }
77
+ static { this.styles = [
78
+ p,
79
+ ellipsis,
80
+ css `
81
+ :host {
82
+ display: flex;
83
+ flex-direction: row;
84
+ position: relative;
85
+ align-self: start;
86
+ }
87
+
88
+ profile-picture {
89
+ transition: all 0.2s ease-in-out;
90
+ transform-origin: bottom;
91
+ background-color: var(--titanium-profile-picture-stack-bg-color, var(--md-sys-color-surface));
92
+ border-radius: 50%;
93
+ border: 2px solid transparent;
94
+ }
95
+
96
+ profile-picture:not(:first-child) {
97
+ margin-left: -10px;
98
+ }
99
+
100
+ profile-picture:hover {
101
+ transform: scale(var(--titanium-profile-picture-stack-transform-scale, 1.3));
102
+ position: relative;
103
+ z-index: 1;
104
+ }
105
+
106
+ md-icon {
107
+ font-size: 12px;
108
+ height: 7px;
109
+ margin-top: 25px;
110
+ margin-left: -4px;
111
+ }
112
+
113
+ p {
114
+ align-self: center;
115
+ margin-left: 8px;
116
+ }
117
+
118
+ :host([enable-directory-href]) profile-picture {
119
+ cursor: pointer;
120
+ }
121
+ `,
122
+ ]; }
123
+ render() {
124
+ const max = this.autoResize ? this.autoMax : this.max;
125
+ return html `
126
+ ${this.people?.slice(0, max)?.map((o) => html `
127
+ <profile-picture
128
+ @click=${() => {
129
+ if (this.enableDirectoryHref && o?.Id) {
130
+ window.open(`https://${isDevelopment ? 'dev' : ''}directory.leavitt.com/profile/${o?.Id}`, '_blank');
131
+ }
132
+ }}
133
+ title=${o?.FullName ?? ''}
134
+ size=${this.size}
135
+ .fileName=${o?.ProfilePictureCdnFileName ?? null}
136
+ part="profile-picture"
137
+ ></profile-picture>
138
+ ${this.people?.length === 1 ? html `<p part="name" ellipsis>${o?.FullName ?? ''}</p>` : nothing}
139
+ `)}
140
+ ${this.people?.length > max ? html `<md-icon part="more-icon" title="Shared with ${this.people.length} total users">more_horiz</md-icon>` : nothing}
141
+ `;
142
+ }
143
+ };
144
+ __decorate([
145
+ property({ type: Array })
146
+ ], TitaniumProfilePictureStack.prototype, "people", null);
147
+ __decorate([
148
+ property({ type: Number })
149
+ ], TitaniumProfilePictureStack.prototype, "max", null);
150
+ __decorate([
151
+ property({ type: Boolean, attribute: 'enable-directory-href' })
152
+ ], TitaniumProfilePictureStack.prototype, "enableDirectoryHref", null);
153
+ __decorate([
154
+ property({ type: Boolean, attribute: 'auto-resize' })
155
+ ], TitaniumProfilePictureStack.prototype, "autoResize", null);
156
+ __decorate([
157
+ property({ type: Number })
158
+ ], TitaniumProfilePictureStack.prototype, "size", null);
159
+ __decorate([
160
+ state()
161
+ ], TitaniumProfilePictureStack.prototype, "autoMax", null);
162
+ TitaniumProfilePictureStack = __decorate([
163
+ customElement('titanium-profile-picture-stack')
164
+ ], TitaniumProfilePictureStack);
165
+ export { TitaniumProfilePictureStack };
166
+ //# sourceMappingURL=profile-picture-stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-picture-stack.js","sourceRoot":"","sources":["profile-picture-stack.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE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