@mk-kit/ui 0.44.0 → 0.46.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.
@@ -1212,21 +1212,37 @@ declare const MK_DEFAULT_I18N: MkI18nStrings;
1212
1212
  */
1213
1213
  declare const MK_I18N: InjectionToken<MkI18nStrings>;
1214
1214
  /**
1215
- * Provide localised strings (merged over the English defaults) — pass any
1216
- * subset. The nested `dateNames`, `blockEditor` and `validation` groups are
1217
- * merged deeply, so partial overrides of those work too.
1215
+ * Any subset of {@link MkI18nStrings}; the nested `dateNames`, `blockEditor`
1216
+ * and `validation` groups may be partial too (they are merged deeply).
1217
+ */
1218
+ type MkI18nOverrides = Partial<Omit<MkI18nStrings, 'dateNames' | 'blockEditor' | 'validation'>> & {
1219
+ dateNames?: Partial<MkDateNames>;
1220
+ blockEditor?: Partial<MkBlockEditorStrings>;
1221
+ validation?: Partial<MkValidationStrings>;
1222
+ };
1223
+ /**
1224
+ * Merges `overrides` over a complete string map — shallow for the top level,
1225
+ * deep for the `dateNames`, `blockEditor` and `validation` groups. Exported
1226
+ * so locale packs and tests can build a map without providing it.
1227
+ */
1228
+ declare function mkMergeI18n(base: MkI18nStrings, overrides: MkI18nOverrides): MkI18nStrings;
1229
+ /**
1230
+ * Provide localised strings — pass any subset, merged over `base` (the
1231
+ * English defaults unless given). The nested `dateNames`, `blockEditor` and
1232
+ * `validation` groups are merged deeply, so partial overrides of those work
1233
+ * too.
1218
1234
  *
1219
1235
  * ```ts
1220
1236
  * bootstrapApplication(App, {
1221
1237
  * providers: [provideMkI18n({ noResults: 'Brak wyników', close: 'Zamknij' })],
1222
1238
  * });
1223
1239
  * ```
1240
+ *
1241
+ * A locale pack is a complete map that serves as the base — either through
1242
+ * its own helper (`provideMkI18nPl(overrides)` from `@mk-kit/ui/locales/pl`)
1243
+ * or explicitly: `provideMkI18n(overrides, MK_PL_I18N)`.
1224
1244
  */
1225
- declare function provideMkI18n(overrides: Partial<Omit<MkI18nStrings, 'dateNames' | 'blockEditor' | 'validation'>> & {
1226
- dateNames?: Partial<MkDateNames>;
1227
- blockEditor?: Partial<MkBlockEditorStrings>;
1228
- validation?: Partial<MkValidationStrings>;
1229
- }): Provider;
1245
+ declare function provideMkI18n(overrides: MkI18nOverrides, base?: MkI18nStrings): Provider;
1230
1246
 
1231
1247
  /**
1232
1248
  * Field context — the contract a field wrapper (`mk-form-field`) exposes to
@@ -1473,5 +1489,5 @@ declare function mkQueryOperatorLabel(op: MkQueryOperator, i18n?: MkI18nStrings)
1473
1489
  */
1474
1490
  declare function mkQueryToText(group: MkQueryGroup, fields?: readonly MkQueryField[], i18n?: MkI18nStrings): string;
1475
1491
 
1476
- export { MK_BREAKPOINTS, MK_DEFAULT_BREAKPOINTS, MK_DEFAULT_DATE_NAMES, MK_DEFAULT_I18N, MK_DEFAULT_VALIDATION, MK_I18N, MK_OVERLAY_DATA, MK_QUERY_OPERATORS, MK_QUERY_UNARY, MkAnchoredPanel, MkBreakpointService, MkFieldContext, MkFocusTrap, MkLiveAnnouncer, MkOverlayRef, MkOverlayService, MkThemeService, mkComputeAnchoredPosition, mkCreateQueryGroup, mkCreateQueryRule, mkFirstErrorMessage, mkGetFocusable, mkHighlight, mkHighlightJson, mkInjectFieldTouched, mkIsQueryGroup, mkIsResponsive, mkQueryCompact, mkQueryIsEmpty, mkQueryOperatorLabel, mkQueryOperatorsFor, mkQueryRuleCount, mkQueryRuleIsComplete, mkQueryRuleMatches, mkQueryToPredicate, mkQueryToText, mkSignalErrorMessage, mkSignalErrorsToValidationErrors, mkUniqueId, mkValidatorChange, provideMkI18n };
1477
- export type { MkAnchoredPosition, MkAnchoredPositionOptions, MkAriaLivePoliteness, MkBlockEditorStrings, MkBreakpoint, MkBreakpoints, MkCodeLanguage, MkContrastPreference, MkDateNames, MkDensity, MkErrorMessages, MkI18nStrings, MkOverlayConfig, MkPlacement, MkQueryCombinator, MkQueryField, MkQueryFieldOption, MkQueryGroup, MkQueryNode, MkQueryOperator, MkQueryRule, MkQueryValueType, MkResolvedContrast, MkResolvedTheme, MkResponsive, MkSignalValidationError, MkSize$1 as MkSize, MkSortAnnounceDirection, MkThemePreference, MkTone, MkValidationStrings, MkValidatorChangeRef, MkVariant };
1492
+ export { MK_BREAKPOINTS, MK_DEFAULT_BREAKPOINTS, MK_DEFAULT_DATE_NAMES, MK_DEFAULT_I18N, MK_DEFAULT_VALIDATION, MK_I18N, MK_OVERLAY_DATA, MK_QUERY_OPERATORS, MK_QUERY_UNARY, MkAnchoredPanel, MkBreakpointService, MkFieldContext, MkFocusTrap, MkLiveAnnouncer, MkOverlayRef, MkOverlayService, MkThemeService, mkComputeAnchoredPosition, mkCreateQueryGroup, mkCreateQueryRule, mkFirstErrorMessage, mkGetFocusable, mkHighlight, mkHighlightJson, mkInjectFieldTouched, mkIsQueryGroup, mkIsResponsive, mkMergeI18n, mkQueryCompact, mkQueryIsEmpty, mkQueryOperatorLabel, mkQueryOperatorsFor, mkQueryRuleCount, mkQueryRuleIsComplete, mkQueryRuleMatches, mkQueryToPredicate, mkQueryToText, mkSignalErrorMessage, mkSignalErrorsToValidationErrors, mkUniqueId, mkValidatorChange, provideMkI18n };
1493
+ export type { MkAnchoredPosition, MkAnchoredPositionOptions, MkAriaLivePoliteness, MkBlockEditorStrings, MkBreakpoint, MkBreakpoints, MkCodeLanguage, MkContrastPreference, MkDateNames, MkDensity, MkErrorMessages, MkI18nOverrides, MkI18nStrings, MkOverlayConfig, MkPlacement, MkQueryCombinator, MkQueryField, MkQueryFieldOption, MkQueryGroup, MkQueryNode, MkQueryOperator, MkQueryRule, MkQueryValueType, MkResolvedContrast, MkResolvedTheme, MkResponsive, MkSignalValidationError, MkSize$1 as MkSize, MkSortAnnounceDirection, MkThemePreference, MkTone, MkValidationStrings, MkValidatorChangeRef, MkVariant };
@@ -3059,9 +3059,9 @@ declare class MkCurrencyInput implements ControlValueAccessor, Validator {
3059
3059
  type MkCardBrand = 'visa' | 'mastercard' | 'amex' | 'discover' | 'diners' | 'jcb';
3060
3060
  /** Human-readable names for the recognised brands. */
3061
3061
  declare const MK_CARD_BRAND_NAMES: Record<MkCardBrand, string>;
3062
- /** Detect the card network from the leading digits (IIN ranges). */
3062
+ /** Detect the card network from the leading digits `detectCardBrand` from `@mk-kit/validators`. */
3063
3063
  declare function mkDetectCardBrand(digits: string): MkCardBrand | null;
3064
- /** Luhn (mod 10) checksum over a digit string. */
3064
+ /** Luhn (mod 10) checksum over a digit string — `isLuhn` from `@mk-kit/validators`. */
3065
3065
  declare function mkLuhnCheck(digits: string): boolean;
3066
3066
  /**
3067
3067
  * CardNumberInput — a payment-card number field that groups digits with the
@@ -3144,14 +3144,18 @@ declare class MkCardNumberInput implements ControlValueAccessor, Validator {
3144
3144
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkCardNumberInput, "mk-card-number-input", ["mkCardNumberInput"], { "showBrand": { "alias": "showBrand"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "brandChange": "brandChange"; }, never, never, true, never>;
3145
3145
  }
3146
3146
 
3147
- /** IBAN length per ISO 13616 country code (SEPA + common others). */
3148
- declare const MK_IBAN_LENGTHS: Readonly<Record<string, number>>;
3149
3147
  /**
3150
- * ISO 13616 mod-97 check over a compact (no spaces, uppercase) IBAN.
3151
- * Assumes the shape `CC00…` has already been length-checked by the caller.
3148
+ * IBAN lengths per country re-exported from `@mk-kit/validators`
3149
+ * (`IBAN_LENGTHS`, the SWIFT registry).
3152
3150
  */
3151
+ declare const MK_IBAN_LENGTHS: Readonly<Record<string, number>>;
3152
+ /** ISO 7064 MOD 97-10 over a compact (uppercase, no separators) IBAN. */
3153
3153
  declare function mkIbanChecksum(compact: string): boolean;
3154
- /** Full IBAN validity: known country, exact length, mod-97 check. */
3154
+ /**
3155
+ * Shape, the registry length for the country and the checksum — delegates
3156
+ * to `isIban` from `@mk-kit/validators`. Unlike that function this one keeps
3157
+ * the input kit's stricter rule that the country must be in the table.
3158
+ */
3155
3159
  declare function mkIbanIsValid(compact: string): boolean;
3156
3160
  /**
3157
3161
  * Reactive-forms validator for an IBAN (any supported country). Empty values
@@ -3259,9 +3263,8 @@ interface MkTaxIdFormat {
3259
3263
  validate?: (compact: string) => boolean;
3260
3264
  }
3261
3265
  /**
3262
- * Polish NIP checksum: the weighted sum of the first nine digits modulo 11 is
3263
- * the tenth (check) digit. A remainder of 10 can never be a digit, so such a
3264
- * number is invalid whatever its last digit.
3266
+ * Polish NIP checksum delegates to `isNip` from `@mk-kit/validators`
3267
+ * (weights 6-5-7-2-3-4-5-6-7 mod 11; a remainder of 10 is invalid).
3265
3268
  */
3266
3269
  declare function mkNipChecksum(compact: string): boolean;
3267
3270
  /**
@@ -0,0 +1,42 @@
1
+ import { Provider } from '@angular/core';
2
+ import { MkBlockEditorStrings, MkDateNames, MkI18nStrings, MkValidationStrings, MkI18nOverrides } from '@mk-kit/ui/core';
3
+
4
+ /**
5
+ * Picks the Polish plural form for a count: `one` for 1, `few` for 2–4
6
+ * (except 12–14), `many` otherwise — CLDR's `pl` rules for integers, which is
7
+ * all the library's counts ever are.
8
+ *
9
+ * ```ts
10
+ * mkPluralPl(1, 'wynik', 'wyniki', 'wyników'); // 'wynik'
11
+ * mkPluralPl(3, 'wynik', 'wyniki', 'wyników'); // 'wyniki'
12
+ * mkPluralPl(12, 'wynik', 'wyniki', 'wyników'); // 'wyników'
13
+ * ```
14
+ */
15
+ declare function mkPluralPl(count: number, one: string, few: string, many: string): string;
16
+ /** Polish month and weekday names (Sunday-first, lowercase as in `Intl`). */
17
+ declare const MK_PL_DATE_NAMES: MkDateNames;
18
+ /** Polish validation messages rendered by `mk-form-field`. */
19
+ declare const MK_PL_VALIDATION: MkValidationStrings;
20
+ /** Polish strings of the block editor's chrome. */
21
+ declare const MK_PL_BLOCK_EDITOR: MkBlockEditorStrings;
22
+ /**
23
+ * The complete Polish string map — every key of {@link MkI18nStrings},
24
+ * `locale: 'pl-PL'` and `currency: 'PLN'` for the formatting pipes.
25
+ * Provide it whole with {@link provideMkI18nPl}, or pass it as the base of
26
+ * `provideMkI18n(overrides, MK_PL_I18N)`.
27
+ */
28
+ declare const MK_PL_I18N: MkI18nStrings;
29
+ /**
30
+ * Provides the Polish strings — {@link MK_PL_I18N} with any `overrides`
31
+ * merged on top (deep for `dateNames`, `blockEditor` and `validation`, like
32
+ * `provideMkI18n`).
33
+ *
34
+ * ```ts
35
+ * bootstrapApplication(App, {
36
+ * providers: [provideMkI18nPl({ noData: 'Nic tu nie ma' })],
37
+ * });
38
+ * ```
39
+ */
40
+ declare function provideMkI18nPl(overrides?: MkI18nOverrides): Provider;
41
+
42
+ export { MK_PL_BLOCK_EDITOR, MK_PL_DATE_NAMES, MK_PL_I18N, MK_PL_VALIDATION, mkPluralPl, provideMkI18nPl };