@ptsecurity/mosaic 15.8.11 → 15.9.1

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 (50) hide show
  1. package/checkbox/checkbox.d.ts +6 -6
  2. package/core/animation/animation.d.ts +2 -1
  3. package/core/common-behaviors/checkbox.d.ts +1 -0
  4. package/core/common-behaviors/index.d.ts +1 -0
  5. package/core/pop-up/pop-up-trigger.d.ts +13 -0
  6. package/esm2020/checkbox/checkbox.mjs +5 -5
  7. package/esm2020/core/animation/animation.mjs +2 -1
  8. package/esm2020/core/common-behaviors/checkbox.mjs +2 -0
  9. package/esm2020/core/common-behaviors/index.mjs +2 -1
  10. package/esm2020/core/pop-up/pop-up-trigger.mjs +43 -2
  11. package/esm2020/core/version.mjs +2 -2
  12. package/esm2020/popover/popover.component.mjs +7 -2
  13. package/esm2020/select/select.component.mjs +2 -2
  14. package/esm2020/toggle/toggle.component.mjs +102 -18
  15. package/esm2020/tooltip/tooltip.component.mjs +7 -1
  16. package/esm2020/tree-select/tree-select.component.mjs +2 -2
  17. package/fesm2015/ptsecurity-mosaic-checkbox.mjs +4 -4
  18. package/fesm2015/ptsecurity-mosaic-checkbox.mjs.map +1 -1
  19. package/fesm2015/ptsecurity-mosaic-core.mjs +41 -2
  20. package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
  21. package/fesm2015/ptsecurity-mosaic-popover.mjs +6 -1
  22. package/fesm2015/ptsecurity-mosaic-popover.mjs.map +1 -1
  23. package/fesm2015/ptsecurity-mosaic-select.mjs +1 -1
  24. package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -1
  25. package/fesm2015/ptsecurity-mosaic-toggle.mjs +103 -17
  26. package/fesm2015/ptsecurity-mosaic-toggle.mjs.map +1 -1
  27. package/fesm2015/ptsecurity-mosaic-tooltip.mjs +6 -0
  28. package/fesm2015/ptsecurity-mosaic-tooltip.mjs.map +1 -1
  29. package/fesm2015/ptsecurity-mosaic-tree-select.mjs +1 -1
  30. package/fesm2015/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  31. package/fesm2020/ptsecurity-mosaic-checkbox.mjs +4 -4
  32. package/fesm2020/ptsecurity-mosaic-checkbox.mjs.map +1 -1
  33. package/fesm2020/ptsecurity-mosaic-core.mjs +44 -2
  34. package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
  35. package/fesm2020/ptsecurity-mosaic-popover.mjs +6 -1
  36. package/fesm2020/ptsecurity-mosaic-popover.mjs.map +1 -1
  37. package/fesm2020/ptsecurity-mosaic-select.mjs +1 -1
  38. package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -1
  39. package/fesm2020/ptsecurity-mosaic-toggle.mjs +101 -17
  40. package/fesm2020/ptsecurity-mosaic-toggle.mjs.map +1 -1
  41. package/fesm2020/ptsecurity-mosaic-tooltip.mjs +6 -0
  42. package/fesm2020/ptsecurity-mosaic-tooltip.mjs.map +1 -1
  43. package/fesm2020/ptsecurity-mosaic-tree-select.mjs +1 -1
  44. package/fesm2020/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  45. package/package.json +4 -4
  46. package/popover/popover.component.d.ts +5 -0
  47. package/toggle/_toggle-theme.scss +7 -1
  48. package/toggle/toggle.component.d.ts +22 -6
  49. package/toggle/toggle.scss +23 -0
  50. package/tooltip/tooltip.component.d.ts +5 -0
@@ -31,6 +31,7 @@ var AnimationCurves;
31
31
  AnimationCurves["DecelerationCurve"] = "cubic-bezier(0.0,0.0,0.2,1)";
32
32
  AnimationCurves["AccelerationCurve"] = "cubic-bezier(0.4,0.0,1,1)";
33
33
  AnimationCurves["SharpCurve"] = "cubic-bezier(0.4,0.0,0.6,1)";
34
+ AnimationCurves["EaseInOut"] = "ease-in-out";
34
35
  })(AnimationCurves || (AnimationCurves = {}));
35
36
 
36
37
  /**
@@ -2315,6 +2316,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2315
2316
  type: Directive
2316
2317
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
2317
2318
 
2319
+ const getOffset = ({ originX, overlayX, originY, overlayY }, { width, height }, arrowOffset) => {
2320
+ const offset = {};
2321
+ // tslint:disable-next-line:no-magic-numbers
2322
+ const elementWidthHalf = width / 2;
2323
+ // tslint:disable-next-line:no-magic-numbers
2324
+ const elementHeightHalf = height / 2;
2325
+ // alignment should be applied only if the element is small
2326
+ if (arrowOffset > elementWidthHalf) {
2327
+ const PADDING = arrowOffset - elementWidthHalf;
2328
+ if (originX === overlayX) {
2329
+ if (originX === 'start') {
2330
+ offset.offsetX = -PADDING;
2331
+ }
2332
+ if (originX === 'end') {
2333
+ offset.offsetX = PADDING;
2334
+ }
2335
+ }
2336
+ }
2337
+ // alignment should be applied only if the element is small
2338
+ if (arrowOffset > elementHeightHalf) {
2339
+ const PADDING = arrowOffset - elementHeightHalf;
2340
+ if (originY === overlayY) {
2341
+ if (originY === 'top') {
2342
+ offset.offsetY = -PADDING;
2343
+ }
2344
+ if (originY === 'bottom') {
2345
+ offset.offsetY = PADDING;
2346
+ }
2347
+ }
2348
+ }
2349
+ return offset;
2350
+ };
2318
2351
  // tslint:disable-next-line:naming-convention
2319
2352
  class McPopUpTrigger {
2320
2353
  constructor(overlay, elementRef, ngZone, scrollDispatcher, hostView, scrollStrategy, direction) {
@@ -2499,12 +2532,21 @@ class McPopUpTrigger {
2499
2532
  this.overlayRef = this.createOverlay();
2500
2533
  this.subscribeOnClosingActions();
2501
2534
  const position = this.overlayRef.getConfig().positionStrategy
2502
- .withPositions(this.getPrioritizedPositions())
2535
+ .withPositions(this.getAdjustedPositions())
2503
2536
  .withPush(true);
2504
2537
  if (reapplyPosition) {
2505
2538
  setTimeout(() => position.reapplyLastPosition());
2506
2539
  }
2507
2540
  }
2541
+ /**
2542
+ * Returns a list of positions that are aligned with the element's dimensions and offsets.
2543
+ */
2544
+ getAdjustedPositions() {
2545
+ return this.getPrioritizedPositions().map((pos) => ({
2546
+ ...pos,
2547
+ ...getOffset(pos, this.elementRef.nativeElement.getBoundingClientRect(), this.arrowOffset)
2548
+ }));
2549
+ }
2508
2550
  getPriorityPlacementStrategy(value) {
2509
2551
  const result = [];
2510
2552
  const possiblePositions = Object.keys(this.availablePositions);
@@ -2755,7 +2797,7 @@ const validationTooltipShowDelay = 10;
2755
2797
  const validationTooltipHideDelay = 3000;
2756
2798
  const MC_VALIDATION = new InjectionToken('McUseValidation', { factory: () => ({ useValidation: true }) });
2757
2799
 
2758
- const VERSION = new Version('15.8.11+sha-a68efad');
2800
+ const VERSION = new Version('15.9.1+sha-cb6693a');
2759
2801
 
2760
2802
  /**
2761
2803
  * Generated bundle index. Do not edit.