@leavittsoftware/web 4.11.2 → 4.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leavittsoftware/web",
3
- "version": "4.11.2",
3
+ "version": "4.12.0",
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": "d443c9be1597e5acd64ae9ac7854415d57579c52"
43
+ "gitHead": "acfa38b9a4de290bbff670cf80ffb7cf24cde209"
44
44
  }
@@ -1,7 +1,6 @@
1
1
  import { Person } from '@leavittsoftware/lg-core-typescript';
2
2
  import { LitElement, PropertyValues } from 'lit';
3
3
  import '@leavittsoftware/web/leavitt/profile-picture/profile-picture';
4
- import '@material/web/icon/icon';
5
4
  /**
6
5
  * A smart profile picture stack component
7
6
  *
@@ -32,6 +31,10 @@ export declare class TitaniumProfilePictureStack extends LitElement {
32
31
  * Size of the profile picture.
33
32
  */
34
33
  accessor size: number;
34
+ /**
35
+ * Size of the overlap between profile pictures. (Default is 8)
36
+ */
37
+ accessor overlap: number;
35
38
  /**
36
39
  * Used internally by the resize observer to keep track of the max number of people to display in a stack.
37
40
  * @ignore
@@ -5,7 +5,6 @@ import { isDevelopment } from '../helpers/is-development';
5
5
  import { p } from '../styles/p';
6
6
  import { ellipsis } from '../styles/ellipsis';
7
7
  import '@leavittsoftware/web/leavitt/profile-picture/profile-picture';
8
- import '@material/web/icon/icon';
9
8
  /**
10
9
  * A smart profile picture stack component
11
10
  *
@@ -45,6 +44,12 @@ let TitaniumProfilePictureStack = class TitaniumProfilePictureStack extends LitE
45
44
  */
46
45
  get size() { return this.#size_accessor_storage; }
47
46
  set size(value) { this.#size_accessor_storage = value; }
47
+ #overlap_accessor_storage = 8;
48
+ /**
49
+ * Size of the overlap between profile pictures. (Default is 8)
50
+ */
51
+ get overlap() { return this.#overlap_accessor_storage; }
52
+ set overlap(value) { this.#overlap_accessor_storage = value; }
48
53
  #autoMax_accessor_storage = 0;
49
54
  /**
50
55
  * Used internally by the resize observer to keep track of the max number of people to display in a stack.
@@ -62,57 +67,74 @@ let TitaniumProfilePictureStack = class TitaniumProfilePictureStack extends LitE
62
67
  this.#resizeObserver?.disconnect?.();
63
68
  }
64
69
  }
70
+ if (changedProperties.has('overlap')) {
71
+ this.style.setProperty('--profile-picture-stack-overlap', `${this.overlap}px`);
72
+ }
65
73
  }
66
74
  #setUpResizeObserver() {
67
75
  this.#resizeObserver = new ResizeObserver((entries) => {
68
76
  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
- }
77
+ this.autoMax = this.#calculateMaxElements(this.size, this.overlap, entry?.contentBoxSize?.[0]?.inlineSize || 0);
73
78
  }
74
79
  });
75
80
  this.#resizeObserver.observe(this);
76
81
  }
82
+ #calculateMaxElements(elementWidth, overlap, totalWidth) {
83
+ if (totalWidth < elementWidth) {
84
+ return 0; // If total width is smaller than one element
85
+ }
86
+ return Math.floor((totalWidth - elementWidth) / (elementWidth - overlap));
87
+ }
77
88
  static { this.styles = [
78
89
  p,
79
90
  ellipsis,
80
91
  css `
81
92
  :host {
82
93
  display: flex;
83
- flex-direction: row;
84
- position: relative;
85
- align-self: start;
94
+ padding-left: var(--profile-picture-stack-overlap, 10px);
95
+ flex-direction: row-reverse;
96
+ justify-content: flex-end;
86
97
  }
87
98
 
88
99
  profile-picture {
89
- transition: all 0.2s ease-in-out;
100
+ box-sizing: border-box;
101
+ transition: all 0.25s ease-in-out;
90
102
  transform-origin: bottom;
91
103
  background-color: var(--titanium-profile-picture-stack-bg-color, var(--md-sys-color-surface));
92
104
  border-radius: 50%;
93
105
  border: 2px solid transparent;
94
106
  }
95
107
 
96
- profile-picture:not(:first-child) {
97
- margin-left: -10px;
98
- }
99
-
100
108
  profile-picture:hover {
101
- transform: scale(var(--titanium-profile-picture-stack-transform-scale, 1.3));
102
- position: relative;
109
+ transform: translateY(-5px);
103
110
  z-index: 1;
104
111
  }
105
112
 
106
- md-icon {
107
- font-size: 12px;
108
- height: 7px;
109
- margin-top: 25px;
110
- margin-left: -4px;
113
+ p[full-name] {
114
+ align-self: center;
115
+ margin-left: 6px;
111
116
  }
112
117
 
113
- p {
114
- align-self: center;
115
- margin-left: 8px;
118
+ additional-users {
119
+ display: grid;
120
+ box-sizing: border-box;
121
+ transition: all 0.25s ease-in-out;
122
+ border-radius: 50%;
123
+ background: var(--md-sys-color-surface-container);
124
+ place-items: center;
125
+ border: 2px solid transparent;
126
+ cursor: default;
127
+ }
128
+
129
+ additional-users p {
130
+ font-weight: 500;
131
+ font-size: 13px;
132
+ max-width: 75%;
133
+ }
134
+
135
+ additional-users:hover {
136
+ transform: translateY(-5px);
137
+ z-index: 1;
116
138
  }
117
139
 
118
140
  :host([enable-directory-href]) profile-picture {
@@ -123,21 +145,33 @@ let TitaniumProfilePictureStack = class TitaniumProfilePictureStack extends LitE
123
145
  render() {
124
146
  const max = this.autoResize ? this.autoMax : this.max;
125
147
  return html `
126
- ${this.people?.slice(0, max)?.map((o) => html `
127
- <profile-picture
128
- @click=${() => {
148
+ ${this.people?.length > max
149
+ ? html `<additional-users
150
+ style="width:${this.size}px;height:${this.size}px;margin-left:-${this.overlap}px"
151
+ part="additional-users"
152
+ title="${(this.people?.length || 0) - max} more"
153
+ >
154
+ <p ellipsis>+${(this.people?.length || 0) - max}</p>
155
+ </additional-users>`
156
+ : nothing}
157
+ ${this.people
158
+ ?.slice(0, max)
159
+ ?.reverse()
160
+ ?.map((o) => html `
161
+ ${this.people?.length === 1 ? html `<p part="name" ellipsis full-name>${o?.FullName ?? ''}</p>` : nothing}
162
+ <profile-picture
163
+ @click=${() => {
129
164
  if (this.enableDirectoryHref && o?.Id) {
130
165
  window.open(`https://${isDevelopment ? 'dev' : ''}directory.leavitt.com/profile/${o?.Id}`, '_blank');
131
166
  }
132
167
  }}
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}
168
+ title=${o?.FullName ?? ''}
169
+ size=${this.size}
170
+ style="margin-left:-${this.overlap}px;"
171
+ .fileName=${o?.ProfilePictureCdnFileName ?? null}
172
+ part="profile-picture"
173
+ ></profile-picture>
174
+ `)}
141
175
  `;
142
176
  }
143
177
  };
@@ -156,6 +190,9 @@ __decorate([
156
190
  __decorate([
157
191
  property({ type: Number })
158
192
  ], TitaniumProfilePictureStack.prototype, "size", null);
193
+ __decorate([
194
+ property({ type: Number })
195
+ ], TitaniumProfilePictureStack.prototype, "overlap", null);
159
196
  __decorate([
160
197
  state()
161
198
  ], TitaniumProfilePictureStack.prototype, "autoMax", null);
@@ -1 +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,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,8DAA8D,CAAC;AACtE,OAAO,yBAAyB,CAAC;AAEjC;;;;;GAKG;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