@dereekb/dbx-web 13.31.0 → 13.33.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/eslint/package.json +4 -4
- package/fesm2022/dereekb-dbx-web-mapbox.mjs +1 -1
- package/fesm2022/dereekb-dbx-web-mapbox.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-web-style-demo.mjs +2 -2
- package/fesm2022/dereekb-dbx-web-style-demo.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-web-table.mjs +1 -1
- package/fesm2022/dereekb-dbx-web-table.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-web.mjs +116 -20
- package/fesm2022/dereekb-dbx-web.mjs.map +1 -1
- package/lib/layout/avatar/_avatar.scss +112 -35
- package/package.json +7 -7
- package/types/dereekb-dbx-web.d.ts +347 -209
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// MARK: Variables
|
|
5
5
|
$icon-to-avatar-size-ratio: 0.65;
|
|
6
6
|
$initials-to-avatar-size-ratio: 0.4;
|
|
7
|
+
$tile-padding-to-avatar-size-ratio: 0.15;
|
|
7
8
|
|
|
8
9
|
// MARK: Mixin
|
|
9
10
|
@mixin core() {
|
|
@@ -12,28 +13,41 @@ $initials-to-avatar-size-ratio: 0.4;
|
|
|
12
13
|
/// @role layout
|
|
13
14
|
/// @component DbxAvatarViewComponent
|
|
14
15
|
/// @scope component-class
|
|
15
|
-
/// @see-also avatar-small, avatar-large, avatar-view-circle, avatar-view-square
|
|
16
|
+
/// @see-also avatar-small, avatar-large, avatar-view-circle, avatar-view-square, avatar-view-tile
|
|
16
17
|
.dbx-avatar-view {
|
|
18
|
+
/// Resolved avatar box size. Every avatar measurement derives from this one value so the small/large
|
|
19
|
+
/// variants and the tile presentation each have a single number to scale from. Apps override the
|
|
20
|
+
/// public `--dbx-avatar-size` (or the small/large tokens) rather than this.
|
|
21
|
+
/// @role size
|
|
22
|
+
/// @intent resolved avatar size, current avatar diameter
|
|
23
|
+
--dbx-avatar-view-size: var(#{theming.$dbx-avatar-size-var}, 64px);
|
|
24
|
+
|
|
17
25
|
position: relative;
|
|
18
26
|
display: inline-flex;
|
|
19
27
|
align-items: center;
|
|
20
28
|
justify-content: center;
|
|
21
29
|
overflow: hidden;
|
|
22
|
-
width: var(
|
|
23
|
-
height: var(
|
|
30
|
+
width: var(--dbx-avatar-view-size);
|
|
31
|
+
height: var(--dbx-avatar-view-size);
|
|
32
|
+
background-color: color-mix(in srgb, var(--mat-sys-on-surface) 4%, transparent);
|
|
24
33
|
|
|
25
|
-
.mat-icon
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
// (0,3,0) so the glyph keeps its avatar-proportional size even when `.dbx-icon-tile .mat-icon`
|
|
35
|
+
// (0,2,0, and emitted later — see _layout.scss) also matches, i.e. in tile mode or when an
|
|
36
|
+
// avatar is nested inside an icon tile.
|
|
37
|
+
.dbx-avatar-view-fallback .mat-icon {
|
|
38
|
+
font-size: calc(var(--dbx-avatar-view-size) * #{$icon-to-avatar-size-ratio});
|
|
39
|
+
width: calc(var(--dbx-avatar-view-size) * #{$icon-to-avatar-size-ratio});
|
|
40
|
+
height: calc(var(--dbx-avatar-view-size) * #{$icon-to-avatar-size-ratio});
|
|
29
41
|
}
|
|
30
42
|
|
|
31
43
|
.dbx-avatar-view-initials {
|
|
32
|
-
font-size: calc(var(
|
|
44
|
+
font-size: calc(var(--dbx-avatar-view-size) * #{$initials-to-avatar-size-ratio});
|
|
33
45
|
}
|
|
34
46
|
}
|
|
35
47
|
|
|
36
|
-
|
|
48
|
+
// (0,2,0): `.dbx-icon-tile { display: flex }` is emitted after this partial and would otherwise
|
|
49
|
+
// win, leaving `hideOnError` unable to hide a tile-mode avatar.
|
|
50
|
+
.dbx-avatar-view.dbx-avatar-view-hide-avatar {
|
|
37
51
|
display: none;
|
|
38
52
|
}
|
|
39
53
|
|
|
@@ -43,18 +57,7 @@ $initials-to-avatar-size-ratio: 0.4;
|
|
|
43
57
|
/// @parent avatar-view
|
|
44
58
|
/// @see-also avatar-view, avatar-large
|
|
45
59
|
.dbx-avatar-small .dbx-avatar-view {
|
|
46
|
-
|
|
47
|
-
height: var(#{theming.$dbx-avatar-small-size-var}, 32px);
|
|
48
|
-
|
|
49
|
-
.mat-icon {
|
|
50
|
-
font-size: calc(var(#{theming.$dbx-avatar-small-size-var}, 32px) * #{$icon-to-avatar-size-ratio});
|
|
51
|
-
width: calc(var(#{theming.$dbx-avatar-small-size-var}, 32px) * #{$icon-to-avatar-size-ratio});
|
|
52
|
-
height: calc(var(#{theming.$dbx-avatar-small-size-var}, 32px) * #{$icon-to-avatar-size-ratio});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.dbx-avatar-view-initials {
|
|
56
|
-
font-size: calc(var(#{theming.$dbx-avatar-small-size-var}, 32px) * #{$initials-to-avatar-size-ratio});
|
|
57
|
-
}
|
|
60
|
+
--dbx-avatar-view-size: var(#{theming.$dbx-avatar-small-size-var}, 32px);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
/// @dbx-utility avatar-large
|
|
@@ -63,18 +66,7 @@ $initials-to-avatar-size-ratio: 0.4;
|
|
|
63
66
|
/// @parent avatar-view
|
|
64
67
|
/// @see-also avatar-view, avatar-small
|
|
65
68
|
.dbx-avatar-large .dbx-avatar-view {
|
|
66
|
-
|
|
67
|
-
height: var(#{theming.$dbx-avatar-large-size-var}, 128px);
|
|
68
|
-
|
|
69
|
-
.mat-icon {
|
|
70
|
-
font-size: calc(var(#{theming.$dbx-avatar-large-size-var}, 128px) * #{$icon-to-avatar-size-ratio});
|
|
71
|
-
width: calc(var(#{theming.$dbx-avatar-large-size-var}, 128px) * #{$icon-to-avatar-size-ratio});
|
|
72
|
-
height: calc(var(#{theming.$dbx-avatar-large-size-var}, 128px) * #{$icon-to-avatar-size-ratio});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.dbx-avatar-view-initials {
|
|
76
|
-
font-size: calc(var(#{theming.$dbx-avatar-large-size-var}, 128px) * #{$initials-to-avatar-size-ratio});
|
|
77
|
-
}
|
|
69
|
+
--dbx-avatar-view-size: var(#{theming.$dbx-avatar-large-size-var}, 128px);
|
|
78
70
|
}
|
|
79
71
|
|
|
80
72
|
.dbx-avatar-view-img {
|
|
@@ -84,6 +76,16 @@ $initials-to-avatar-size-ratio: 0.4;
|
|
|
84
76
|
display: block;
|
|
85
77
|
}
|
|
86
78
|
|
|
79
|
+
/// @dbx-utility avatar-view-img-contain
|
|
80
|
+
/// @intent fits the whole avatar image inside the box instead of cropping it — the default in tile mode, where the image is a brand logo
|
|
81
|
+
/// @role layout
|
|
82
|
+
/// @parent avatar-view
|
|
83
|
+
/// @component DbxAvatarViewComponent
|
|
84
|
+
/// @see-also avatar-view-tile
|
|
85
|
+
.dbx-avatar-view-img-contain {
|
|
86
|
+
object-fit: contain;
|
|
87
|
+
}
|
|
88
|
+
|
|
87
89
|
.dbx-avatar-view-fallback {
|
|
88
90
|
display: flex;
|
|
89
91
|
align-items: center;
|
|
@@ -117,6 +119,20 @@ $initials-to-avatar-size-ratio: 0.4;
|
|
|
117
119
|
@include style.dbx-color-surface();
|
|
118
120
|
}
|
|
119
121
|
|
|
122
|
+
// Colored avatar surface. `<dbx-avatar-view>` hosts `[dbxColor]` and pushes its resolved color into it, so
|
|
123
|
+
// the marker is on the avatar element itself. Scoped on the marker (the `mat-card.dbx-color` model) so an
|
|
124
|
+
// avatar inside a `[dbxColor]` section doesn't repaint from inherited tokens, and guarded with
|
|
125
|
+
// `:not(.dbx-default)` because a nullish color still resolves to the token-less `dbx-default` class.
|
|
126
|
+
// In tile mode `.dbx-icon-tile.dbx-color:not(.dbx-default)` in `_text.scss` matches the same element and
|
|
127
|
+
// paints identically — this rule covers the non-tile case.
|
|
128
|
+
.dbx-avatar-view.dbx-color:not(.dbx-default) {
|
|
129
|
+
@include style.dbx-color-surface();
|
|
130
|
+
|
|
131
|
+
&.dbx-color-tonal {
|
|
132
|
+
color: var(#{theming.$dbx-bg-color-var});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
120
136
|
/// @dbx-utility avatar-view-circle
|
|
121
137
|
/// @intent circle modifier for `.dbx-avatar-view` — `border-radius: 50%`
|
|
122
138
|
/// @role layout
|
|
@@ -135,8 +151,69 @@ $initials-to-avatar-size-ratio: 0.4;
|
|
|
135
151
|
border-radius: var(--dbx-avatar-square-container-shape, var(--mat-sys-corner-medium));
|
|
136
152
|
}
|
|
137
153
|
|
|
138
|
-
|
|
139
|
-
|
|
154
|
+
// MARK: Tile presentation
|
|
155
|
+
// `<dbx-avatar-view>` in tile mode carries `.dbx-icon-tile` alongside this marker, so every
|
|
156
|
+
// `--dbx-icon-tile-*` customization and the tile's `[dbxColor]` surface apply to the avatar as-is.
|
|
157
|
+
/// @dbx-utility avatar-view-tile
|
|
158
|
+
/// @intent icon-tile presentation for `.dbx-avatar-view` — the avatar keeps its box size while `.dbx-icon-tile` supplies padding, shape and the `[dbxColor]` surface. Customize with `--dbx-avatar-tile-padding` / `--dbx-avatar-tile-icon-size`.
|
|
159
|
+
/// @role layout
|
|
160
|
+
/// @parent avatar-view
|
|
161
|
+
/// @component DbxAvatarViewComponent
|
|
162
|
+
/// @see-also icon-tile, avatar-view, avatar-view-img-contain
|
|
163
|
+
// Points the tile's own tokens at avatar-scoped override points, so a tile avatar's padding and glyph
|
|
164
|
+
// scale with the avatar box instead of taking the icon tile's flat 8px/24px defaults.
|
|
165
|
+
//
|
|
166
|
+
// `--dbx-avatar-tile-*` are CONSUMED here, never declared: a declaration on this element would beat an
|
|
167
|
+
// inherited one and make an ancestor (or an inline style on `<dbx-avatar>`) unable to override them.
|
|
168
|
+
.dbx-avatar-view-tile {
|
|
169
|
+
/// Icon tile padding, as a tile avatar resolves it. See `--dbx-avatar-tile-padding` to override.
|
|
170
|
+
/// @role spacing
|
|
171
|
+
/// @intent icon tile padding, tile inset
|
|
172
|
+
--dbx-icon-tile-padding: var(--dbx-avatar-tile-padding, calc(var(--dbx-avatar-view-size) * #{$tile-padding-to-avatar-size-ratio}));
|
|
173
|
+
/// Icon tile glyph size, as a tile avatar resolves it. See `--dbx-avatar-tile-icon-size` to override.
|
|
174
|
+
/// @role size
|
|
175
|
+
/// @intent icon tile icon size, tile glyph size
|
|
176
|
+
--dbx-icon-tile-icon-size: var(--dbx-avatar-tile-icon-size, calc(var(--dbx-avatar-view-size) * #{$icon-to-avatar-size-ratio}));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// `.dbx-icon-tile` is emitted AFTER this partial (`_layout.scss` includes `avatar.core()` before
|
|
180
|
+
// `text.core()`), so it wins every (0,1,0) property the two share. Everything the avatar must keep
|
|
181
|
+
// owning is re-declared here at (0,2,0) rather than left to source order — in particular
|
|
182
|
+
// `width`/`height`, which the tile sets from the undefined `--dbx-icon-tile-width`/`-height` (no
|
|
183
|
+
// fallback, so the declaration is invalid at computed-value time), collapsing the box to `auto`;
|
|
184
|
+
// and `display`, which would otherwise also beat `.dbx-avatar-view-hide-avatar`.
|
|
185
|
+
// `:not(…)` rather than a bare `display: inline-flex` in the block below: `.dbx-avatar-view-hide-avatar`
|
|
186
|
+
// is also (0,2,0), so without it whichever rule happened to come last would decide whether a hidden
|
|
187
|
+
// tile avatar stays hidden.
|
|
188
|
+
.dbx-avatar-view.dbx-avatar-view-tile:not(.dbx-avatar-view-hide-avatar) {
|
|
189
|
+
display: inline-flex;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.dbx-avatar-view.dbx-avatar-view-tile {
|
|
193
|
+
box-sizing: border-box;
|
|
194
|
+
width: var(--dbx-avatar-view-size);
|
|
195
|
+
height: var(--dbx-avatar-view-size);
|
|
196
|
+
min-width: var(--dbx-avatar-view-size);
|
|
197
|
+
// an uncolored tile paints nothing, matching `<dbx-icon-tile>`
|
|
198
|
+
background-color: transparent;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Shape in tile mode. Without these the tile's own `border-radius` would win over the style modifiers
|
|
202
|
+
// and silently ignore `--dbx-avatar-square-container-shape`.
|
|
203
|
+
.dbx-avatar-view.dbx-avatar-view-tile.dbx-avatar-view-circle {
|
|
204
|
+
border-radius: 50%;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.dbx-avatar-view.dbx-avatar-view-tile.dbx-avatar-view-square {
|
|
208
|
+
border-radius: var(--dbx-avatar-square-container-shape, var(--mat-sys-corner-medium));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// (0,4,0), so the tile's glyph size wins over the avatar's own (0,3,0) proportional rule above.
|
|
212
|
+
// Without this the tile token resolves but is never read, and `--dbx-avatar-tile-icon-size` is dead.
|
|
213
|
+
.dbx-avatar-view.dbx-avatar-view-tile .dbx-avatar-view-fallback .mat-icon {
|
|
214
|
+
font-size: var(--dbx-icon-tile-icon-size);
|
|
215
|
+
width: var(--dbx-icon-tile-icon-size);
|
|
216
|
+
height: var(--dbx-icon-tile-icon-size);
|
|
140
217
|
}
|
|
141
218
|
}
|
|
142
219
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-web",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.33.0",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.scss",
|
|
6
6
|
"*.css"
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"@angular/material": "^21.2.9",
|
|
14
14
|
"@angular/platform-browser": "21.2.11",
|
|
15
15
|
"@cantoo/pdf-lib": "^2.6.5",
|
|
16
|
-
"@dereekb/browser": "13.
|
|
17
|
-
"@dereekb/date": "13.
|
|
18
|
-
"@dereekb/dbx-core": "13.
|
|
19
|
-
"@dereekb/rxjs": "13.
|
|
20
|
-
"@dereekb/util": "13.
|
|
21
|
-
"@dereekb/vitest": "13.
|
|
16
|
+
"@dereekb/browser": "13.33.0",
|
|
17
|
+
"@dereekb/date": "13.33.0",
|
|
18
|
+
"@dereekb/dbx-core": "13.33.0",
|
|
19
|
+
"@dereekb/rxjs": "13.33.0",
|
|
20
|
+
"@dereekb/util": "13.33.0",
|
|
21
|
+
"@dereekb/vitest": "13.33.0",
|
|
22
22
|
"@ngbracket/ngx-layout": "^21.0.0",
|
|
23
23
|
"@ngrx/component-store": "^21.1.0",
|
|
24
24
|
"@ngrx/effects": "^21.1.0",
|