@scbt-ecom/ui 0.102.1 → 0.104.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.
@@ -21,4 +21,11 @@ export declare const baseDefaultMessages: {
21
21
  DATE_MAX: (max: Date | string) => string;
22
22
  INVALID_REGEX_STRING: () => string;
23
23
  INVALID_URL: () => string;
24
+ PASSPORT_INVALID_TYPE: () => string;
25
+ PASSPORT_NON_EMPTY: () => string;
26
+ PASSPORT_PART_OR_NUMBER_NON_EMPTY: () => string;
27
+ INVALID_PASSPORT_PART: () => string;
28
+ INVALID_PASSPORT_NUMBER: () => string;
29
+ DEPARTMENT_NON_EMPTY: () => string;
30
+ INVALID_DEPARTMENT: () => string;
24
31
  };
@@ -2,6 +2,8 @@ import { getBooleanSchema } from './boolean.validators';
2
2
  import { getDateSchema } from './date.validators';
3
3
  import { getEmailSchema } from './email.validators';
4
4
  import { getNumberSchema } from './number.validators';
5
+ import { getPassportSchema } from './passport.validators';
6
+ import { getPassportDepartmentSchema } from './passportDepartment.validators';
5
7
  import { getPhoneSchema } from './phone.validators';
6
8
  import { getRegexSchema } from './regex.validators';
7
9
  import { getSelectSchema } from './select.validators';
@@ -19,4 +21,6 @@ export declare const baseValidationSchemas: {
19
21
  getUrlSchema: typeof getUrlSchema;
20
22
  getRegexSchema: typeof getRegexSchema;
21
23
  getBooleanSchema: typeof getBooleanSchema;
24
+ getPassportDepartmentSchema: typeof getPassportDepartmentSchema;
25
+ getPassportSchema: typeof getPassportSchema;
22
26
  };
@@ -0,0 +1,28 @@
1
+ import { default as z } from 'zod';
2
+ export type PassportValidationOptions = {
3
+ /**
4
+ * значение по умолчанию
5
+ * @default undefined
6
+ */
7
+ defaultValue?: string;
8
+ message?: Partial<Record<'empty' | 'root' | 'invalidPart' | 'invalidNumber', string>>;
9
+ };
10
+ /**
11
+ * Схема валидации обязательного поля паспорта
12
+ */
13
+ declare const getPassportRequired: (props?: PassportValidationOptions) => z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
14
+ type PassportRequiredSchema = ReturnType<typeof getPassportRequired>;
15
+ /**
16
+ * Схема валидации обязательного поля паспорта
17
+ * @param {PassportValidationOptions} props настройки схемы
18
+ * @typeParam `message` - `{ [root]: string }`
19
+ * @returns схема валидации поля в соответствии с настройками
20
+ *
21
+ * @example with required min value
22
+ * z.object({
23
+ * field: zodValidators.base.getPassportSchema()
24
+ * })
25
+ * // will return z.string()
26
+ */
27
+ export declare function getPassportSchema(props?: PassportValidationOptions): PassportRequiredSchema;
28
+ export {};
@@ -0,0 +1,28 @@
1
+ import { default as z } from 'zod';
2
+ export type PassportDepartmentValidationOptions = {
3
+ /**
4
+ * значение по умолчанию
5
+ * @default undefined
6
+ */
7
+ defaultValue?: string;
8
+ message?: Partial<Record<'empty' | 'root' | 'invalidDepartment', string>>;
9
+ };
10
+ /**
11
+ * Схема валидации обязательного поля паспорта
12
+ */
13
+ declare const getPassportDepartmentRequired: (props?: PassportDepartmentValidationOptions) => z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
14
+ type PassportDepartmentRequiredSchema = ReturnType<typeof getPassportDepartmentRequired>;
15
+ /**
16
+ * Схема валидации обязательного поля кода подразделения паспорта
17
+ * @param {PassportDepartmentValidationOptions} props настройки схемы
18
+ * @typeParam `message` - `{ ['empty' | 'root' | 'invalidDepartment']: string }`
19
+ * @returns схема валидации поля в соответствии с настройками
20
+ *
21
+ * @example with required value
22
+ * z.object({
23
+ * field: zodValidators.base.getPassportDepartmentSchema()
24
+ * })
25
+ * // will return z.string()
26
+ */
27
+ export declare function getPassportDepartmentSchema(props?: PassportDepartmentValidationOptions): PassportDepartmentRequiredSchema;
28
+ export {};
@@ -16,6 +16,8 @@ export declare const zodValidators: {
16
16
  getUrlSchema: typeof import('./base/url.validators').getUrlSchema;
17
17
  getRegexSchema: typeof import('./base/regex.validators').getRegexSchema;
18
18
  getBooleanSchema: typeof import('./base/boolean.validators').getBooleanSchema;
19
+ getPassportDepartmentSchema: typeof import('./base/passportDepartment.validators').getPassportDepartmentSchema;
20
+ getPassportSchema: typeof import('./base/passport.validators').getPassportSchema;
19
21
  };
20
22
  dadata: {
21
23
  getFioSchema: typeof import('./dadata').getFioSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scbt-ecom/ui",
3
- "version": "0.102.1",
3
+ "version": "0.104.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {