@micromag/screen-timeline 0.3.769 → 0.3.779

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.
@@ -1 +1 @@
1
- .micromag-screen-timeline-container .micromag-screen-timeline-background{height:100%;left:0;position:absolute;top:0;width:100%}.micromag-screen-timeline-container .micromag-screen-timeline-empty{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-timeline-container{position:relative}.micromag-screen-timeline-container .micromag-screen-timeline-background{z-index:0}.micromag-screen-timeline-container .micromag-screen-timeline-content{z-index:1}.micromag-screen-timeline-container .micromag-screen-timeline-empty{height:50px;margin-right:10px}.micromag-screen-timeline-container .micromag-screen-timeline-emptyTitle{width:100%}.micromag-screen-timeline-container .micromag-screen-timeline-item{position:relative}.micromag-screen-timeline-container .micromag-screen-timeline-element{display:-ms-flexbox;display:flex}.micromag-screen-timeline-container .micromag-screen-timeline-element.micromag-screen-timeline-hidden .micromag-screen-timeline-body{display:none;visibility:hidden}.micromag-screen-timeline-container .micromag-screen-timeline-timeline{-webkit-box-sizing:content-box;box-sizing:content-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;padding-right:20px;width:15px}.micromag-screen-timeline-container .micromag-screen-timeline-line{-ms-flex-positive:1;flex-grow:1;width:1px}.micromag-screen-timeline-container .micromag-screen-timeline-line.micromag-screen-timeline-hidden{width:auto}.micromag-screen-timeline-container .micromag-screen-timeline-bullet{border-style:solid;border-width:1px;height:15px;margin:2px 0;width:15px}.micromag-screen-timeline-container .micromag-screen-timeline-body{-ms-flex-positive:1;flex-grow:1}.micromag-screen-timeline-container .micromag-screen-timeline-body.micromag-screen-timeline-last{margin-bottom:20px}.micromag-screen-timeline-container .micromag-screen-timeline-description,.micromag-screen-timeline-container .micromag-screen-timeline-imageContainer,.micromag-screen-timeline-container .micromag-screen-timeline-title{padding:8px 0}.micromag-screen-timeline-container .micromag-screen-timeline-image,.micromag-screen-timeline-container .micromag-screen-timeline-imageContainer,.micromag-screen-timeline-container .micromag-screen-timeline-video{position:relative}.micromag-screen-timeline-container .micromag-screen-timeline-imageContainer{overflow:hidden}.micromag-screen-timeline-container .micromag-screen-timeline-callToAction{bottom:0;left:0;position:absolute;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;width:100%}.micromag-screen-timeline-container .micromag-screen-timeline-callToAction a{padding:0}.micromag-screen-timeline-container .micromag-screen-timeline-callToAction.micromag-screen-timeline-disabled{opacity:0;pointer-events:none}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-scroll{padding:10px}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-timeline{padding-right:0}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-bullet{background-color:hsla(0,0%,100%,.6);border-color:hsla(0,0%,100%,.6);height:10px;mix-blend-mode:difference;width:10px}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-body.micromag-screen-timeline-last{margin-bottom:4px}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-description,.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-imageContainer,.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-title{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;height:100%;justify-content:center;padding:2px 0}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-line{background-color:hsla(0,0%,100%,.6);mix-blend-mode:difference}.micromag-screen-timeline-container.micromag-screen-timeline-circleBulletShape .micromag-screen-timeline-bullet{border-radius:50%}.micromag-screen-timeline-container.micromag-screen-timeline-withoutLines .micromag-screen-timeline-timeline{visibility:hidden}
1
+ .micromag-screen-timeline-container .micromag-screen-timeline-background{height:100%;left:0;position:absolute;top:0;width:100%}.micromag-screen-timeline-container .micromag-screen-timeline-empty{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-timeline-container{position:relative}.micromag-screen-timeline-container .micromag-screen-timeline-background{z-index:0}.micromag-screen-timeline-container .micromag-screen-timeline-content{z-index:1}.micromag-screen-timeline-container .micromag-screen-timeline-empty{height:50px;margin-right:10px}.micromag-screen-timeline-container .micromag-screen-timeline-emptyTitle{width:100%}.micromag-screen-timeline-container .micromag-screen-timeline-item{position:relative}.micromag-screen-timeline-container .micromag-screen-timeline-element{display:-ms-flexbox;display:flex}.micromag-screen-timeline-container .micromag-screen-timeline-element.micromag-screen-timeline-hidden .micromag-screen-timeline-body{display:none;visibility:hidden}.micromag-screen-timeline-container .micromag-screen-timeline-timeline{-webkit-box-sizing:content-box;box-sizing:content-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;padding-right:20px;width:15px}.micromag-screen-timeline-container .micromag-screen-timeline-line{-ms-flex-positive:1;flex-grow:1;width:1px}.micromag-screen-timeline-container .micromag-screen-timeline-line.micromag-screen-timeline-hidden{width:auto}.micromag-screen-timeline-container .micromag-screen-timeline-bullet{border-style:solid;border-width:1px;height:15px;margin:2px 0;width:15px}.micromag-screen-timeline-container .micromag-screen-timeline-body{-ms-flex-positive:1;flex-grow:1}.micromag-screen-timeline-container .micromag-screen-timeline-description,.micromag-screen-timeline-container .micromag-screen-timeline-imageContainer,.micromag-screen-timeline-container .micromag-screen-timeline-title{padding:8px 0}.micromag-screen-timeline-container .micromag-screen-timeline-image,.micromag-screen-timeline-container .micromag-screen-timeline-imageContainer,.micromag-screen-timeline-container .micromag-screen-timeline-video{position:relative}.micromag-screen-timeline-container .micromag-screen-timeline-imageContainer{overflow:hidden}.micromag-screen-timeline-container .micromag-screen-timeline-callToAction{bottom:0;left:0;position:absolute;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;width:100%}.micromag-screen-timeline-container .micromag-screen-timeline-callToAction a{padding:0}.micromag-screen-timeline-container .micromag-screen-timeline-callToAction.micromag-screen-timeline-disabled{opacity:0;pointer-events:none}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-scroll{padding:10px}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-timeline{padding-right:0}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-bullet{background-color:hsla(0,0%,100%,.6);border-color:hsla(0,0%,100%,.6);height:10px;mix-blend-mode:difference;width:10px}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-description,.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-imageContainer,.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-title{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;height:100%;justify-content:center;padding:2px 0}.micromag-screen-timeline-container.micromag-screen-timeline-isPlaceholder .micromag-screen-timeline-line{background-color:hsla(0,0%,100%,.6);mix-blend-mode:difference}.micromag-screen-timeline-container.micromag-screen-timeline-circleBulletShape .micromag-screen-timeline-bullet{border-radius:50%}.micromag-screen-timeline-container.micromag-screen-timeline-withoutLines .micromag-screen-timeline-timeline{visibility:hidden}
package/es/index.js CHANGED
@@ -23,7 +23,7 @@ import Visual from '@micromag/element-visual';
23
23
  import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
24
24
  import _extends from '@babel/runtime/helpers/extends';
25
25
 
26
- var styles = {"container":"micromag-screen-timeline-container","background":"micromag-screen-timeline-background","empty":"micromag-screen-timeline-empty","content":"micromag-screen-timeline-content","emptyTitle":"micromag-screen-timeline-emptyTitle","item":"micromag-screen-timeline-item","element":"micromag-screen-timeline-element","hidden":"micromag-screen-timeline-hidden","body":"micromag-screen-timeline-body","timeline":"micromag-screen-timeline-timeline","line":"micromag-screen-timeline-line","bullet":"micromag-screen-timeline-bullet","last":"micromag-screen-timeline-last","title":"micromag-screen-timeline-title","description":"micromag-screen-timeline-description","imageContainer":"micromag-screen-timeline-imageContainer","image":"micromag-screen-timeline-image","video":"micromag-screen-timeline-video","callToAction":"micromag-screen-timeline-callToAction","disabled":"micromag-screen-timeline-disabled","isPlaceholder":"micromag-screen-timeline-isPlaceholder","scroll":"micromag-screen-timeline-scroll","circleBulletShape":"micromag-screen-timeline-circleBulletShape","withoutLines":"micromag-screen-timeline-withoutLines"};
26
+ var styles = {"container":"micromag-screen-timeline-container","background":"micromag-screen-timeline-background","empty":"micromag-screen-timeline-empty","content":"micromag-screen-timeline-content","emptyTitle":"micromag-screen-timeline-emptyTitle","item":"micromag-screen-timeline-item","element":"micromag-screen-timeline-element","hidden":"micromag-screen-timeline-hidden","body":"micromag-screen-timeline-body","timeline":"micromag-screen-timeline-timeline","line":"micromag-screen-timeline-line","bullet":"micromag-screen-timeline-bullet","title":"micromag-screen-timeline-title","description":"micromag-screen-timeline-description","imageContainer":"micromag-screen-timeline-imageContainer","image":"micromag-screen-timeline-image","video":"micromag-screen-timeline-video","callToAction":"micromag-screen-timeline-callToAction","disabled":"micromag-screen-timeline-disabled","isPlaceholder":"micromag-screen-timeline-isPlaceholder","scroll":"micromag-screen-timeline-scroll","circleBulletShape":"micromag-screen-timeline-circleBulletShape","withoutLines":"micromag-screen-timeline-withoutLines"};
27
27
 
28
28
  var propTypes = {
29
29
  layout: PropTypes.oneOf(['normal', 'title-description-image', 'title-image-description', 'image-title-description']),
@@ -81,7 +81,10 @@ var Timeline = function Timeline(_ref) {
81
81
  bulletShape = _ref.bulletShape,
82
82
  bulletFilled = _ref.bulletFilled,
83
83
  illustrated = _ref.illustrated,
84
- spacing = _ref.spacing,
84
+ _ref$spacing = _ref.spacing,
85
+ initialSpacing = _ref$spacing === void 0 ? null : _ref$spacing,
86
+ _ref$itemBottomSpacin = _ref.itemBottomSpacing,
87
+ initialItemBottomSpacing = _ref$itemBottomSpacin === void 0 ? null : _ref$itemBottomSpacin,
85
88
  header = _ref.header,
86
89
  footer = _ref.footer,
87
90
  background = _ref.background,
@@ -118,6 +121,15 @@ var Timeline = function Timeline(_ref) {
118
121
  }) : items || [null];
119
122
  }, [isPlaceholder, items]);
120
123
  var hasTitle = isTextFilled(title);
124
+ var spacing = useMemo(function () {
125
+ return initialSpacing !== null ? Math.max(0, initialSpacing || 0) : 20;
126
+ }, [initialSpacing]);
127
+ var itemBottomSpacing = useMemo(function () {
128
+ return (
129
+ // eslint-disable-next-line no-nested-ternary
130
+ isPlaceholder ? 4 : initialItemBottomSpacing !== null ? Math.max(0, initialItemBottomSpacing || 0) : 20
131
+ );
132
+ }, [isPlaceholder, initialItemBottomSpacing]);
121
133
  var itemsCount = finalItems !== null ? finalItems.length : 0;
122
134
  var hasItems = finalItems !== null && itemsCount;
123
135
  var imagesCount = hasItems ? finalItems.reduce(function (acc, curr) {
@@ -278,7 +290,10 @@ var Timeline = function Timeline(_ref) {
278
290
  className: classNames([styles.line, _defineProperty({}, styles.hidden, bottomLineHidden)]),
279
291
  style: _objectSpread({}, !bottomLineHidden ? getStyleFromColor(lineColor, 'backgroundColor') : null)
280
292
  })) : null, /*#__PURE__*/React.createElement("div", {
281
- className: classNames([styles.body, _defineProperty({}, styles.last, lastType && !lastItem)])
293
+ className: styles.body,
294
+ style: {
295
+ marginBottom: lastType && !lastItem ? itemBottomSpacing : 0
296
+ }
282
297
  }, elementContent));
283
298
  }));
284
299
  });
@@ -300,8 +315,8 @@ var Timeline = function Timeline(_ref) {
300
315
  footerRef = _useDimensionObserver.ref,
301
316
  _useDimensionObserver2 = _useDimensionObserver.height,
302
317
  footerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
303
- var onScrolledBottom = useCallback(function (_ref0) {
304
- var initial = _ref0.initial;
318
+ var onScrolledBottom = useCallback(function (_ref9) {
319
+ var initial = _ref9.initial;
305
320
  if (initial) {
306
321
  trackScreenEvent('scroll', 'Screen');
307
322
  }
@@ -310,6 +325,15 @@ var Timeline = function Timeline(_ref) {
310
325
  var onScrolledNotBottom = useCallback(function () {
311
326
  setScrolledBottom(false);
312
327
  }, [setScrolledBottom]);
328
+ var onScrolledTrigger = useCallback(function () {
329
+ var trigger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
330
+ if (trigger !== null) {
331
+ var scrollPercent = Math.round(trigger * 100);
332
+ trackScreenEvent('scroll', scrollPercent, {
333
+ scrollPercent: scrollPercent
334
+ });
335
+ }
336
+ }, [trackScreenEvent]);
313
337
  return /*#__PURE__*/React.createElement("div", {
314
338
  className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, className, className !== null), styles.isPlaceholder, isPlaceholder), styles["".concat(bulletShape, "BulletShape")], bulletShape !== null), styles.withoutLines, itemsCount < 2)]),
315
339
  "data-screen-ready": ready
@@ -321,6 +345,7 @@ var Timeline = function Timeline(_ref) {
321
345
  className: styles.scroll,
322
346
  verticalAlign: "middle",
323
347
  disabled: scrollingDisabled,
348
+ onScrolledTrigger: onScrolledTrigger,
324
349
  onScrolledBottom: onScrolledBottom,
325
350
  onScrolledNotBottom: onScrolledNotBottom,
326
351
  withShadow: true
@@ -435,6 +460,18 @@ var definition = [{
435
460
  "value": "Entries"
436
461
  }]
437
462
  })
463
+ }, {
464
+ name: 'spacing',
465
+ type: 'number',
466
+ defaultValue: 20,
467
+ isHorizontal: true,
468
+ label: defineMessage({
469
+ id: "Zpl5bJ",
470
+ defaultMessage: [{
471
+ "type": 0,
472
+ "value": "Spacing"
473
+ }]
474
+ })
438
475
  }, {
439
476
  type: 'fields',
440
477
  label: defineMessage({
@@ -465,6 +502,18 @@ var definition = [{
465
502
  "value": "Description"
466
503
  }]
467
504
  })
505
+ }, {
506
+ name: 'itemBottomSpacing',
507
+ type: 'number',
508
+ defaultValue: 20,
509
+ isHorizontal: true,
510
+ label: defineMessage({
511
+ id: "Lp0bG4",
512
+ defaultMessage: [{
513
+ "type": 0,
514
+ "value": "Bottom spacing"
515
+ }]
516
+ })
468
517
  }]
469
518
  }, {
470
519
  name: 'bulletShape',
@@ -658,6 +707,18 @@ var definition = [{
658
707
  "value": "Entries"
659
708
  }]
660
709
  })
710
+ }, {
711
+ name: 'spacing',
712
+ type: 'number',
713
+ defaultValue: 20,
714
+ isHorizontal: true,
715
+ label: defineMessage({
716
+ id: "Zpl5bJ",
717
+ defaultMessage: [{
718
+ "type": 0,
719
+ "value": "Spacing"
720
+ }]
721
+ })
661
722
  }, {
662
723
  type: 'fields',
663
724
  label: defineMessage({
@@ -688,6 +749,18 @@ var definition = [{
688
749
  "value": "Description"
689
750
  }]
690
751
  })
752
+ }, {
753
+ name: 'itemBottomSpacing',
754
+ type: 'number',
755
+ defaultValue: 20,
756
+ isHorizontal: true,
757
+ label: defineMessage({
758
+ id: "Lp0bG4",
759
+ defaultMessage: [{
760
+ "type": 0,
761
+ "value": "Bottom spacing"
762
+ }]
763
+ })
691
764
  }]
692
765
  }, {
693
766
  name: 'withoutLine',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-timeline",
3
- "version": "0.3.769",
3
+ "version": "0.3.779",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -60,17 +60,17 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@babel/runtime": "^7.13.10",
63
- "@micromag/core": "^0.3.769",
64
- "@micromag/element-background": "^0.3.769",
65
- "@micromag/element-container": "^0.3.769",
66
- "@micromag/element-footer": "^0.3.769",
67
- "@micromag/element-header": "^0.3.769",
68
- "@micromag/element-heading": "^0.3.769",
69
- "@micromag/element-layout": "^0.3.769",
70
- "@micromag/element-scroll": "^0.3.769",
71
- "@micromag/element-text": "^0.3.769",
72
- "@micromag/element-visual": "^0.3.769",
73
- "@micromag/transforms": "^0.3.769",
63
+ "@micromag/core": "^0.3.779",
64
+ "@micromag/element-background": "^0.3.779",
65
+ "@micromag/element-container": "^0.3.779",
66
+ "@micromag/element-footer": "^0.3.779",
67
+ "@micromag/element-header": "^0.3.779",
68
+ "@micromag/element-heading": "^0.3.779",
69
+ "@micromag/element-layout": "^0.3.779",
70
+ "@micromag/element-scroll": "^0.3.779",
71
+ "@micromag/element-text": "^0.3.779",
72
+ "@micromag/element-visual": "^0.3.779",
73
+ "@micromag/transforms": "^0.3.779",
74
74
  "classnames": "^2.2.6",
75
75
  "lodash": "^4.17.21",
76
76
  "prop-types": "^15.7.2",
@@ -81,5 +81,5 @@
81
81
  "access": "public",
82
82
  "registry": "https://registry.npmjs.org/"
83
83
  },
84
- "gitHead": "a009106ec28c6e34288f0b3292f1bc6826812dd0"
84
+ "gitHead": "5cc7b8fc6d58ba77100060a9d9a4a3f87f835559"
85
85
  }