@activecollab/components 2.0.424 → 2.0.426

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.
Files changed (32) hide show
  1. package/dist/cjs/components/Media/Media.js +45 -4
  2. package/dist/cjs/components/Media/Media.js.map +1 -1
  3. package/dist/cjs/components/Media/Styles.js +4 -1
  4. package/dist/cjs/components/Media/Styles.js.map +1 -1
  5. package/dist/cjs/components/PortableText/renderers.js +8 -2
  6. package/dist/cjs/components/PortableText/renderers.js.map +1 -1
  7. package/dist/cjs/components/PortableText/types.js.map +1 -1
  8. package/dist/cjs/presentation/shared/headers.js +5 -3
  9. package/dist/cjs/presentation/shared/headers.js.map +1 -1
  10. package/dist/esm/components/Media/Media.d.ts +9 -0
  11. package/dist/esm/components/Media/Media.d.ts.map +1 -1
  12. package/dist/esm/components/Media/Media.js +44 -3
  13. package/dist/esm/components/Media/Media.js.map +1 -1
  14. package/dist/esm/components/Media/Styles.d.ts +1 -0
  15. package/dist/esm/components/Media/Styles.d.ts.map +1 -1
  16. package/dist/esm/components/Media/Styles.js +4 -1
  17. package/dist/esm/components/Media/Styles.js.map +1 -1
  18. package/dist/esm/components/PortableText/renderers.d.ts.map +1 -1
  19. package/dist/esm/components/PortableText/renderers.js +8 -2
  20. package/dist/esm/components/PortableText/renderers.js.map +1 -1
  21. package/dist/esm/components/PortableText/types.d.ts +16 -0
  22. package/dist/esm/components/PortableText/types.d.ts.map +1 -1
  23. package/dist/esm/components/PortableText/types.js.map +1 -1
  24. package/dist/esm/presentation/shared/headers.d.ts +3 -1
  25. package/dist/esm/presentation/shared/headers.d.ts.map +1 -1
  26. package/dist/esm/presentation/shared/headers.js +5 -3
  27. package/dist/esm/presentation/shared/headers.js.map +1 -1
  28. package/dist/index.js +57 -6
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.min.js +1 -1
  31. package/dist/index.min.js.map +1 -1
  32. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26196,16 +26196,52 @@
26196
26196
  var StyledMedia = styled__default["default"].div.withConfig({
26197
26197
  displayName: "Styles__StyledMedia",
26198
26198
  componentId: "sc-zjz7mh-0"
26199
- })(["display:flex;flex-direction:column;gap:", ";width:100%;.c-media-frame{", "}.c-media-frame img{display:block;width:100%;height:auto;}"], SPACE.sm, function (_ref) {
26199
+ })(["display:flex;flex-direction:column;gap:", ";width:100%;.c-media-frame{width:fit-content;max-width:100%;margin-inline:auto;", "}.c-media-frame img{display:block;height:auto;", "}"], SPACE.sm, function (_ref) {
26200
26200
  var $bordered = _ref.$bordered;
26201
26201
  return $bordered && styled.css(["overflow:hidden;border:1px solid var(--border-primary);border-radius:", ";"], "0.5rem");
26202
+ }, function (_ref2) {
26203
+ var $sized = _ref2.$sized;
26204
+ return $sized ? styled.css(["max-width:100%;"]) : styled.css(["width:100%;"]);
26202
26205
  });
26203
26206
  StyledMedia.displayName = "StyledMedia";
26204
26207
 
26205
- var _excluded$q = ["src", "alt", "variant", "caption"];
26208
+ var _excluded$q = ["src", "alt", "variant", "caption", "width", "height", "density"];
26209
+ /** A tall image (height greater than width) is capped at this display height. */
26210
+ var MEDIA_PORTRAIT_MAX_HEIGHT = 680;
26211
+
26212
+ /**
26213
+ * The box the `<img>` is laid out in, in CSS pixels. A portrait image taller
26214
+ * than the cap is scaled down to the cap, keeping its aspect ratio. Resolving
26215
+ * the cap here — rather than with `width: auto; max-height` in CSS — keeps the
26216
+ * size independent of the file's natural pixel size, so a 2x capture without a
26217
+ * `density` (and therefore no `srcset` descriptor) never renders upscaled.
26218
+ */
26219
+ var displaySize = function displaySize(width, height) {
26220
+ if (width == null || height == null) {
26221
+ return undefined;
26222
+ }
26223
+ if (height > width && height > MEDIA_PORTRAIT_MAX_HEIGHT) {
26224
+ return {
26225
+ width: Math.round(width * MEDIA_PORTRAIT_MAX_HEIGHT / height),
26226
+ height: MEDIA_PORTRAIT_MAX_HEIGHT
26227
+ };
26228
+ }
26229
+ return {
26230
+ width,
26231
+ height
26232
+ };
26233
+ };
26234
+
26206
26235
  /**
26207
26236
  * An image block: a screenshot renders framed (border, no shadow), a flat
26208
26237
  * illustration renders without a frame. The caption sits below the frame.
26238
+ *
26239
+ * `width`/`height` are the image's real display size in CSS pixels, measured
26240
+ * at compile time. When present, the image renders at that size — centered,
26241
+ * capped at the column width, never upscaled — and the `<img>` reserves the
26242
+ * space so the layout does not jump as it loads. A tall image (height greater
26243
+ * than width) is capped by height instead. When absent (e.g. a remote source
26244
+ * the build could not measure), the image falls back to the column-width cap.
26209
26245
  */
26210
26246
  var Media = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
26211
26247
  var src = _ref.src,
@@ -26213,15 +26249,23 @@
26213
26249
  _ref$variant = _ref.variant,
26214
26250
  variant = _ref$variant === void 0 ? "illustration" : _ref$variant,
26215
26251
  caption = _ref.caption,
26252
+ width = _ref.width,
26253
+ height = _ref.height,
26254
+ density = _ref.density,
26216
26255
  rest = _objectWithoutProperties(_ref, _excluded$q);
26256
+ var size = displaySize(width, height);
26217
26257
  return /*#__PURE__*/React__default["default"].createElement(StyledMedia, _extends({
26218
26258
  ref: ref,
26219
- $bordered: variant === "screenshot"
26259
+ $bordered: variant === "screenshot",
26260
+ $sized: size !== undefined
26220
26261
  }, rest), /*#__PURE__*/React__default["default"].createElement("div", {
26221
26262
  className: "c-media-frame"
26222
26263
  }, /*#__PURE__*/React__default["default"].createElement("img", {
26223
26264
  src: src,
26224
- alt: alt !== null && alt !== void 0 ? alt : ""
26265
+ alt: alt !== null && alt !== void 0 ? alt : "",
26266
+ width: size === null || size === void 0 ? void 0 : size.width,
26267
+ height: size === null || size === void 0 ? void 0 : size.height,
26268
+ srcSet: density ? "".concat(src, " ").concat(density, "x") : undefined
26225
26269
  })), caption ? /*#__PURE__*/React__default["default"].createElement(Caption1, {
26226
26270
  color: "secondary"
26227
26271
  }, caption) : null);
@@ -26413,7 +26457,10 @@
26413
26457
  src = _ref1.src,
26414
26458
  alt = _ref1.alt,
26415
26459
  variant = _ref1.variant,
26416
- caption = _ref1.caption;
26460
+ caption = _ref1.caption,
26461
+ width = _ref1.width,
26462
+ height = _ref1.height,
26463
+ density = _ref1.density;
26417
26464
 
26418
26465
  // Video (and future) variants carry service semantics, so their renderer
26419
26466
  // is application-catalog territory — an injected `media` override. The
@@ -26427,7 +26474,10 @@
26427
26474
  src: src,
26428
26475
  alt: alt,
26429
26476
  variant: variant,
26430
- caption: caption
26477
+ caption: caption,
26478
+ width: width,
26479
+ height: height,
26480
+ density: density
26431
26481
  });
26432
26482
  },
26433
26483
  "titled-text": function titledText(_ref10) {
@@ -31013,6 +31063,7 @@
31013
31063
  exports.ListSeparator = ListSeparator;
31014
31064
  exports.LockIcon = LockIcon$1;
31015
31065
  exports.LockSmallIcon = LockSmallIcon$1;
31066
+ exports.MEDIA_PORTRAIT_MAX_HEIGHT = MEDIA_PORTRAIT_MAX_HEIGHT;
31016
31067
  exports.MarkerIcon = MarkerIcon$1;
31017
31068
  exports.MeasuredPane = MeasuredPane;
31018
31069
  exports.Media = Media;