@mk-kit/ui 0.34.1 → 0.35.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/README.md CHANGED
@@ -9,7 +9,7 @@ Angular 22 with signals and `OnPush` from day one. Every visual value is a
9
9
  is the target, not the marketing. MIT licensed. Zero runtime dependencies
10
10
  beyond Angular.
11
11
 
12
- - **Docs & live demos:** <https://github.com/mk-kit/mk-kit> (site: mk-kit.dev — coming soon)
12
+ - **Docs & live demos:** <https://mk-kit.dev>
13
13
  - **Changelog:** [CHANGELOG.md](https://github.com/mk-kit/mk-kit/blob/main/CHANGELOG.md)
14
14
  - **Issues:** <https://github.com/mk-kit/mk-kit/issues>
15
15
 
@@ -678,7 +678,7 @@ function sideOf(placement) {
678
678
  return 'top';
679
679
  if (placement.startsWith('bottom'))
680
680
  return 'bottom';
681
- return placement;
681
+ return placement.startsWith('left') ? 'left' : 'right';
682
682
  }
683
683
  function alignOf(placement) {
684
684
  if (placement.endsWith('-start'))
@@ -740,8 +740,14 @@ function mkComputeAnchoredPosition(anchor, panel, viewport, opts) {
740
740
  left = anchor.left + anchor.width / 2 - w / 2;
741
741
  }
742
742
  else {
743
- // Left/right: centre on the cross (vertical) axis.
744
- top = anchor.top + anchor.height / 2 - h / 2;
743
+ // Left/right: the cross axis is vertical. `-start` tops the panel with the
744
+ // anchor (a submenu beside its item), `-end` bottoms it, else centre.
745
+ if (align === 'start')
746
+ top = anchor.top;
747
+ else if (align === 'end')
748
+ top = anchor.bottom - h;
749
+ else
750
+ top = anchor.top + anchor.height / 2 - h / 2;
745
751
  }
746
752
  if (clamp) {
747
753
  left = Math.max(gap, Math.min(left, vw - w - gap));
@@ -793,6 +799,13 @@ class MkAnchoredPanel {
793
799
  /** Clamp the panel inside the viewport. */
794
800
  clamp = input(true, /* @ts-ignore */
795
801
  ...(ngDevMode ? [{ debugName: "clamp" }] : /* istanbul ignore next */ []));
802
+ /**
803
+ * Predicate consulted before an outside pointerdown dismisses the panel.
804
+ * Return `true` for targets that must keep it open — e.g. a nested panel
805
+ * (a submenu) that lives in the top layer outside this element.
806
+ */
807
+ keepOpenWhen = input(null, /* @ts-ignore */
808
+ ...(ngDevMode ? [{ debugName: "keepOpenWhen" }] : /* istanbul ignore next */ []));
796
809
  /** Emitted on an outside pointerdown or when the window loses focus. */
797
810
  dismiss = output();
798
811
  popover = false;
@@ -828,6 +841,8 @@ class MkAnchoredPanel {
828
841
  const anchorEl = this.resolveAnchorEl();
829
842
  if (anchorEl?.contains(target))
830
843
  return;
844
+ if (this.keepOpenWhen()?.(target))
845
+ return;
831
846
  this.dismiss.emit();
832
847
  };
833
848
  onWindowBlur = () => this.dismiss.emit();
@@ -1022,7 +1037,7 @@ class MkAnchoredPanel {
1022
1037
  el.remove();
1023
1038
  }
1024
1039
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MkAnchoredPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1025
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.7", type: MkAnchoredPanel, isStandalone: true, selector: "[mkAnchoredPanel]", inputs: { anchor: { classPropertyName: "anchor", publicName: "mkAnchoredPanelFor", isSignal: true, isRequired: false, transformFunction: null }, anchorRect: { classPropertyName: "anchorRect", publicName: "anchorRect", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, matchWidth: { classPropertyName: "matchWidth", publicName: "matchWidth", isSignal: true, isRequired: false, transformFunction: null }, flip: { classPropertyName: "flip", publicName: "flip", isSignal: true, isRequired: false, transformFunction: null }, clamp: { classPropertyName: "clamp", publicName: "clamp", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dismiss: "dismiss" }, exportAs: ["mkAnchoredPanel"], ngImport: i0 });
1040
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.7", type: MkAnchoredPanel, isStandalone: true, selector: "[mkAnchoredPanel]", inputs: { anchor: { classPropertyName: "anchor", publicName: "mkAnchoredPanelFor", isSignal: true, isRequired: false, transformFunction: null }, anchorRect: { classPropertyName: "anchorRect", publicName: "anchorRect", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, matchWidth: { classPropertyName: "matchWidth", publicName: "matchWidth", isSignal: true, isRequired: false, transformFunction: null }, flip: { classPropertyName: "flip", publicName: "flip", isSignal: true, isRequired: false, transformFunction: null }, clamp: { classPropertyName: "clamp", publicName: "clamp", isSignal: true, isRequired: false, transformFunction: null }, keepOpenWhen: { classPropertyName: "keepOpenWhen", publicName: "keepOpenWhen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dismiss: "dismiss" }, exportAs: ["mkAnchoredPanel"], ngImport: i0 });
1026
1041
  }
1027
1042
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MkAnchoredPanel, decorators: [{
1028
1043
  type: Directive,
@@ -1030,7 +1045,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
1030
1045
  selector: '[mkAnchoredPanel]',
1031
1046
  exportAs: 'mkAnchoredPanel',
1032
1047
  }]
1033
- }], propDecorators: { anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "mkAnchoredPanelFor", required: false }] }], anchorRect: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorRect", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], matchWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "matchWidth", required: false }] }], flip: [{ type: i0.Input, args: [{ isSignal: true, alias: "flip", required: false }] }], clamp: [{ type: i0.Input, args: [{ isSignal: true, alias: "clamp", required: false }] }], dismiss: [{ type: i0.Output, args: ["dismiss"] }] } });
1048
+ }], propDecorators: { anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "mkAnchoredPanelFor", required: false }] }], anchorRect: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorRect", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], matchWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "matchWidth", required: false }] }], flip: [{ type: i0.Input, args: [{ isSignal: true, alias: "flip", required: false }] }], clamp: [{ type: i0.Input, args: [{ isSignal: true, alias: "clamp", required: false }] }], keepOpenWhen: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepOpenWhen", required: false }] }], dismiss: [{ type: i0.Output, args: ["dismiss"] }] } });
1034
1049
 
1035
1050
  /** The built-in English validation messages. */
1036
1051
  const MK_DEFAULT_VALIDATION = {
@@ -1132,6 +1147,11 @@ const MK_DEFAULT_I18N = {
1132
1147
  chooseWeek: 'Choose week',
1133
1148
  openCalendar: 'Open calendar',
1134
1149
  openTimeList: 'Open time list',
1150
+ moreActions: 'More actions',
1151
+ selectDateTime: 'Select date and time…',
1152
+ chooseDateTime: 'Choose date and time',
1153
+ chooseTime: 'Choose time',
1154
+ openDateTimePicker: 'Open date and time picker',
1135
1155
  daySegment: 'Day',
1136
1156
  monthSegment: 'Month',
1137
1157
  yearSegment: 'Year',