design-zystem 1.0.298 → 1.0.300

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/dist/index.d.mts CHANGED
@@ -337,6 +337,7 @@ interface IconProps {
337
337
  onClick?: () => void;
338
338
  className?: string;
339
339
  style?: CSSProperties;
340
+ title?: string;
340
341
  }
341
342
  declare const Icon: (props: IconProps) => react_jsx_runtime.JSX.Element;
342
343
 
@@ -389,6 +390,18 @@ interface AvatarBadge {
389
390
  family?: 'solid' | 'regular' | 'light' | 'brands';
390
391
  backgroundColor?: string;
391
392
  iconColor?: string;
393
+ label?: string;
394
+ }
395
+ interface AvatarPhotoBadge {
396
+ name: string;
397
+ src?: string | null;
398
+ backgroundColor?: string;
399
+ textColor?: string;
400
+ }
401
+ interface AvatarIcon {
402
+ name: string;
403
+ family?: 'solid' | 'regular' | 'light' | 'brands';
404
+ color?: string;
392
405
  }
393
406
  interface AvatarProps {
394
407
  name: string;
@@ -397,9 +410,14 @@ interface AvatarProps {
397
410
  textColor?: string;
398
411
  size?: number;
399
412
  shape?: 'circle' | 'square';
413
+ /** `contain` fits a wide picture — a vehicle, a logo — instead of cropping it to the square. */
414
+ objectFit?: string;
415
+ /** Stands in for a subject that has no portrait — an invoice, a document. `src` wins over it, it wins over the initials. */
416
+ icon?: AvatarIcon | null;
400
417
  badge?: AvatarBadge | null;
418
+ avatarBadge?: AvatarPhotoBadge | null;
401
419
  }
402
- declare const Avatar: ({ name, src, backgroundColor, textColor, size, shape, badge, }: AvatarProps) => react_jsx_runtime.JSX.Element;
420
+ declare const Avatar: ({ name, src, backgroundColor, textColor, size, shape, objectFit, icon, badge, avatarBadge, }: AvatarProps) => react_jsx_runtime.JSX.Element;
403
421
 
404
422
  interface ButtonProps extends HTMLAttributes<HTMLButtonElement> {
405
423
  label?: string;
package/dist/index.d.ts CHANGED
@@ -337,6 +337,7 @@ interface IconProps {
337
337
  onClick?: () => void;
338
338
  className?: string;
339
339
  style?: CSSProperties;
340
+ title?: string;
340
341
  }
341
342
  declare const Icon: (props: IconProps) => react_jsx_runtime.JSX.Element;
342
343
 
@@ -389,6 +390,18 @@ interface AvatarBadge {
389
390
  family?: 'solid' | 'regular' | 'light' | 'brands';
390
391
  backgroundColor?: string;
391
392
  iconColor?: string;
393
+ label?: string;
394
+ }
395
+ interface AvatarPhotoBadge {
396
+ name: string;
397
+ src?: string | null;
398
+ backgroundColor?: string;
399
+ textColor?: string;
400
+ }
401
+ interface AvatarIcon {
402
+ name: string;
403
+ family?: 'solid' | 'regular' | 'light' | 'brands';
404
+ color?: string;
392
405
  }
393
406
  interface AvatarProps {
394
407
  name: string;
@@ -397,9 +410,14 @@ interface AvatarProps {
397
410
  textColor?: string;
398
411
  size?: number;
399
412
  shape?: 'circle' | 'square';
413
+ /** `contain` fits a wide picture — a vehicle, a logo — instead of cropping it to the square. */
414
+ objectFit?: string;
415
+ /** Stands in for a subject that has no portrait — an invoice, a document. `src` wins over it, it wins over the initials. */
416
+ icon?: AvatarIcon | null;
400
417
  badge?: AvatarBadge | null;
418
+ avatarBadge?: AvatarPhotoBadge | null;
401
419
  }
402
- declare const Avatar: ({ name, src, backgroundColor, textColor, size, shape, badge, }: AvatarProps) => react_jsx_runtime.JSX.Element;
420
+ declare const Avatar: ({ name, src, backgroundColor, textColor, size, shape, objectFit, icon, badge, avatarBadge, }: AvatarProps) => react_jsx_runtime.JSX.Element;
403
421
 
404
422
  interface ButtonProps extends HTMLAttributes<HTMLButtonElement> {
405
423
  label?: string;
package/dist/index.js CHANGED
@@ -2254,6 +2254,21 @@ var BadgeIcon = import_styled_components18.default.i`
2254
2254
  font-size: ${(props) => Math.round(props.$size * 0.2)}px;
2255
2255
  line-height: 2;
2256
2256
  `;
2257
+ var AvatarBadgeSlot = import_styled_components18.default.div`
2258
+ position: absolute;
2259
+ right: 0;
2260
+ bottom: 0;
2261
+ padding: ${(props) => Math.max(1, Math.round(props.$size * 0.05))}px;
2262
+ background-color: ${colors.white};
2263
+ border-radius: 50%;
2264
+ box-shadow: 0 2px 6px ${colors.blue_950}66;
2265
+ line-height: 0;
2266
+ `;
2267
+ var MainIcon = import_styled_components18.default.i`
2268
+ color: ${(props) => props.$color};
2269
+ font-size: ${(props) => Math.round(props.$size * 0.45)}px;
2270
+ line-height: 1;
2271
+ `;
2257
2272
  var Initials = import_styled_components18.default.span`
2258
2273
  color: ${(props) => props.$textColor};
2259
2274
  font-weight: 600;
@@ -2273,9 +2288,12 @@ var Avatar = ({
2273
2288
  textColor,
2274
2289
  size = 56,
2275
2290
  shape = "circle",
2276
- badge
2291
+ objectFit,
2292
+ icon,
2293
+ badge,
2294
+ avatarBadge
2277
2295
  }) => {
2278
- var _a, _b, _c;
2296
+ var _a, _b, _c, _d;
2279
2297
  const [hasImageError, setHasImageError] = (0, import_react10.useState)(false);
2280
2298
  const resolvedBackground = resolveColor3(backgroundColor, colors.grey_300);
2281
2299
  const resolvedText = resolveColor3(textColor, colors.dark);
@@ -2297,19 +2315,47 @@ var Avatar = ({
2297
2315
  width: sizePx,
2298
2316
  height: sizePx,
2299
2317
  borderRadius,
2318
+ objectFit,
2300
2319
  onError: () => setHasImageError(true)
2301
2320
  }
2321
+ ) : icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2322
+ MainIcon,
2323
+ {
2324
+ $size: size,
2325
+ $color: resolveColor3(icon.color, resolvedText),
2326
+ className: `fa-${(_a = icon.family) != null ? _a : "regular"} fa-${icon.name}`,
2327
+ role: "img",
2328
+ "aria-label": name
2329
+ }
2302
2330
  ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Initials, { $textColor: resolvedText, $size: size, children: initials })
2303
2331
  }
2304
2332
  ),
2305
- badge && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BadgeSlot, { $size: size, $bg: (_a = badge.backgroundColor) != null ? _a : colors.white, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2306
- BadgeIcon,
2333
+ avatarBadge ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AvatarBadgeSlot, { $size: size, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2334
+ Avatar,
2335
+ {
2336
+ name: avatarBadge.name,
2337
+ src: avatarBadge.src,
2338
+ backgroundColor: avatarBadge.backgroundColor,
2339
+ textColor: avatarBadge.textColor,
2340
+ size: Math.round(size * 0.4)
2341
+ }
2342
+ ) }) : badge && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2343
+ BadgeSlot,
2307
2344
  {
2308
2345
  $size: size,
2309
- $color: (_b = badge.iconColor) != null ? _b : colors.blue_950,
2310
- className: `fa-${(_c = badge.family) != null ? _c : "regular"} fa-${badge.name}`
2346
+ $bg: (_b = badge.backgroundColor) != null ? _b : colors.white,
2347
+ title: badge.label,
2348
+ "aria-label": badge.label,
2349
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2350
+ BadgeIcon,
2351
+ {
2352
+ $size: size,
2353
+ $color: (_c = badge.iconColor) != null ? _c : colors.blue_950,
2354
+ className: `fa-${(_d = badge.family) != null ? _d : "regular"} fa-${badge.name}`
2355
+ }
2356
+ )
2311
2357
  }
2312
- ) })
2358
+ )
2313
2359
  ] });
2314
2360
  };
2315
2361
 
package/dist/index.mjs CHANGED
@@ -2113,6 +2113,21 @@ var BadgeIcon = styled18.i`
2113
2113
  font-size: ${(props) => Math.round(props.$size * 0.2)}px;
2114
2114
  line-height: 2;
2115
2115
  `;
2116
+ var AvatarBadgeSlot = styled18.div`
2117
+ position: absolute;
2118
+ right: 0;
2119
+ bottom: 0;
2120
+ padding: ${(props) => Math.max(1, Math.round(props.$size * 0.05))}px;
2121
+ background-color: ${colors.white};
2122
+ border-radius: 50%;
2123
+ box-shadow: 0 2px 6px ${colors.blue_950}66;
2124
+ line-height: 0;
2125
+ `;
2126
+ var MainIcon = styled18.i`
2127
+ color: ${(props) => props.$color};
2128
+ font-size: ${(props) => Math.round(props.$size * 0.45)}px;
2129
+ line-height: 1;
2130
+ `;
2116
2131
  var Initials = styled18.span`
2117
2132
  color: ${(props) => props.$textColor};
2118
2133
  font-weight: 600;
@@ -2132,9 +2147,12 @@ var Avatar = ({
2132
2147
  textColor,
2133
2148
  size = 56,
2134
2149
  shape = "circle",
2135
- badge
2150
+ objectFit,
2151
+ icon,
2152
+ badge,
2153
+ avatarBadge
2136
2154
  }) => {
2137
- var _a, _b, _c;
2155
+ var _a, _b, _c, _d;
2138
2156
  const [hasImageError, setHasImageError] = useState5(false);
2139
2157
  const resolvedBackground = resolveColor3(backgroundColor, colors.grey_300);
2140
2158
  const resolvedText = resolveColor3(textColor, colors.dark);
@@ -2156,19 +2174,47 @@ var Avatar = ({
2156
2174
  width: sizePx,
2157
2175
  height: sizePx,
2158
2176
  borderRadius,
2177
+ objectFit,
2159
2178
  onError: () => setHasImageError(true)
2160
2179
  }
2180
+ ) : icon ? /* @__PURE__ */ jsx22(
2181
+ MainIcon,
2182
+ {
2183
+ $size: size,
2184
+ $color: resolveColor3(icon.color, resolvedText),
2185
+ className: `fa-${(_a = icon.family) != null ? _a : "regular"} fa-${icon.name}`,
2186
+ role: "img",
2187
+ "aria-label": name
2188
+ }
2161
2189
  ) : /* @__PURE__ */ jsx22(Initials, { $textColor: resolvedText, $size: size, children: initials })
2162
2190
  }
2163
2191
  ),
2164
- badge && /* @__PURE__ */ jsx22(BadgeSlot, { $size: size, $bg: (_a = badge.backgroundColor) != null ? _a : colors.white, children: /* @__PURE__ */ jsx22(
2165
- BadgeIcon,
2192
+ avatarBadge ? /* @__PURE__ */ jsx22(AvatarBadgeSlot, { $size: size, children: /* @__PURE__ */ jsx22(
2193
+ Avatar,
2194
+ {
2195
+ name: avatarBadge.name,
2196
+ src: avatarBadge.src,
2197
+ backgroundColor: avatarBadge.backgroundColor,
2198
+ textColor: avatarBadge.textColor,
2199
+ size: Math.round(size * 0.4)
2200
+ }
2201
+ ) }) : badge && /* @__PURE__ */ jsx22(
2202
+ BadgeSlot,
2166
2203
  {
2167
2204
  $size: size,
2168
- $color: (_b = badge.iconColor) != null ? _b : colors.blue_950,
2169
- className: `fa-${(_c = badge.family) != null ? _c : "regular"} fa-${badge.name}`
2205
+ $bg: (_b = badge.backgroundColor) != null ? _b : colors.white,
2206
+ title: badge.label,
2207
+ "aria-label": badge.label,
2208
+ children: /* @__PURE__ */ jsx22(
2209
+ BadgeIcon,
2210
+ {
2211
+ $size: size,
2212
+ $color: (_c = badge.iconColor) != null ? _c : colors.blue_950,
2213
+ className: `fa-${(_d = badge.family) != null ? _d : "regular"} fa-${badge.name}`
2214
+ }
2215
+ )
2170
2216
  }
2171
- ) })
2217
+ )
2172
2218
  ] });
2173
2219
  };
2174
2220
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "design-zystem",
3
- "version": "1.0.298",
3
+ "version": "1.0.300",
4
4
  "description": "A React design system of importable components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",