mn-angular-lib 1.0.96 → 1.0.98

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mn-angular-lib",
3
- "version": "1.0.96",
3
+ "version": "1.0.98",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.3",
6
6
  "@angular/core": "^21.1.3"
@@ -123,6 +123,12 @@
123
123
  width: 100%;
124
124
  max-width: 100%;
125
125
  max-height: 92vh;
126
+ /* Keep the footer / last content clear of the iOS home indicator. The sheet
127
+ background extends into the inset so it reads as one continuous surface.
128
+ The container is border-box (Tailwind preflight), so this padding sits inside
129
+ max-height — no need to subtract the inset from the cap. env() is 0 on the
130
+ web, so this is a no-op outside the native shell. */
131
+ padding-bottom: env(safe-area-inset-bottom);
126
132
  border-radius: 1rem 1rem 0 0;
127
133
  animation: slideUpIn 0.45s var(--mn-sheet-ease);
128
134
  }
@@ -3971,6 +3971,35 @@ type CustomModalConfig<TResult = unknown> = {
3971
3971
  } & BaseModalConfig<TResult>;
3972
3972
  type ModalConfig<TResult = unknown, TModel = unknown> = WizardModalConfig<TResult> | FormModalConfig<TModel, TResult> | ConfirmationModalConfig<TResult> | CustomModalConfig<TResult>;
3973
3973
 
3974
+ /**
3975
+ * Intensity of a haptic impact. Mirrors the three impact weights exposed by most
3976
+ * native haptic engines (e.g. Capacitor Haptics `ImpactStyle`) without binding the
3977
+ * library to any particular implementation.
3978
+ */
3979
+ type MnHapticStyle = 'light' | 'medium' | 'heavy';
3980
+ /**
3981
+ * Abstraction over a native haptic feedback engine.
3982
+ *
3983
+ * The modal feature deliberately does NOT depend on Capacitor (or any other native
3984
+ * bridge) so the library stays usable in plain web apps. Consumers that run inside a
3985
+ * native shell provide an implementation of this handler through {@link MN_HAPTICS};
3986
+ * when no handler is provided the modal simply skips haptic feedback.
3987
+ */
3988
+ type MnHapticsHandler = {
3989
+ /**
3990
+ * Triggers a transient impact-style haptic.
3991
+ * @param style Intensity of the impact.
3992
+ */
3993
+ impact(style: MnHapticStyle): void;
3994
+ };
3995
+ /**
3996
+ * Optional DI token used by the bottom sheet to emit haptic feedback on native
3997
+ * platforms (sheet open, swipe-dismiss, and snap-back). Provide a {@link MnHapticsHandler}
3998
+ * at the application root to enable it; leave unprovided on the web (the modal injects it
3999
+ * with `{ optional: true }` and no-ops when absent).
4000
+ */
4001
+ declare const MN_HAPTICS: InjectionToken<MnHapticsHandler>;
4002
+
3974
4003
  /**
3975
4004
  * Shared interface for configurations that support form layouts.
3976
4005
  */
@@ -4272,6 +4301,9 @@ declare class MnModalService {
4272
4301
  declare class MnModalShellComponent<TResult = unknown> implements OnInit, AfterViewInit, OnDestroy {
4273
4302
  private el;
4274
4303
  private cdr;
4304
+ /** Downward release speed (px/ms) above which a short drag still dismisses — a "flick".
4305
+ * Native sheets dismiss on a quick flick regardless of distance, not just a long drag. */
4306
+ private static readonly FLICK_VELOCITY;
4275
4307
  config: ModalConfig<TResult>;
4276
4308
  modalRef: MnModalRef<TResult>;
4277
4309
  isClosing: boolean;
@@ -4282,7 +4314,9 @@ declare class MnModalShellComponent<TResult = unknown> implements OnInit, AfterV
4282
4314
  private pollingTimer;
4283
4315
  private pollAttempts;
4284
4316
  ngOnInit(): void;
4285
- ngAfterViewInit(): void;
4317
+ /** Minimum drag distance (px) that must accompany a flick, so an incidental fast tap
4318
+ * on the grabber never dismisses. Below the distance threshold, only a flick dismisses. */
4319
+ private static readonly FLICK_MIN_DISTANCE;
4286
4320
  ngOnDestroy(): void;
4287
4321
  private setupFocusTrap;
4288
4322
  private removeFocusTrap;
@@ -4291,6 +4325,11 @@ declare class MnModalShellComponent<TResult = unknown> implements OnInit, AfterV
4291
4325
  asConfirmation(config: ModalConfig<TResult>): ConfirmationModalConfig;
4292
4326
  asCustom(config: ModalConfig<TResult>): CustomModalConfig;
4293
4327
  private static readonly SWIPE_DISMISS_THRESHOLD;
4328
+ /** Optional native haptic engine. Absent on the web — every call is null-guarded. */
4329
+ private haptics;
4330
+ /** The two most recent (y, timestamp) pointer samples, used to estimate the release
4331
+ * velocity for flick-to-dismiss. `t` uses the event timestamp (monotonic, no Date). */
4332
+ private lastSample;
4294
4333
  /** Upper bound for the close wait if no animation/transition end event fires
4295
4334
  * (e.g. an animation was suppressed). Must stay longer than the slowest close
4296
4335
  * path (mobile sheet slide-down 0.45s, swipe glide 0.3s) so it never preempts. */
@@ -4319,15 +4358,24 @@ declare class MnModalShellComponent<TResult = unknown> implements OnInit, AfterV
4319
4358
  sheetDragY: number;
4320
4359
  /** True while the user is actively dragging the grabber (disables snap transition). */
4321
4360
  isDraggingSheet: boolean;
4361
+ private prevSample;
4322
4362
  get hostClasses(): string;
4323
4363
  private dragStartY;
4324
4364
  /** Whether the sheet can be dismissed at all (drives whether the swipe is armed). */
4325
4365
  private get canClose();
4326
4366
  /** Tailwind's `sm` breakpoint — below this the modal renders as a bottom sheet. */
4327
4367
  private static readonly SHEET_MAX_WIDTH;
4368
+ ngAfterViewInit(): void;
4328
4369
  onSheetPointerDown(event: PointerEvent): void;
4329
4370
  onSheetPointerMove(event: PointerEvent): void;
4330
4371
  onSheetPointerUp(): Promise<void>;
4372
+ /** Whether the release should dismiss: a long-enough drag OR a fast downward flick. */
4373
+ private shouldDismissSheet;
4374
+ /** Downward release speed (px/ms) from the last two pointer samples. Positive means
4375
+ * moving down. Returns 0 when there is no usable sample window. */
4376
+ private releaseVelocity;
4377
+ /** Springs the sheet back to its resting position after a drag that didn't dismiss. */
4378
+ private snapBack;
4331
4379
  /** Attempts to dismiss the modal. Resolves true if it was actually dismissed,
4332
4380
  * false if blocked by a DISABLED close mode or a rejected close guard. */
4333
4381
  private handleClose;
@@ -6115,5 +6163,5 @@ type MnPreviewMessage = {
6115
6163
  */
6116
6164
  declare function enableMnPreviewMode(configService: MnConfigService, langService: MnLanguageService, allowedOrigins?: string[]): void;
6117
6165
 
6118
- export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_ICON_MAP, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnButton, MnCheckbox, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFileInput, MnFormBodyComponent, MnGrid, MnHiddenBelowDirective, MnHttpService, MnIcon, MnIconAttributes, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnSelect, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnSkeleton, MnTabComponent, MnTable, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, enableMnPreviewMode, isTranslatable, mnAlertVariants, mnBadgeVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnFileInputVariants, mnIconVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnSkeletonVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig };
6119
- export type { AnimationOptions, ApiError, BaseModalConfig, CalendarButton, CalendarConfig, CalendarDateFormatter, CalendarEvent, CalendarEventData, CancellationActionConfig, CheckboxFieldConfig, ColorFieldConfig, ColorPreset, ColumnDay, ColumnDefinition, ColumnFilterOption, ColumnFilterState, ColumnFilterType, ColumnSkeleton, ConfirmationActionConfig, ConfirmationModalConfig, CrudConfig, CurrentTimeCalendarEvent, CursorPaginationStrategy, CustomFieldConfig, CustomModalConfig, DateFieldConfig, DatetimeFieldConfig, FailureResult, FieldDataSource, FieldRequiredCondition, FieldValidator, FieldVisibilityCondition, FileFieldConfig, FormFieldConfig, FormFieldGroup, FormModalConfig, FormRow, FormRowField, FormValidator, GridDataSource, GridLayout, GridSkeleton, HourRow, ListAppearance, ListDataSource, ListLabels, ListSkeleton, MnAlert, MnAlertConfig, MnAlertId, MnAlertKind, MnAlertTemplateContext, MnAlertVariants, MnBadgeTypes, MnBadgeVariants, MnButtonTypes, MnButtonVariants, MnCheckboxErrorMessageData, MnCheckboxErrorMessagesData, MnCheckboxProps, MnCheckboxUIConfig, MnCheckboxVariants, MnCheckboxWrapperVariants, MnCollectionDataSource, MnCollectionLabels, MnConfigFile, MnConfigSettings, MnConfigValue, MnDatetimeErrorMessageData, MnDatetimeErrorMessagesData, MnDatetimeMode, MnDatetimeProps, MnDatetimeUIConfig, MnDatetimeVariants, MnDomAttrs, MnDualHorizontalImageConfig, MnDualHorizontalImageTypes, MnErrorMessageData, MnErrorMessageFn, MnErrorMessagesData, MnFileDisplayItem, MnFileInputDisplayMode, MnFileInputErrorMessageData, MnFileInputErrorMessagesData, MnFileInputProps, MnFileInputUIConfig, MnFileInputVariants, MnIconTypes, MnIconVariants, MnImageType, MnInformationCardBaseData, MnInformationCardData, MnInformationCardVariants, MnInputAdapter, MnInputBaseProps, MnInputDateTimeProps, MnInputFieldProps, MnInputFieldUIConfig, MnInputProps, MnInputType, MnInputVariants, MnLanguageConfig, MnMultiSelectErrorMessageData, MnMultiSelectErrorMessagesData, MnMultiSelectOption, MnMultiSelectProps, MnMultiSelectUIConfig, MnMultiSelectVariants, MnPreviewMessage, MnQueryParams, MnSelectErrorMessageData, MnSelectErrorMessagesData, MnSelectOption, MnSelectProps, MnSelectUIConfig, MnSelectVariants, MnSelectableCollectionDataSource, MnShowInput, MnSkeletonProps, MnSkeletonShape, MnSkeletonVariantProps, MnTabDataSource, MnTabItem, MnTextareaErrorMessageData, MnTextareaErrorMessagesData, MnTextareaProps, MnTextareaUIConfig, MnTextareaVariants, MnTranslatable, MnTranslationMap, MnTranslations, MnValidationErrorArgs, ModalCancelHandler, ModalCloseEvent, ModalConfig, ModalFooterAction, ModalI18nLabels, ModalInputMap, ModalPollingConfig, ModalRef, ModalResultHandler, ModalStepId, MonthItem, MultiSelectFieldConfig, MultiSelectTableFieldConfig, NumberFieldConfig, OffsetPaginationStrategy, PaginationMode, PaginationStrategy, PasswordFieldConfig, Primitive, QueryParams, QueryValue, RatingFieldConfig, Result, ResultMeta, SelectFieldConfig, SelectOption, SingleSelectTableFieldConfig, SliderFieldConfig, SortState, StepBodyConfig, StepGuard, StepValidator, SuccessResult, TableAppearance, TableDataSource, TableLabels, TextFieldConfig, TextareaFieldConfig, ValidationResult, WizardBeforeCompleteValidator, WizardModalConfig, WizardResult, WizardStepChangeEvent, WizardStepChangeHandler, WizardStepConfig };
6166
+ export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_HAPTICS, MN_ICON_MAP, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnButton, MnCheckbox, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFileInput, MnFormBodyComponent, MnGrid, MnHiddenBelowDirective, MnHttpService, MnIcon, MnIconAttributes, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnSelect, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnSkeleton, MnTabComponent, MnTable, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, enableMnPreviewMode, isTranslatable, mnAlertVariants, mnBadgeVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnFileInputVariants, mnIconVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnSkeletonVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig };
6167
+ export type { AnimationOptions, ApiError, BaseModalConfig, CalendarButton, CalendarConfig, CalendarDateFormatter, CalendarEvent, CalendarEventData, CancellationActionConfig, CheckboxFieldConfig, ColorFieldConfig, ColorPreset, ColumnDay, ColumnDefinition, ColumnFilterOption, ColumnFilterState, ColumnFilterType, ColumnSkeleton, ConfirmationActionConfig, ConfirmationModalConfig, CrudConfig, CurrentTimeCalendarEvent, CursorPaginationStrategy, CustomFieldConfig, CustomModalConfig, DateFieldConfig, DatetimeFieldConfig, FailureResult, FieldDataSource, FieldRequiredCondition, FieldValidator, FieldVisibilityCondition, FileFieldConfig, FormFieldConfig, FormFieldGroup, FormModalConfig, FormRow, FormRowField, FormValidator, GridDataSource, GridLayout, GridSkeleton, HourRow, ListAppearance, ListDataSource, ListLabels, ListSkeleton, MnAlert, MnAlertConfig, MnAlertId, MnAlertKind, MnAlertTemplateContext, MnAlertVariants, MnBadgeTypes, MnBadgeVariants, MnButtonTypes, MnButtonVariants, MnCheckboxErrorMessageData, MnCheckboxErrorMessagesData, MnCheckboxProps, MnCheckboxUIConfig, MnCheckboxVariants, MnCheckboxWrapperVariants, MnCollectionDataSource, MnCollectionLabels, MnConfigFile, MnConfigSettings, MnConfigValue, MnDatetimeErrorMessageData, MnDatetimeErrorMessagesData, MnDatetimeMode, MnDatetimeProps, MnDatetimeUIConfig, MnDatetimeVariants, MnDomAttrs, MnDualHorizontalImageConfig, MnDualHorizontalImageTypes, MnErrorMessageData, MnErrorMessageFn, MnErrorMessagesData, MnFileDisplayItem, MnFileInputDisplayMode, MnFileInputErrorMessageData, MnFileInputErrorMessagesData, MnFileInputProps, MnFileInputUIConfig, MnFileInputVariants, MnHapticStyle, MnHapticsHandler, MnIconTypes, MnIconVariants, MnImageType, MnInformationCardBaseData, MnInformationCardData, MnInformationCardVariants, MnInputAdapter, MnInputBaseProps, MnInputDateTimeProps, MnInputFieldProps, MnInputFieldUIConfig, MnInputProps, MnInputType, MnInputVariants, MnLanguageConfig, MnMultiSelectErrorMessageData, MnMultiSelectErrorMessagesData, MnMultiSelectOption, MnMultiSelectProps, MnMultiSelectUIConfig, MnMultiSelectVariants, MnPreviewMessage, MnQueryParams, MnSelectErrorMessageData, MnSelectErrorMessagesData, MnSelectOption, MnSelectProps, MnSelectUIConfig, MnSelectVariants, MnSelectableCollectionDataSource, MnShowInput, MnSkeletonProps, MnSkeletonShape, MnSkeletonVariantProps, MnTabDataSource, MnTabItem, MnTextareaErrorMessageData, MnTextareaErrorMessagesData, MnTextareaProps, MnTextareaUIConfig, MnTextareaVariants, MnTranslatable, MnTranslationMap, MnTranslations, MnValidationErrorArgs, ModalCancelHandler, ModalCloseEvent, ModalConfig, ModalFooterAction, ModalI18nLabels, ModalInputMap, ModalPollingConfig, ModalRef, ModalResultHandler, ModalStepId, MonthItem, MultiSelectFieldConfig, MultiSelectTableFieldConfig, NumberFieldConfig, OffsetPaginationStrategy, PaginationMode, PaginationStrategy, PasswordFieldConfig, Primitive, QueryParams, QueryValue, RatingFieldConfig, Result, ResultMeta, SelectFieldConfig, SelectOption, SingleSelectTableFieldConfig, SliderFieldConfig, SortState, StepBodyConfig, StepGuard, StepValidator, SuccessResult, TableAppearance, TableDataSource, TableLabels, TextFieldConfig, TextareaFieldConfig, ValidationResult, WizardBeforeCompleteValidator, WizardModalConfig, WizardResult, WizardStepChangeEvent, WizardStepChangeHandler, WizardStepConfig };