mn-angular-lib 1.0.77 → 1.0.79

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.77",
3
+ "version": "1.0.79",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.3",
6
6
  "@angular/core": "^21.1.3"
@@ -0,0 +1,188 @@
1
+ /*
2
+ * Self-contained checkbox styling — a faithful reproduction of daisyui's
3
+ * `checkbox` component WITHOUT depending on daisyui.
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.
16
+ */
17
+
18
+ .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
+ position: relative;
25
+ display: inline-block;
26
+ flex-shrink: 0;
27
+ box-sizing: border-box;
28
+ width: var(--mn-checkbox-size);
29
+ height: var(--mn-checkbox-size);
30
+ padding: 0.25rem;
31
+ vertical-align: middle;
32
+ cursor: pointer;
33
+ appearance: none;
34
+ -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;
38
+ box-shadow: 0 1px oklch(0% 0 0 / 0.1) inset,
39
+ 0 0 #0000 inset,
40
+ 0 0 #0000;
41
+ transition: background-color 0.2s,
42
+ box-shadow 0.2s;
43
+ }
44
+
45
+ .mn-checkbox::before {
46
+ content: '';
47
+ display: block;
48
+ width: 100%;
49
+ height: 100%;
50
+ rotate: 45deg;
51
+ background-color: currentColor;
52
+ opacity: 0;
53
+ box-shadow: 0 3px 0 0 oklch(100% 0 0 / 0.1) inset;
54
+ clip-path: polygon(20% 100%, 20% 80%, 50% 80%, 50% 80%, 70% 80%, 70% 100%);
55
+ transition: clip-path 0.3s,
56
+ opacity 0.1s,
57
+ rotate 0.3s,
58
+ translate 0.3s;
59
+ transition-delay: 0.1s;
60
+ }
61
+
62
+ .mn-checkbox:focus-visible {
63
+ outline: 2px solid var(--mn-checkbox-input-color, currentColor);
64
+ outline-offset: 2px;
65
+ }
66
+
67
+ .mn-checkbox:checked,
68
+ .mn-checkbox[aria-checked='true'] {
69
+ background-color: var(--mn-checkbox-input-color);
70
+ box-shadow: 0 0 #0000 inset,
71
+ 0 8px 0 -4px oklch(100% 0 0 / 0.1) inset,
72
+ 0 1px oklch(0% 0 0 / 0.1);
73
+ }
74
+
75
+ .mn-checkbox:checked::before,
76
+ .mn-checkbox[aria-checked='true']::before {
77
+ opacity: 1;
78
+ clip-path: polygon(20% 100%, 20% 80%, 50% 80%, 50% 0%, 70% 0%, 70% 100%);
79
+ }
80
+
81
+ .mn-checkbox:indeterminate {
82
+ background-color: var(--mn-checkbox-input-color);
83
+ }
84
+
85
+ .mn-checkbox:indeterminate::before {
86
+ opacity: 1;
87
+ rotate: 0deg;
88
+ translate: 0 -35%;
89
+ clip-path: polygon(20% 100%, 20% 80%, 50% 80%, 50% 80%, 80% 80%, 80% 100%);
90
+ }
91
+
92
+ .mn-checkbox:disabled {
93
+ cursor: not-allowed;
94
+ opacity: 0.2;
95
+ }
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
  }
@@ -1412,9 +1412,21 @@ declare class MnTextarea implements OnInit {
1412
1412
 
1413
1413
  declare const mnCheckboxVariants: tailwind_variants.TVReturnType<{
1414
1414
  size: {
1415
+ xs: string;
1415
1416
  sm: string;
1416
1417
  md: string;
1417
1418
  lg: string;
1419
+ xl: string;
1420
+ };
1421
+ color: {
1422
+ primary: string;
1423
+ secondary: string;
1424
+ accent: string;
1425
+ neutral: string;
1426
+ info: string;
1427
+ success: string;
1428
+ warning: string;
1429
+ error: string;
1418
1430
  };
1419
1431
  borderRadius: {
1420
1432
  none: string;
@@ -1423,11 +1435,23 @@ declare const mnCheckboxVariants: tailwind_variants.TVReturnType<{
1423
1435
  md: string;
1424
1436
  lg: string;
1425
1437
  };
1426
- }, undefined, "", {
1438
+ }, undefined, "mn-checkbox", {
1427
1439
  size: {
1440
+ xs: string;
1428
1441
  sm: string;
1429
1442
  md: string;
1430
1443
  lg: string;
1444
+ xl: string;
1445
+ };
1446
+ color: {
1447
+ primary: string;
1448
+ secondary: string;
1449
+ accent: string;
1450
+ neutral: string;
1451
+ info: string;
1452
+ success: string;
1453
+ warning: string;
1454
+ error: string;
1431
1455
  };
1432
1456
  borderRadius: {
1433
1457
  none: string;
@@ -1438,9 +1462,21 @@ declare const mnCheckboxVariants: tailwind_variants.TVReturnType<{
1438
1462
  };
1439
1463
  }, undefined, tailwind_variants.TVReturnType<{
1440
1464
  size: {
1465
+ xs: string;
1441
1466
  sm: string;
1442
1467
  md: string;
1443
1468
  lg: string;
1469
+ xl: string;
1470
+ };
1471
+ color: {
1472
+ primary: string;
1473
+ secondary: string;
1474
+ accent: string;
1475
+ neutral: string;
1476
+ info: string;
1477
+ success: string;
1478
+ warning: string;
1479
+ error: string;
1444
1480
  };
1445
1481
  borderRadius: {
1446
1482
  none: string;
@@ -1449,12 +1485,14 @@ declare const mnCheckboxVariants: tailwind_variants.TVReturnType<{
1449
1485
  md: string;
1450
1486
  lg: string;
1451
1487
  };
1452
- }, undefined, "", unknown, unknown, undefined>>;
1488
+ }, undefined, "mn-checkbox", unknown, unknown, undefined>>;
1453
1489
  declare const mnCheckboxWrapperVariants: tailwind_variants.TVReturnType<{
1454
1490
  size: {
1491
+ xs: string;
1455
1492
  sm: string;
1456
1493
  md: string;
1457
1494
  lg: string;
1495
+ xl: string;
1458
1496
  };
1459
1497
  fullWidth: {
1460
1498
  true: string;
@@ -1464,9 +1502,11 @@ declare const mnCheckboxWrapperVariants: tailwind_variants.TVReturnType<{
1464
1502
  };
1465
1503
  }, undefined, "text-base-content", {
1466
1504
  size: {
1505
+ xs: string;
1467
1506
  sm: string;
1468
1507
  md: string;
1469
1508
  lg: string;
1509
+ xl: string;
1470
1510
  };
1471
1511
  fullWidth: {
1472
1512
  true: string;
@@ -1476,9 +1516,11 @@ declare const mnCheckboxWrapperVariants: tailwind_variants.TVReturnType<{
1476
1516
  };
1477
1517
  }, undefined, tailwind_variants.TVReturnType<{
1478
1518
  size: {
1519
+ xs: string;
1479
1520
  sm: string;
1480
1521
  md: string;
1481
1522
  lg: string;
1523
+ xl: string;
1482
1524
  };
1483
1525
  fullWidth: {
1484
1526
  true: string;
@@ -1501,6 +1543,8 @@ type MnCheckboxProps = {
1501
1543
  label?: string;
1502
1544
  /** Size variant of the checkbox (default: 'md') */
1503
1545
  size?: MnCheckboxVariants['size'];
1546
+ /** Color variant of the checkbox (default: 'primary') */
1547
+ color?: MnCheckboxVariants['color'];
1504
1548
  /** Border radius variant (default: 'sm') */
1505
1549
  borderRadius?: MnCheckboxVariants['borderRadius'];
1506
1550
  /** Whether the checkbox wrapper should take full width */
@@ -3701,10 +3745,24 @@ declare class MnModalShellComponent<TResult = unknown> implements OnInit, AfterV
3701
3745
  asConfirmation(config: ModalConfig<TResult>): ConfirmationModalConfig;
3702
3746
  asCustom(config: ModalConfig<TResult>): CustomModalConfig;
3703
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;
3704
3752
  /** Whether this modal renders as a bottom sheet on small screens (default: true). */
3705
3753
  get isMobileSheet(): boolean;
3706
- /** 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
+ */
3707
3764
  startClosing(): Promise<void>;
3765
+ private prefersReducedMotion;
3708
3766
  onEscapeKey(event: Event): void;
3709
3767
  onBackdropClick(): void;
3710
3768
  onCloseButtonClick(): void;