@scbt-ecom/ui 0.30.1 → 0.31.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.
Files changed (123) hide show
  1. package/dist/{CustomLink-CKaoTS8A.js → CustomLink-DmltAHJD.js} +5 -5
  2. package/dist/CustomLink-DmltAHJD.js.map +1 -0
  3. package/dist/mergeRefs-qDToYXtM.js +12 -0
  4. package/dist/mergeRefs-qDToYXtM.js.map +1 -0
  5. package/dist/shared/ui/accordion/Accordion.d.ts +6 -8
  6. package/dist/shared/ui/accordion/index.d.ts +1 -1
  7. package/dist/shared/ui/accordion/ui/AccordionHeader.d.ts +9 -4
  8. package/dist/shared/ui/badge/Badge.d.ts +2 -2
  9. package/dist/shared/ui/brandLogos/BrandLogos.d.ts +3 -3
  10. package/dist/shared/ui/breadcrumbs/Breadcrumbs.d.ts +6 -6
  11. package/dist/shared/ui/button/Button.d.ts +3 -3
  12. package/dist/shared/ui/button/index.d.ts +1 -1
  13. package/dist/shared/ui/button/model/helpers.d.ts +2 -2
  14. package/dist/shared/ui/buttonIcon/ButtonIcon.d.ts +4 -4
  15. package/dist/shared/ui/customLink/CustomLink.d.ts +7 -7
  16. package/dist/shared/ui/document/Document.d.ts +3 -3
  17. package/dist/shared/ui/floatButton/FloatButton.d.ts +6 -6
  18. package/dist/shared/ui/formElements/controlled/index.d.ts +7 -11
  19. package/dist/shared/ui/formElements/controlled/input/InputControl.d.ts +1 -0
  20. package/dist/shared/ui/formElements/controlled/textarea/TextareaControl.d.ts +1 -0
  21. package/dist/shared/ui/formElements/uncontrolled/checkbox/Checkbox.d.ts +2 -1
  22. package/dist/shared/ui/formElements/uncontrolled/dayPicker/DayPicker.d.ts +15 -2
  23. package/dist/shared/ui/formElements/uncontrolled/index.d.ts +7 -12
  24. package/dist/shared/ui/formElements/uncontrolled/radio/RadioGroup.d.ts +2 -0
  25. package/dist/shared/ui/formElements/uncontrolled/radio/ui/RadioItem.d.ts +1 -2
  26. package/dist/shared/ui/formElements/uncontrolled/select/Select.d.ts +1 -1
  27. package/dist/shared/ui/formElements/uncontrolled/select/ui/SelectItem.d.ts +3 -1
  28. package/dist/shared/ui/formElements/uncontrolled/textarea/Textarea.d.ts +1 -1
  29. package/dist/shared/ui/formElements/uncontrolled/uploader/UploaderBase.d.ts +3 -3
  30. package/dist/shared/ui/heading/Heading.d.ts +2 -2
  31. package/dist/shared/ui/hint/Hint.d.ts +4 -4
  32. package/dist/shared/ui/icon/Icon.d.ts +2 -2
  33. package/dist/shared/ui/icon/index.d.ts +1 -1
  34. package/dist/shared/ui/keyboardShortcuts/KeyboardShortcuts.d.ts +4 -4
  35. package/dist/shared/ui/ligal/Ligal.d.ts +4 -4
  36. package/dist/shared/ui/loader/Loader.d.ts +2 -2
  37. package/dist/shared/ui/modal/Modal.d.ts +4 -4
  38. package/dist/shared/ui/modal/ui/ModalHeader.d.ts +2 -2
  39. package/dist/shared/ui/notification/Notification.d.ts +2 -2
  40. package/dist/shared/ui/notification/index.d.ts +1 -1
  41. package/dist/shared/ui/notification/ui/CustomToast.d.ts +3 -3
  42. package/dist/shared/ui/phoneView/PhoneView.d.ts +4 -4
  43. package/dist/shared/ui/popover/Popover.d.ts +6 -6
  44. package/dist/shared/ui/progressBar/ProgressBar.d.ts +2 -2
  45. package/dist/shared/ui/providers/NotificationProvider.d.ts +2 -2
  46. package/dist/shared/ui/providers/index.d.ts +1 -1
  47. package/dist/shared/ui/responsiveContainer/ResponsiveContainer.d.ts +2 -2
  48. package/dist/shared/ui/section/Section.d.ts +2 -2
  49. package/dist/shared/ui/skeleton/Skeleton.d.ts +2 -2
  50. package/dist/shared/ui/tabSwitcher/TabsSwitcher.d.ts +5 -5
  51. package/dist/shared/ui/tabSwitcher/model/types.d.ts +4 -4
  52. package/dist/shared/ui/tabSwitcher/ui/TabContent.d.ts +4 -4
  53. package/dist/shared/utils/typeGuards.d.ts +1 -1
  54. package/dist/shared/validation/base/base.constants.d.ts +17 -0
  55. package/dist/shared/validation/base/date.validators.d.ts +48 -0
  56. package/dist/shared/validation/base/email.validators.d.ts +34 -0
  57. package/dist/shared/validation/base/index.d.ts +1 -0
  58. package/dist/shared/validation/base/number.validators.d.ts +37 -0
  59. package/dist/shared/validation/base/phone.validators.d.ts +48 -0
  60. package/dist/shared/validation/base/select.validators.d.ts +60 -0
  61. package/dist/shared/validation/base/string.validators.d.ts +45 -0
  62. package/dist/shared/validation/base/union.validators.d.ts +35 -0
  63. package/dist/{typeGuards-CaNkXs7N.js → typeGuards-B82KZ2oS.js} +3 -12
  64. package/dist/typeGuards-B82KZ2oS.js.map +1 -0
  65. package/dist/ui.js +1736 -1757
  66. package/dist/ui.js.map +1 -1
  67. package/dist/{parse-C_80L3wX.js → utils-b38KjjXe.js} +1060 -1030
  68. package/dist/utils-b38KjjXe.js.map +1 -0
  69. package/dist/utils.js +5 -4
  70. package/dist/utils.js.map +1 -1
  71. package/dist/validation.js +198 -39
  72. package/dist/validation.js.map +1 -1
  73. package/dist/widget.js +186 -184
  74. package/dist/widget.js.map +1 -1
  75. package/dist/widgets/advantages/Advantages.d.ts +10 -14
  76. package/dist/widgets/advantages/index.d.ts +1 -1
  77. package/dist/widgets/advantages/model/index.d.ts +1 -0
  78. package/dist/widgets/advantages/model/types.d.ts +4 -0
  79. package/dist/widgets/authProvider/AuthProvider.d.ts +2 -2
  80. package/dist/widgets/authProvider/model/types.d.ts +23 -23
  81. package/dist/widgets/authProvider/ui/ui/AuthWrapper.d.ts +6 -6
  82. package/dist/widgets/authProvider/ui/ui/Links.d.ts +2 -2
  83. package/dist/widgets/banner/Banner.d.ts +10 -25
  84. package/dist/widgets/banner/index.d.ts +1 -1
  85. package/dist/widgets/banner/model/index.d.ts +1 -0
  86. package/dist/widgets/banner/model/types.d.ts +18 -0
  87. package/dist/widgets/banner/ui/BannerButtonsGroup.d.ts +9 -9
  88. package/dist/widgets/banner/ui/banners/BannerImageFull.d.ts +2 -2
  89. package/dist/widgets/banner/ui/banners/BannerWithSeparateImg.d.ts +2 -2
  90. package/dist/widgets/benefit/Benefit.d.ts +9 -9
  91. package/dist/widgets/benefit/index.d.ts +1 -1
  92. package/dist/widgets/benefit/model/types.d.ts +2 -2
  93. package/dist/widgets/benefit/ui/BenefitItem.d.ts +10 -10
  94. package/dist/widgets/footer/Footer.d.ts +8 -8
  95. package/dist/widgets/footer/index.d.ts +1 -1
  96. package/dist/widgets/footer/model/defaultValues.d.ts +4 -4
  97. package/dist/widgets/footer/model/types.d.ts +12 -12
  98. package/dist/widgets/footer/ui/Copyright.d.ts +4 -4
  99. package/dist/widgets/footer/ui/FooterLogo.d.ts +4 -4
  100. package/dist/widgets/footer/ui/NavLinks.d.ts +6 -6
  101. package/dist/widgets/footer/ui/PhonesBlock.d.ts +6 -6
  102. package/dist/widgets/footer/ui/SiteMap.d.ts +4 -4
  103. package/dist/widgets/footer/ui/SocialLinks.d.ts +4 -4
  104. package/dist/widgets/interLinking/InterLinking.d.ts +11 -11
  105. package/dist/widgets/interLinking/model/types.d.ts +3 -3
  106. package/dist/widgets/interLinking/ui/Column.d.ts +8 -8
  107. package/dist/widgets/interLinking/ui/ColumnGroup.d.ts +11 -11
  108. package/dist/widgets/interLinking/ui/LinksList.d.ts +6 -6
  109. package/dist/widgets/longBanner/LongBanner.d.ts +4 -4
  110. package/dist/widgets/longBanner/index.d.ts +1 -1
  111. package/dist/widgets/longBanner/model/types.d.ts +10 -10
  112. package/dist/widgets/longBanner/ui/TextItem.d.ts +2 -2
  113. package/dist/widgets/longBanner/ui/TextList.d.ts +4 -4
  114. package/dist/widgets/longBanner/ui/Title.d.ts +4 -4
  115. package/dist/widgets/pageHeader/PageHeader.d.ts +2 -2
  116. package/dist/widgets/pageHeader/model/helpers.d.ts +2 -2
  117. package/dist/widgets/pageHeader/model/types.d.ts +11 -11
  118. package/dist/widgets/stepper/index.d.ts +1 -1
  119. package/package.json +1 -1
  120. package/dist/CustomLink-CKaoTS8A.js.map +0 -1
  121. package/dist/parse-C_80L3wX.js.map +0 -1
  122. package/dist/shared/validation/index.d.ts +0 -3
  123. package/dist/typeGuards-CaNkXs7N.js.map +0 -1
@@ -12,10 +12,10 @@ type TLoaderClasses = {
12
12
  loader?: string;
13
13
  text?: string;
14
14
  };
15
- export interface ILoaderProps extends VariantProps<typeof loaderConfig>, VariantProps<typeof wrapperConfig>, Omit<HTMLAttributes<HTMLDivElement>, 'className'> {
15
+ export interface LoaderProps extends VariantProps<typeof loaderConfig>, VariantProps<typeof wrapperConfig>, Omit<HTMLAttributes<HTMLDivElement>, 'className'> {
16
16
  intent?: 'primary' | 'secondary' | null;
17
17
  text?: ReactElement | string;
18
18
  classes?: TLoaderClasses;
19
19
  }
20
- export declare const Loader: ({ size, classes, intent, position, text, ...props }: ILoaderProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const Loader: ({ size, classes, intent, position, text, ...props }: LoaderProps) => import("react/jsx-runtime").JSX.Element;
21
21
  export {};
@@ -1,19 +1,19 @@
1
1
  import { TModalHeaderClasses } from './ui/ModalHeader';
2
2
  import * as React from 'react';
3
- type IModalClasses = {
3
+ type ModalClasses = {
4
4
  overlay?: string;
5
5
  modal?: string;
6
6
  content?: string;
7
7
  modalHeader?: TModalHeaderClasses;
8
8
  };
9
- export interface IModalProps {
9
+ export interface ModalProps {
10
10
  children: React.ReactElement;
11
11
  isModalOpen: boolean;
12
- classes?: IModalClasses;
12
+ classes?: ModalClasses;
13
13
  isPortal?: boolean;
14
14
  portalContainer?: HTMLElement;
15
15
  title?: string | React.ReactElement;
16
16
  closeModal: () => void;
17
17
  }
18
- export declare const Modal: ({ title, children, isModalOpen, isPortal, portalContainer, closeModal, classes }: IModalProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const Modal: ({ title, children, isModalOpen, isPortal, portalContainer, closeModal, classes }: ModalProps) => import("react/jsx-runtime").JSX.Element;
19
19
  export {};
@@ -1,10 +1,10 @@
1
- import { IModalProps } from '../Modal';
1
+ import { ModalProps } from '../Modal';
2
2
  export type TModalHeaderClasses = {
3
3
  header?: string;
4
4
  title?: string;
5
5
  icon?: string;
6
6
  };
7
- export interface IModalHeaderProps extends Pick<IModalProps, 'closeModal' | 'title'> {
7
+ export interface IModalHeaderProps extends Pick<ModalProps, 'closeModal' | 'title'> {
8
8
  classes?: TModalHeaderClasses;
9
9
  }
10
10
  export declare const ModalHeader: ({ title, closeModal, classes }: IModalHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
- export interface INotificationProps {
2
+ export interface NotificationProps {
3
3
  duration?: number;
4
4
  intent: 'info' | 'error';
5
5
  text: string | ReactElement;
@@ -7,4 +7,4 @@ export interface INotificationProps {
7
7
  content?: ReactElement;
8
8
  closure?: boolean;
9
9
  }
10
- export declare const Notification: (props: INotificationProps) => string | null;
10
+ export declare const Notification: (props: NotificationProps) => string | null;
@@ -1 +1 @@
1
- export { Notification, type INotificationProps } from './Notification';
1
+ export { Notification, type NotificationProps } from './Notification';
@@ -1,10 +1,10 @@
1
1
  import { Toast } from 'react-hot-toast';
2
2
  import { VariantProps } from 'class-variance-authority';
3
- import { INotificationProps } from '../Notification';
3
+ import { NotificationProps } from '../Notification';
4
4
  declare const toastContainerConfig: (props?: ({
5
- intent?: "error" | "info" | null | undefined;
5
+ intent?: "info" | "error" | null | undefined;
6
6
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
7
  type TContainerConfig = VariantProps<typeof toastContainerConfig>;
8
- export type ICustomToastProps = INotificationProps & TContainerConfig & Toast;
8
+ export type ICustomToastProps = NotificationProps & TContainerConfig & Toast;
9
9
  export declare const CustomToast: ({ intent, text, customIcon, closure, content, id }: ICustomToastProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export {};
@@ -1,13 +1,13 @@
1
1
  import { HTMLAttributes } from 'react';
2
- interface IPhoneViewClasses {
2
+ interface PhoneViewClasses {
3
3
  wrapper?: string;
4
4
  link?: string;
5
5
  text?: string;
6
6
  }
7
- export interface IPhoneViewProps extends HTMLAttributes<HTMLDivElement> {
7
+ export interface PhoneViewProps extends HTMLAttributes<HTMLDivElement> {
8
8
  phone: string;
9
9
  text: string;
10
- classes?: IPhoneViewClasses;
10
+ classes?: PhoneViewClasses;
11
11
  }
12
- export declare const PhoneView: ({ phone, text, classes, ...props }: IPhoneViewProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const PhoneView: ({ phone, text, classes, ...props }: PhoneViewProps) => import("react/jsx-runtime").JSX.Element;
13
13
  export {};
@@ -1,7 +1,7 @@
1
1
  import { ReactElement, ReactNode } from 'react';
2
- import { PopoverContentProps as TPopoverContentPropsBase } from '@radix-ui/react-popover';
2
+ import { PopoverContentProps as PopoverContentPropsBase } from '@radix-ui/react-popover';
3
3
  import * as PopoverPrimitive from '@radix-ui/react-popover';
4
- type TPopoverClasses = {
4
+ type PopoverClasses = {
5
5
  root?: string;
6
6
  content?: string;
7
7
  trigger?: string;
@@ -9,7 +9,7 @@ type TPopoverClasses = {
9
9
  closeIcon?: string;
10
10
  closeTrigger?: string;
11
11
  };
12
- interface IPopoverContentProps extends TPopoverContentPropsBase {
12
+ interface PopoverContentProps extends PopoverContentPropsBase {
13
13
  sideOffset?: number;
14
14
  alignOffset?: number;
15
15
  align?: 'end' | 'center' | 'start';
@@ -17,11 +17,11 @@ interface IPopoverContentProps extends TPopoverContentPropsBase {
17
17
  defaultOpen?: boolean;
18
18
  avoidCollisions?: boolean;
19
19
  }
20
- export interface IPopoverProps extends IPopoverContentProps {
20
+ export interface PopoverProps extends PopoverContentProps {
21
21
  triggerElement: ReactElement;
22
22
  children: ReactNode;
23
- classes?: TPopoverClasses;
23
+ classes?: PopoverClasses;
24
24
  portalContainer?: PopoverPrimitive.PopoverPortalProps['container'];
25
25
  }
26
- export declare const Popover: ({ triggerElement, classes, sideOffset, alignOffset, align, side, defaultOpen, avoidCollisions, children, arrowPadding, portalContainer, ...contentProps }: IPopoverProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const Popover: ({ triggerElement, classes, sideOffset, alignOffset, align, side, defaultOpen, avoidCollisions, children, arrowPadding, portalContainer, ...contentProps }: PopoverProps) => import("react/jsx-runtime").JSX.Element;
27
27
  export {};
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- type IProgressBarClasses = {
2
+ type ProgressBarClasses = {
3
3
  root?: string;
4
4
  topContent?: string;
5
5
  bottomContent?: string;
@@ -12,7 +12,7 @@ export interface IProgressBarProps {
12
12
  bottomContent?: React.ReactElement;
13
13
  progress: number;
14
14
  maxPercent?: number;
15
- classes?: IProgressBarClasses;
15
+ classes?: ProgressBarClasses;
16
16
  }
17
17
  export declare const ProgressBar: ({ topContent, bottomContent, progress, maxPercent, classes }: IProgressBarProps) => import("react/jsx-runtime").JSX.Element;
18
18
  export {};
@@ -1,5 +1,5 @@
1
- export interface INotificationProviderProps {
1
+ export interface NotificationProviderProps {
2
2
  maxToastViewLimit?: number;
3
3
  toastDuration?: number;
4
4
  }
5
- export declare const NotificationProvider: ({ maxToastViewLimit, toastDuration }: INotificationProviderProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const NotificationProvider: ({ maxToastViewLimit, toastDuration }: NotificationProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export { NotificationProvider, type INotificationProviderProps } from './NotificationProvider';
1
+ export { NotificationProvider, type NotificationProviderProps } from './NotificationProvider';
@@ -1,7 +1,7 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
- export interface IResponsiveContainerProps extends HTMLAttributes<HTMLDivElement> {
2
+ export interface ResponsiveContainerProps extends HTMLAttributes<HTMLDivElement> {
3
3
  children: ReactNode;
4
4
  className?: string;
5
5
  offset?: boolean;
6
6
  }
7
- export declare const ResponsiveContainer: ({ children, offset, className, ...props }: IResponsiveContainerProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const ResponsiveContainer: ({ children, offset, className, ...props }: ResponsiveContainerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
- export interface ISectionProps extends HTMLAttributes<HTMLDivElement> {
2
+ export interface SectionProps extends HTMLAttributes<HTMLDivElement> {
3
3
  children: ReactNode;
4
4
  className?: string;
5
5
  }
6
- export declare const Section: ({ children, className, ...props }: ISectionProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const Section: ({ children, className, ...props }: SectionProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- export interface ISkeletonProps {
1
+ export interface SkeletonProps {
2
2
  className?: string;
3
3
  }
4
- export declare const Skeleton: ({ className }: ISkeletonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const Skeleton: ({ className }: SkeletonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,9 @@
1
- import { ITabRenderContent, TTabsClasses } from './model/types';
2
- export interface ITabsSwitcherProps {
3
- renderContent: ITabRenderContent;
1
+ import { TabRenderContent, TabsClasses } from './model/types';
2
+ export interface TabsSwitcherProps {
3
+ renderContent: TabRenderContent;
4
4
  value: string;
5
5
  onChangeTab: (tab: string) => void;
6
6
  defaultActiveTabId?: string;
7
- classes?: TTabsClasses;
7
+ classes?: TabsClasses;
8
8
  }
9
- export declare const TabsSwitcher: ({ renderContent, defaultActiveTabId, value, onChangeTab, classes }: ITabsSwitcherProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const TabsSwitcher: ({ renderContent, defaultActiveTabId, value, onChangeTab, classes }: TabsSwitcherProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,9 @@
1
- import { TTabContentClasses } from '../ui/TabContent';
2
- export type TTabsClasses = {
1
+ import { TabContentClasses } from '../ui/TabContent';
2
+ export type TabsClasses = {
3
3
  root?: string;
4
4
  list?: string;
5
5
  trigger?: string;
6
- tabContent?: TTabContentClasses;
6
+ tabContent?: TabContentClasses;
7
7
  };
8
8
  export interface ITabContent {
9
9
  id: string;
@@ -16,7 +16,7 @@ interface ITabTrigger {
16
16
  id: string;
17
17
  label: string;
18
18
  }
19
- export interface ITabRenderContent {
19
+ export interface TabRenderContent {
20
20
  triggers: ITabTrigger[];
21
21
  contents: ITabContent[];
22
22
  }
@@ -1,10 +1,10 @@
1
1
  import { ITabContent } from '../model/types';
2
- export type TTabContentClasses = {
2
+ export type TabContentClasses = {
3
3
  content?: string;
4
4
  contentsWrapper?: string;
5
5
  };
6
- export interface ITabContentProps {
6
+ export interface TabContentProps {
7
7
  contents: ITabContent[];
8
- classes?: TTabContentClasses;
8
+ classes?: TabContentClasses;
9
9
  }
10
- export declare const TabContent: ({ classes, contents }: ITabContentProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const TabContent: ({ classes, contents }: TabContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  export declare class TypeGuards {
2
2
  static isString(value: unknown): value is string;
3
- static isStringEmpty(value: unknown): boolean;
3
+ static isStringEmpty(value: unknown): value is string;
4
4
  static isNull(value: unknown): value is null;
5
5
  static isUndefined(value: unknown): value is undefined;
6
6
  static isNil(value: unknown): value is boolean;
@@ -0,0 +1,17 @@
1
+ import { Primitive } from 'zod';
2
+ export declare const baseDefaultMessages: {
3
+ NON_EMPTY: () => string;
4
+ MIN_LENGTH: (min: number) => string;
5
+ MAX_LENGTH: (max: number) => string;
6
+ MIN_VALUE: (min: number) => string;
7
+ MAX_VALUE: (max: number) => string;
8
+ PHONE_NON_EMPTY: () => string;
9
+ PHONE_INVALID_OPERATOR: () => string;
10
+ EMAIL_INVALID: () => string;
11
+ EMAIL_NON_EMPTY: () => string;
12
+ SELECT_NON_EMPTY: () => string;
13
+ SELECT_MULTIPLE_NON_EMPTY: (length: number) => string;
14
+ DATE_INVALID_FORMAT: () => string;
15
+ DATE_NON_EMPTY: () => string;
16
+ VALUE_OUT_OF_RANGE: <T extends Primitive>(range: T[]) => string;
17
+ };
@@ -0,0 +1,48 @@
1
+ import { default as z } from 'zod';
2
+ type DateValidationOptions = {
3
+ /**
4
+ * парсить строку с учетом ISO формата
5
+ * @default false
6
+ */
7
+ iso?: boolean;
8
+ /**
9
+ * шаблон для валидации строки (будет проигнорирован, если `iso = true`)
10
+ * @default 'dd.MM.yyyy'
11
+ */
12
+ pattern?: string;
13
+ message?: {
14
+ min?: string;
15
+ invalidDate?: string;
16
+ };
17
+ };
18
+ /**
19
+ * Схема валидации опционального поля номера телефона
20
+ * @param {DateValidationOptions} props настройки схемы
21
+ * @typeParam `iso` - `boolean | undefined` `default: false`
22
+ * @typeParam `pattern` - `string | undefined` `default: 'dd.MM.yyyy'`
23
+ * @typeParam `message` - `{ [min | invalidOperator]: string }`
24
+ * @returns схема валидации поля в соответствии с настройками
25
+ *
26
+ * @example
27
+ * z.object({
28
+ * field: zodValidators.base.getDateRequired()
29
+ * })
30
+ * // will returns z.string()
31
+ */
32
+ export declare const getDateRequired: (props?: DateValidationOptions) => z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
33
+ /**
34
+ * Схема валидации опционального поля номера телефона
35
+ * @param {DateValidationOptions} props настройки схемы
36
+ * @typeParam `iso` - `boolean | undefined` `default: false` парсить строку с учетом ISO формата
37
+ * @typeParam `pattern` - `string | undefined` `default: 'dd.MM.yyyy'` шаблон для валидации строки (будет проигнорирован, если `iso = true`)
38
+ * @typeParam `message` - `{ [min | invalidOperator]: string }`
39
+ * @returns схема валидации поля в соответствии с настройками
40
+ *
41
+ * @example
42
+ * z.object({
43
+ * field: zodValidators.base.getDateOptional()
44
+ * })
45
+ * // will returns z.string()
46
+ */
47
+ export declare const getDateOptional: (props?: DateValidationOptions) => z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string | undefined, string>, string | undefined, string>>;
48
+ export {};
@@ -0,0 +1,34 @@
1
+ import { default as z } from 'zod';
2
+ type EmailValidationOptions = {
3
+ message?: {
4
+ min?: string;
5
+ invalid?: string;
6
+ };
7
+ };
8
+ /**
9
+ * Схема валидации обязательного поля типа email
10
+ * @param {EmailValidationOptions} props настройки схемы
11
+ * @typeParam `message` - `{ [min | invalid]: string }`
12
+ * @returns схема валидации поля в соответствии с настройками
13
+ *
14
+ * @example
15
+ * z.object({
16
+ * field: zodValidators.base.getEmailRequired({ message: { min: '' } })
17
+ * })
18
+ * // will returns z.string().min(1).email()
19
+ */
20
+ export declare const getEmailRequired: (props?: EmailValidationOptions) => z.ZodDefault<z.ZodString>;
21
+ /**
22
+ * Схема валидации опционального поля типа email
23
+ * @param {EmailValidationOptions} props настройки схемы
24
+ * @typeParam `message` - `{ [min | invalid]: string }`
25
+ * @returns схема валидации поля в соответствии с настройками
26
+ *
27
+ * @example
28
+ * z.object({
29
+ * field: zodValidators.base.getEmailOptional({ message: { min: '' } })
30
+ * })
31
+ * // will returns z.string().min(1).email().optional()
32
+ */
33
+ export declare const getEmailOptional: (props?: EmailValidationOptions) => z.ZodEffects<z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>, string | undefined, string | undefined>;
34
+ export {};
@@ -0,0 +1 @@
1
+ export { baseValidationSchemas } from './base.validators';
@@ -0,0 +1,37 @@
1
+ import { default as z } from 'zod';
2
+ type NumberValidationOptions = {
3
+ min?: number;
4
+ max?: number;
5
+ message?: Record<keyof Omit<NumberValidationOptions, 'message'>, string>;
6
+ };
7
+ /**
8
+ * Схема валидации обязательного поля числового типа
9
+ * @param {NumberValidationOptions} props настройки схемы
10
+ * @typeParam `min` - `number | undefined` `default: 1`
11
+ * @typeParam `max` - `number | undefined` `default: undefined`
12
+ * @typeParam `message` - `{ [min | max]: string }`
13
+ * @returns схема валидации поля в соответствии с настройками
14
+ *
15
+ * @example
16
+ * z.object({
17
+ * field: zodValidators.base.getNumberRequired({ min: 10, max: 20 })
18
+ * })
19
+ * // will returns z.coerce.number().min(10).max(20)
20
+ */
21
+ export declare const getNumberRequired: (props?: NumberValidationOptions) => z.ZodDefault<z.ZodNumber>;
22
+ /**
23
+ * Схема валидации опционального поля числового типа
24
+ * @param {NumberValidationOptions} props настройки схемы
25
+ * @typeParam `min` - `number | undefined` `default: 1`
26
+ * @typeParam `max` - `number | undefined` `default: undefined`
27
+ * @typeParam `message` - `{ [min | max]: string }`
28
+ * @returns схема валидации поля в соответствии с настройками
29
+ *
30
+ * @example
31
+ * z.object({
32
+ * field: zodValidators.base.getNumberOptional({ min: 10, max: 20 })
33
+ * })
34
+ * // will returns z.coerce.number().min(10).max(20).optional()
35
+ */
36
+ export declare const getNumberOptional: (props?: NumberValidationOptions) => z.ZodEffects<z.ZodOptional<z.ZodDefault<z.ZodNumber>>, number | undefined, number | undefined>;
37
+ export {};
@@ -0,0 +1,48 @@
1
+ import { default as z } from 'zod';
2
+ type PhoneValidationOptions = {
3
+ /**
4
+ * исключает маску в возвращаемом значении
5
+ * @default false
6
+ */
7
+ ignoreMask?: boolean;
8
+ /**
9
+ * игнорирует символы для проверки поля исключая данные символы
10
+ * @default /[()+_ -]/g
11
+ */
12
+ maskSymbols?: RegExp;
13
+ message?: {
14
+ min?: string;
15
+ invalidOperator?: string;
16
+ };
17
+ };
18
+ /**
19
+ * Схема валидации обязательного поля номера телефона
20
+ * @param {PhoneValidationOptions} props настройки схемы
21
+ * @typeParam `ignoreMask` - `boolean | undefined` `default: false`
22
+ * @typeParam `maskSymbols` - `RegExp | undefined` `default: /[()+_ -]/g`
23
+ * @typeParam `message` - `{ [min | invalidOperator]: string }`
24
+ * @returns схема валидации поля в соответствии с настройками
25
+ *
26
+ * @example
27
+ * z.object({
28
+ * field: zodValidators.base.getPhoneRequired()
29
+ * })
30
+ * // will returns z.string()
31
+ */
32
+ export declare const getPhoneRequired: (props?: PhoneValidationOptions) => z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
33
+ /**
34
+ * Схема валидации опционального поля номера телефона
35
+ * @param {PhoneValidationOptions} props настройки схемы
36
+ * @typeParam `ignoreSeparators` - `boolean | undefined` `default: false` возвращает строку вырезая символы маски
37
+ * @typeParam `maskSymbols` - `RegExp | undefined` `default: /[()+_ -]/g` игнорирует символы для проверки поля исключая данные символы
38
+ * @typeParam `message` - `{ [min | invalidOperator]: string }`
39
+ * @returns схема валидации поля в соответствии с настройками
40
+ *
41
+ * @example
42
+ * z.object({
43
+ * field: zodValidators.base.getPhoneOptional()
44
+ * })
45
+ * // will returns z.string()
46
+ */
47
+ export declare const getPhoneOptional: (props?: PhoneValidationOptions) => z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string | undefined, string>;
48
+ export {};
@@ -0,0 +1,60 @@
1
+ import { default as z } from 'zod';
2
+ type SelectSingleValidationOptions<Multi extends boolean = false> = {
3
+ /**
4
+ * включает валидацию мульти селекта
5
+ * @default false
6
+ */
7
+ multiple?: Multi;
8
+ message?: {
9
+ single?: string;
10
+ multiple?: string;
11
+ };
12
+ };
13
+ type SelectMultipleValidationOptions<Multi extends boolean = true> = SelectSingleValidationOptions<Multi> & {
14
+ /**
15
+ * минимальное количество элементов
16
+ * @default 0
17
+ */
18
+ minLength?: number;
19
+ };
20
+ type SelectValidationOptions<Multi extends boolean> = Multi extends true ? SelectMultipleValidationOptions<Multi> : SelectSingleValidationOptions<Multi>;
21
+ /**
22
+ * Схема валидации обязательного поля типа select
23
+ * @param {SelectValidationOptions} props настройки схемы
24
+ * @typeParam `multiple` - `boolean`
25
+ * @typeParam `minLength` - `number` `required if multiple = true`
26
+ * @typeParam `message` - `{ [single | multiple]: string }`
27
+ * @returns схема валидации поля в соответствии с настройками
28
+ *
29
+ * @example
30
+ * z.object({
31
+ * field: zodValidators.base.getSelectRequired({ multiple: false })
32
+ * })
33
+ * // will returns z.string().min(1).nullable().refine(Boolean)
34
+ *
35
+ * z.object({
36
+ * field: zodValidators.base.getSelectRequired({ multiple: true, minLength: 3 })
37
+ * })
38
+ * // will returns z.array(z.string().min(1).nullable().refine(Boolean))
39
+ */
40
+ export declare const getSelectRequired: <Multi extends boolean>(props?: SelectValidationOptions<Multi>) => z.ZodDefault<z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>> | z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>>, "many">>;
41
+ /**
42
+ * Схема валидации опционального поля типа select
43
+ * @param {SelectValidationOptions} props настройки схемы
44
+ * @typeParam `multiple` - `boolean`
45
+ * @typeParam `minLength` - `number` `required if multiple = true`
46
+ * @returns схема валидации поля в соответствии с настройками
47
+ *
48
+ * @example
49
+ * z.object({
50
+ * field: zodValidators.base.getSelectOptional({ multiple: false })
51
+ * })
52
+ * // will returns z.string().nullable()
53
+ *
54
+ * z.object({
55
+ * field: zodValidators.base.getSelectOptional({ multiple: true })
56
+ * })
57
+ * // will returns z.array(z.string().nullable())
58
+ */
59
+ export declare const getSelectOptional: <Multi extends boolean>(props?: Omit<SelectValidationOptions<Multi>, "message">) => z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodArray<z.ZodOptional<z.ZodNullable<z.ZodString>>, "many">>;
60
+ export {};
@@ -0,0 +1,45 @@
1
+ import { default as z } from 'zod';
2
+ type StringValidationOptions = {
3
+ /**
4
+ * минимальное количество символов
5
+ * @default 1
6
+ */
7
+ min?: number;
8
+ /**
9
+ * максимальное количество символов
10
+ * @default undefined
11
+ */
12
+ max?: number;
13
+ message?: Record<keyof Omit<StringValidationOptions, 'message'>, string>;
14
+ };
15
+ /**
16
+ * Схема валидации обязательного поля строкового типа
17
+ * @param {StringValidationOptions} props настройки схемы
18
+ * @typeParam `min` - `number | undefined` `default: 1`
19
+ * @typeParam `max` - `number | undefined` `default: undefined`
20
+ * @typeParam `message` - `{ [min | max]: string }`
21
+ * @returns схема валидации поля в соответствии с настройками
22
+ *
23
+ * @example
24
+ * z.object({
25
+ * field: zodValidators.base.getStringRequired({ min: 10, max: 20 })
26
+ * })
27
+ * // will returns z.string().min(10).max(20)
28
+ */
29
+ export declare const getStringRequired: (props?: StringValidationOptions) => z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
30
+ /**
31
+ * Схема валидации обязательного поля строкового типа
32
+ * @param {StringValidationOptions} props настройки схемы
33
+ * @typeParam `min` - `number | undefined` `default: 1`
34
+ * @typeParam `max` - `number | undefined` `default: undefined`
35
+ * @typeParam `message` - `{ [min | max]: string }`
36
+ * @returns схема валидации поля в соответствии с настройками
37
+ *
38
+ * @example
39
+ * z.object({
40
+ * field: zodValidators.base.getStringOptional({ min: 10, max: 20 })
41
+ * })
42
+ * // will returns z.string().min(10).max(20).optional()
43
+ */
44
+ export declare const getStringOptional: (props?: StringValidationOptions) => z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
45
+ export {};
@@ -0,0 +1,35 @@
1
+ import { default as z } from 'zod';
2
+ type UnionValidationOptions<T extends z.Primitive> = {
3
+ message?: ((values: readonly T[]) => string) | string;
4
+ errorMap?: z.ZodErrorMap;
5
+ invalid_type_error?: string;
6
+ required_error?: string;
7
+ description?: string;
8
+ };
9
+ /**
10
+ * Схема валидации обязательного поля из выборки
11
+ * @param {z.Primitive[]} values литералы
12
+ * @param {z.RawCreateParams & { message: (values: z.Primitive[]) => string }} props настройки схемы
13
+ * @returns схема валидации поля в соответствии с настройками
14
+ *
15
+ * @example
16
+ * z.object({
17
+ * field: zodValidators.base.getUnionRequired(['A', 'B'] as const)
18
+ * }) ^ it need to infer literal type
19
+ * // will returns z.union([z.literal('A'), z.literal('B')])
20
+ */
21
+ export declare const getUnionRequired: <T extends z.Primitive>(values: [T, T, ...T[]], props?: UnionValidationOptions<T>) => z.ZodUnion<[z.ZodLiteral<T>, z.ZodLiteral<T>, ...z.ZodLiteral<T>[]]>;
22
+ /**
23
+ * Схема валидации обязательного поля из выборки
24
+ * @param {z.Primitive} values литералы
25
+ * @param {z.RawCreateParams & { message: (values: z.Primitive[]) => string }} props настройки схемы
26
+ * @returns схема валидации поля в соответствии с настройками
27
+ *
28
+ * @example
29
+ * z.object({
30
+ * field: zodValidators.base.getUnionRequired(['A', 'B'] as const)
31
+ * }) ^ it need to infer literal type
32
+ * // will returns z.union([z.literal('A'), z.literal('B')]).optional()
33
+ */
34
+ export declare const getUnionOptional: <T extends z.Primitive>(values: [T, T, ...T[]], props?: UnionValidationOptions<T>) => z.ZodOptional<z.ZodUnion<[z.ZodLiteral<T>, z.ZodLiteral<T>, ...z.ZodLiteral<T>[]]>>;
35
+ export {};
@@ -1,12 +1,4 @@
1
- const n = (...i) => {
2
- const t = i.filter(Boolean);
3
- return t.length <= 1 ? t[0] || null : function(s) {
4
- t.forEach((r) => {
5
- typeof r == "function" ? r(s) : r && (r.current = s);
6
- });
7
- };
8
- };
9
- class f {
1
+ class r {
10
2
  static isString(t) {
11
3
  return typeof t == "string";
12
4
  }
@@ -30,7 +22,6 @@ class f {
30
22
  }
31
23
  }
32
24
  export {
33
- f as T,
34
- n as m
25
+ r as T
35
26
  };
36
- //# sourceMappingURL=typeGuards-CaNkXs7N.js.map
27
+ //# sourceMappingURL=typeGuards-B82KZ2oS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeGuards-B82KZ2oS.js","sources":["../lib/shared/utils/typeGuards.ts"],"sourcesContent":["export class TypeGuards {\n static isString(value: unknown): value is string {\n return typeof value === 'string'\n }\n\n static isStringEmpty(value: unknown): value is string {\n return this.isString(value) && !value.length\n }\n\n static isNull(value: unknown): value is null {\n return value === null\n }\n\n static isUndefined(value: unknown): value is undefined {\n return value === undefined && typeof value === 'undefined'\n }\n\n static isNil(value: unknown): value is boolean {\n return this.isNull(value) || this.isUndefined(value)\n }\n\n static isArray(value: unknown): value is unknown[] {\n return Array.isArray(value)\n }\n\n static isArrayEmpty(value: unknown): boolean {\n return this.isArray(value) && !value.length\n }\n}\n"],"names":["TypeGuards","value"],"mappings":"AAAO,MAAMA,EAAW;AAAA,EACtB,OAAO,SAASC,GAAiC;AAC/C,WAAO,OAAOA,KAAU;AAAA,EAAA;AAAA,EAG1B,OAAO,cAAcA,GAAiC;AACpD,WAAO,KAAK,SAASA,CAAK,KAAK,CAACA,EAAM;AAAA,EAAA;AAAA,EAGxC,OAAO,OAAOA,GAA+B;AAC3C,WAAOA,MAAU;AAAA,EAAA;AAAA,EAGnB,OAAO,YAAYA,GAAoC;AAC9C,WAAAA,MAAU,UAAa,OAAOA,IAAU;AAAA,EAAA;AAAA,EAGjD,OAAO,MAAMA,GAAkC;AAC7C,WAAO,KAAK,OAAOA,CAAK,KAAK,KAAK,YAAYA,CAAK;AAAA,EAAA;AAAA,EAGrD,OAAO,QAAQA,GAAoC;AAC1C,WAAA,MAAM,QAAQA,CAAK;AAAA,EAAA;AAAA,EAG5B,OAAO,aAAaA,GAAyB;AAC3C,WAAO,KAAK,QAAQA,CAAK,KAAK,CAACA,EAAM;AAAA,EAAA;AAEzC;"}