mn-angular-lib 1.0.78 → 1.0.80

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.78",
3
+ "version": "1.0.80",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.3",
6
6
  "@angular/core": "^21.1.3"
@@ -2,39 +2,23 @@
2
2
  * Self-contained checkbox styling — a faithful reproduction of daisyui's
3
3
  * `checkbox` component WITHOUT depending on daisyui.
4
4
  *
5
- * Unlike mn-select (which renders entirely with Tailwind utilities), the
6
- * checkbox needs a component stylesheet: daisyui draws the checkmark with a
7
- * `::before` pseudo-element and an animated `clip-path`, which cannot be
8
- * expressed as utility classes on a native <input>. Shipping it as component
9
- * CSS also means it compiles with the component and does not rely on the
10
- * consumer's Tailwind scanning the library.
11
- *
12
- * Colors come from the theme CSS variables the consuming app already provides
13
- * (--color-primary, --color-base-content, etc. — see demo-app styles.css).
14
- * The depth shadows hardcode daisyui's default depth (0.1 opacity) and the
15
- * `--fx-noise` layer is dropped.
5
+ * Size, color, and border-radius are handled entirely by Tailwind utility
6
+ * classes generated in mn-checkboxVariants.ts. This file is responsible only
7
+ * for structural rules and the ::before pseudo-element checkmark animation,
8
+ * which cannot be expressed as utility classes on a native <input>.
16
9
  */
17
10
 
18
11
  .mn-checkbox {
19
- /* Defaults; size/color modifier classes override these. */
20
- --mn-checkbox-size: 1.5rem;
21
- --mn-checkbox-input-color: var(--color-primary);
22
- --mn-checkbox-check-color: var(--color-primary-content, #fff);
23
-
24
12
  position: relative;
25
13
  display: inline-block;
26
14
  flex-shrink: 0;
27
15
  box-sizing: border-box;
28
- width: var(--mn-checkbox-size);
29
- height: var(--mn-checkbox-size);
30
- padding: 0.25rem;
31
16
  vertical-align: middle;
32
17
  cursor: pointer;
33
18
  appearance: none;
34
19
  -webkit-appearance: none;
35
- color: var(--mn-checkbox-check-color);
36
- border: 1px solid var(--mn-checkbox-input-color, color-mix(in oklab, var(--color-base-content) 20%, transparent));
37
- border-radius: 0.25rem;
20
+ border-width: 1px;
21
+ border-style: solid;
38
22
  box-shadow: 0 1px oklch(0% 0 0 / 0.1) inset,
39
23
  0 0 #0000 inset,
40
24
  0 0 #0000;
@@ -60,13 +44,13 @@
60
44
  }
61
45
 
62
46
  .mn-checkbox:focus-visible {
63
- outline: 2px solid var(--mn-checkbox-input-color, currentColor);
47
+ outline-width: 2px;
48
+ outline-style: solid;
64
49
  outline-offset: 2px;
65
50
  }
66
51
 
67
52
  .mn-checkbox:checked,
68
53
  .mn-checkbox[aria-checked='true'] {
69
- background-color: var(--mn-checkbox-input-color);
70
54
  box-shadow: 0 0 #0000 inset,
71
55
  0 8px 0 -4px oklch(100% 0 0 / 0.1) inset,
72
56
  0 1px oklch(0% 0 0 / 0.1);
@@ -78,10 +62,6 @@
78
62
  clip-path: polygon(20% 100%, 20% 80%, 50% 80%, 50% 0%, 70% 0%, 70% 100%);
79
63
  }
80
64
 
81
- .mn-checkbox:indeterminate {
82
- background-color: var(--mn-checkbox-input-color);
83
- }
84
-
85
65
  .mn-checkbox:indeterminate::before {
86
66
  opacity: 1;
87
67
  rotate: 0deg;
@@ -93,96 +73,3 @@
93
73
  cursor: not-allowed;
94
74
  opacity: 0.2;
95
75
  }
96
-
97
- /* ========== Sizes (daisyui dimensions verbatim) ========== */
98
-
99
- .mn-checkbox-xs {
100
- --mn-checkbox-size: 1rem;
101
- padding: 0.125rem;
102
- }
103
-
104
- .mn-checkbox-sm {
105
- --mn-checkbox-size: 1.25rem;
106
- padding: 0.1875rem;
107
- }
108
-
109
- .mn-checkbox-md {
110
- --mn-checkbox-size: 1.5rem;
111
- padding: 0.25rem;
112
- }
113
-
114
- .mn-checkbox-lg {
115
- --mn-checkbox-size: 1.75rem;
116
- padding: 0.3125rem;
117
- }
118
-
119
- .mn-checkbox-xl {
120
- --mn-checkbox-size: 2rem;
121
- padding: 0.375rem;
122
- }
123
-
124
- /* ========== Colors ========== */
125
- /* Content tokens carry a #fff fallback because not every theme defines the
126
- * full *-content palette; without it currentColor would inherit body text. */
127
-
128
- .mn-checkbox-primary {
129
- --mn-checkbox-input-color: var(--color-primary);
130
- --mn-checkbox-check-color: var(--color-primary-content, #fff);
131
- }
132
-
133
- .mn-checkbox-secondary {
134
- --mn-checkbox-input-color: var(--color-secondary);
135
- --mn-checkbox-check-color: var(--color-secondary-content, #fff);
136
- }
137
-
138
- .mn-checkbox-accent {
139
- --mn-checkbox-input-color: var(--color-accent);
140
- --mn-checkbox-check-color: var(--color-accent-content, #fff);
141
- }
142
-
143
- .mn-checkbox-neutral {
144
- --mn-checkbox-input-color: var(--color-neutral);
145
- --mn-checkbox-check-color: var(--color-neutral-content, #fff);
146
- }
147
-
148
- .mn-checkbox-info {
149
- --mn-checkbox-input-color: var(--color-info);
150
- --mn-checkbox-check-color: var(--color-info-content, #fff);
151
- }
152
-
153
- .mn-checkbox-success {
154
- --mn-checkbox-input-color: var(--color-success);
155
- --mn-checkbox-check-color: var(--color-success-content, #fff);
156
- }
157
-
158
- .mn-checkbox-warning {
159
- --mn-checkbox-input-color: var(--color-warning);
160
- --mn-checkbox-check-color: var(--color-warning-content, #fff);
161
- }
162
-
163
- .mn-checkbox-error {
164
- --mn-checkbox-input-color: var(--color-error);
165
- --mn-checkbox-check-color: var(--color-error-content, #fff);
166
- }
167
-
168
- /* ========== Border radius ========== */
169
-
170
- .mn-checkbox-radius-none {
171
- border-radius: 0;
172
- }
173
-
174
- .mn-checkbox-radius-xs {
175
- border-radius: 0.125rem;
176
- }
177
-
178
- .mn-checkbox-radius-sm {
179
- border-radius: 0.25rem;
180
- }
181
-
182
- .mn-checkbox-radius-md {
183
- border-radius: 0.375rem;
184
- }
185
-
186
- .mn-checkbox-radius-lg {
187
- border-radius: 0.5rem;
188
- }
@@ -1,4 +1,9 @@
1
1
  :host {
2
+ /* Native-feeling sheet curve (iOS-style decelerate, no out-of-bounds overshoot
3
+ which would expose a gap below a bottom-anchored sheet). Shared by the
4
+ slide keyframes, the drag spring-back, and the swipe-dismiss glide. */
5
+ --mn-sheet-ease: cubic-bezier(0.32, 0.72, 0, 1);
6
+
2
7
  position: fixed;
3
8
  inset: 0;
4
9
  z-index: 1000;
@@ -17,7 +22,7 @@
17
22
 
18
23
  /* Swipe-to-dismiss: animate the spring-back, but follow the finger 1:1 while dragging. */
19
24
  .modal-container {
20
- transition: transform 0.2s ease;
25
+ transition: transform 0.35s var(--mn-sheet-ease);
21
26
  }
22
27
 
23
28
  .modal-container.sheet-dragging {
@@ -30,7 +35,7 @@
30
35
  :host(.swipe-dismissing) .modal-container,
31
36
  :host(.swipe-dismissing).closing .modal-container {
32
37
  animation: none !important;
33
- transition: transform 0.2s ease-in;
38
+ transition: transform 0.3s var(--mn-sheet-ease);
34
39
  }
35
40
 
36
41
  @keyframes fadeIn {
@@ -130,20 +135,35 @@
130
135
  max-width: 100%;
131
136
  max-height: 92vh;
132
137
  border-radius: 1rem 1rem 0 0;
133
- animation: slideUpIn 0.25s ease-out;
138
+ animation: slideUpIn 0.35s var(--mn-sheet-ease);
134
139
  }
135
140
 
136
141
  /* Override whichever anim-* open animation was selected */
137
142
  :host(.mobile-sheet).anim-slide .modal-container,
138
143
  :host(.mobile-sheet).anim-fade .modal-container,
139
144
  :host(.mobile-sheet).anim-zoom .modal-container {
140
- animation: slideUpIn 0.25s ease-out;
145
+ animation: slideUpIn 0.35s var(--mn-sheet-ease);
141
146
  }
142
147
 
143
148
  :host(.mobile-sheet).closing .modal-container,
144
149
  :host(.mobile-sheet).closing.anim-slide .modal-container,
145
150
  :host(.mobile-sheet).closing.anim-fade .modal-container,
146
151
  :host(.mobile-sheet).closing.anim-zoom .modal-container {
147
- animation: slideUpOut 0.2s ease-in forwards;
152
+ animation: slideUpOut 0.25s var(--mn-sheet-ease) forwards;
153
+ }
154
+ }
155
+
156
+ /* =========================
157
+ Reduced motion: collapse every open/close/drag animation to ~instant.
158
+ Kept at 0.01ms (not `none`) so animationend still fires for the
159
+ event-driven close teardown in the shell component. The shell also
160
+ short-circuits its close wait when reduced motion is requested.
161
+ ========================= */
162
+ @media (prefers-reduced-motion: reduce) {
163
+ :host .modal-backdrop,
164
+ :host .modal-container {
165
+ animation-duration: 0.01ms !important;
166
+ animation-delay: 0ms !important;
167
+ transition-duration: 0.01ms !important;
148
168
  }
149
169
  }
@@ -3745,10 +3745,24 @@ declare class MnModalShellComponent<TResult = unknown> implements OnInit, AfterV
3745
3745
  asConfirmation(config: ModalConfig<TResult>): ConfirmationModalConfig;
3746
3746
  asCustom(config: ModalConfig<TResult>): CustomModalConfig;
3747
3747
  private static readonly SWIPE_DISMISS_THRESHOLD;
3748
+ /** Upper bound for the close wait if no animation/transition end event fires
3749
+ * (e.g. an animation was suppressed). Longer than the slowest close path
3750
+ * (mobile slide-down 0.25s, swipe glide 0.3s) so it never preempts. */
3751
+ private static readonly CLOSE_FALLBACK_MS;
3748
3752
  /** Whether this modal renders as a bottom sheet on small screens (default: true). */
3749
3753
  get isMobileSheet(): boolean;
3750
- /** Triggers the closing animation. Deferred to avoid NG0100 when called during a CD cycle. */
3754
+ /**
3755
+ * Triggers the closing animation and resolves once it has actually finished.
3756
+ *
3757
+ * Deferred via setTimeout to avoid NG0100 when called during a CD cycle.
3758
+ * Rather than guess a fixed duration (the old hardcoded 150ms truncated the
3759
+ * mobile slide-down, which runs 250ms — and the swipe glide, 300ms), we wait
3760
+ * for the container's `animationend`/`transitionend` and tear down then. A
3761
+ * fallback timeout guarantees resolution if no such event fires, and we
3762
+ * short-circuit entirely under reduced motion (the CSS collapses to instant).
3763
+ */
3751
3764
  startClosing(): Promise<void>;
3765
+ private prefersReducedMotion;
3752
3766
  onEscapeKey(event: Event): void;
3753
3767
  onBackdropClick(): void;
3754
3768
  onCloseButtonClick(): void;