@cloud-ru/uikit-product-fields-predefined 2.4.8-preview-04a474c4.0 → 3.0.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 (187) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +12 -326
  3. package/dist/cjs/components/index.d.ts +0 -2
  4. package/dist/cjs/components/index.js +0 -2
  5. package/dist/esm/components/index.d.ts +0 -2
  6. package/dist/esm/components/index.js +0 -2
  7. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  8. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  9. package/package.json +3 -9
  10. package/src/components/index.ts +0 -2
  11. package/dist/cjs/components/FieldAi/FieldAi.d.ts +0 -24
  12. package/dist/cjs/components/FieldAi/FieldAi.js +0 -92
  13. package/dist/cjs/components/FieldAi/components/AlertButton/AlertButton.d.ts +0 -5
  14. package/dist/cjs/components/FieldAi/components/AlertButton/AlertButton.js +0 -12
  15. package/dist/cjs/components/FieldAi/components/AlertButton/index.d.ts +0 -1
  16. package/dist/cjs/components/FieldAi/components/AlertButton/index.js +0 -17
  17. package/dist/cjs/components/FieldAi/components/AlertButton/styles.module.css +0 -17
  18. package/dist/cjs/components/FieldAi/components/CheckItem/CheckItem.d.ts +0 -9
  19. package/dist/cjs/components/FieldAi/components/CheckItem/CheckItem.js +0 -28
  20. package/dist/cjs/components/FieldAi/components/CheckItem/index.d.ts +0 -1
  21. package/dist/cjs/components/FieldAi/components/CheckItem/index.js +0 -17
  22. package/dist/cjs/components/FieldAi/components/CheckItem/styles.module.css +0 -36
  23. package/dist/cjs/components/FieldAi/components/MobileFieldAi/MobileFieldAi.d.ts +0 -5
  24. package/dist/cjs/components/FieldAi/components/MobileFieldAi/MobileFieldAi.js +0 -31
  25. package/dist/cjs/components/FieldAi/components/MobileFieldAi/index.d.ts +0 -1
  26. package/dist/cjs/components/FieldAi/components/MobileFieldAi/index.js +0 -17
  27. package/dist/cjs/components/FieldAi/components/MobileFieldAi/styles.module.css +0 -78
  28. package/dist/cjs/components/FieldAi/components/PasswordValidation/PasswordValidation.d.ts +0 -7
  29. package/dist/cjs/components/FieldAi/components/PasswordValidation/PasswordValidation.js +0 -23
  30. package/dist/cjs/components/FieldAi/components/PasswordValidation/index.d.ts +0 -1
  31. package/dist/cjs/components/FieldAi/components/PasswordValidation/index.js +0 -17
  32. package/dist/cjs/components/FieldAi/components/PasswordValidation/styles.module.css +0 -36
  33. package/dist/cjs/components/FieldAi/components/TextArea/TextArea.d.ts +0 -39
  34. package/dist/cjs/components/FieldAi/components/TextArea/TextArea.js +0 -33
  35. package/dist/cjs/components/FieldAi/components/TextArea/index.d.ts +0 -1
  36. package/dist/cjs/components/FieldAi/components/TextArea/index.js +0 -17
  37. package/dist/cjs/components/FieldAi/components/TextArea/styles.module.css +0 -32
  38. package/dist/cjs/components/FieldAi/components/WithPasswordValidation/WithPasswordValidation.d.ts +0 -10
  39. package/dist/cjs/components/FieldAi/components/WithPasswordValidation/WithPasswordValidation.js +0 -23
  40. package/dist/cjs/components/FieldAi/components/WithPasswordValidation/index.d.ts +0 -1
  41. package/dist/cjs/components/FieldAi/components/WithPasswordValidation/index.js +0 -17
  42. package/dist/cjs/components/FieldAi/components/WithPasswordValidation/styles.module.css +0 -6
  43. package/dist/cjs/components/FieldAi/index.d.ts +0 -1
  44. package/dist/cjs/components/FieldAi/index.js +0 -17
  45. package/dist/cjs/components/FieldAi/styles.module.css +0 -61
  46. package/dist/cjs/components/FieldAi/utils.d.ts +0 -10
  47. package/dist/cjs/components/FieldAi/utils.js +0 -19
  48. package/dist/cjs/components/FieldCode/FieldCode.d.ts +0 -33
  49. package/dist/cjs/components/FieldCode/FieldCode.js +0 -48
  50. package/dist/cjs/components/FieldCode/components/Cell/Cell.d.ts +0 -5
  51. package/dist/cjs/components/FieldCode/components/Cell/Cell.js +0 -27
  52. package/dist/cjs/components/FieldCode/components/Cell/index.d.ts +0 -1
  53. package/dist/cjs/components/FieldCode/components/Cell/index.js +0 -17
  54. package/dist/cjs/components/FieldCode/components/Cell/styles.module.css +0 -3
  55. package/dist/cjs/components/FieldCode/components/ResendCode/ResendCode.d.ts +0 -8
  56. package/dist/cjs/components/FieldCode/components/ResendCode/ResendCode.js +0 -28
  57. package/dist/cjs/components/FieldCode/components/ResendCode/index.d.ts +0 -1
  58. package/dist/cjs/components/FieldCode/components/ResendCode/index.js +0 -17
  59. package/dist/cjs/components/FieldCode/components/ResendCode/utils.d.ts +0 -1
  60. package/dist/cjs/components/FieldCode/components/ResendCode/utils.js +0 -8
  61. package/dist/cjs/components/FieldCode/components/index.d.ts +0 -2
  62. package/dist/cjs/components/FieldCode/components/index.js +0 -18
  63. package/dist/cjs/components/FieldCode/constants.d.ts +0 -14
  64. package/dist/cjs/components/FieldCode/constants.js +0 -10
  65. package/dist/cjs/components/FieldCode/hooks/index.d.ts +0 -4
  66. package/dist/cjs/components/FieldCode/hooks/index.js +0 -20
  67. package/dist/cjs/components/FieldCode/hooks/useCodeInput.d.ts +0 -22
  68. package/dist/cjs/components/FieldCode/hooks/useCodeInput.js +0 -98
  69. package/dist/cjs/components/FieldCode/hooks/useFieldCodeValidate.d.ts +0 -8
  70. package/dist/cjs/components/FieldCode/hooks/useFieldCodeValidate.js +0 -24
  71. package/dist/cjs/components/FieldCode/hooks/useFieldHelpers.d.ts +0 -13
  72. package/dist/cjs/components/FieldCode/hooks/useFieldHelpers.js +0 -34
  73. package/dist/cjs/components/FieldCode/hooks/useFocusCell.d.ts +0 -5
  74. package/dist/cjs/components/FieldCode/hooks/useFocusCell.js +0 -22
  75. package/dist/cjs/components/FieldCode/index.d.ts +0 -2
  76. package/dist/cjs/components/FieldCode/index.js +0 -20
  77. package/dist/cjs/components/FieldCode/styles.module.css +0 -30
  78. package/dist/cjs/components/FieldCode/utils.d.ts +0 -6
  79. package/dist/cjs/components/FieldCode/utils.js +0 -21
  80. package/dist/esm/components/FieldAi/FieldAi.d.ts +0 -24
  81. package/dist/esm/components/FieldAi/FieldAi.js +0 -86
  82. package/dist/esm/components/FieldAi/components/AlertButton/AlertButton.d.ts +0 -5
  83. package/dist/esm/components/FieldAi/components/AlertButton/AlertButton.js +0 -6
  84. package/dist/esm/components/FieldAi/components/AlertButton/index.d.ts +0 -1
  85. package/dist/esm/components/FieldAi/components/AlertButton/index.js +0 -1
  86. package/dist/esm/components/FieldAi/components/AlertButton/styles.module.css +0 -17
  87. package/dist/esm/components/FieldAi/components/CheckItem/CheckItem.d.ts +0 -9
  88. package/dist/esm/components/FieldAi/components/CheckItem/CheckItem.js +0 -22
  89. package/dist/esm/components/FieldAi/components/CheckItem/index.d.ts +0 -1
  90. package/dist/esm/components/FieldAi/components/CheckItem/index.js +0 -1
  91. package/dist/esm/components/FieldAi/components/CheckItem/styles.module.css +0 -36
  92. package/dist/esm/components/FieldAi/components/MobileFieldAi/MobileFieldAi.d.ts +0 -5
  93. package/dist/esm/components/FieldAi/components/MobileFieldAi/MobileFieldAi.js +0 -25
  94. package/dist/esm/components/FieldAi/components/MobileFieldAi/index.d.ts +0 -1
  95. package/dist/esm/components/FieldAi/components/MobileFieldAi/index.js +0 -1
  96. package/dist/esm/components/FieldAi/components/MobileFieldAi/styles.module.css +0 -78
  97. package/dist/esm/components/FieldAi/components/PasswordValidation/PasswordValidation.d.ts +0 -7
  98. package/dist/esm/components/FieldAi/components/PasswordValidation/PasswordValidation.js +0 -17
  99. package/dist/esm/components/FieldAi/components/PasswordValidation/index.d.ts +0 -1
  100. package/dist/esm/components/FieldAi/components/PasswordValidation/index.js +0 -1
  101. package/dist/esm/components/FieldAi/components/PasswordValidation/styles.module.css +0 -36
  102. package/dist/esm/components/FieldAi/components/TextArea/TextArea.d.ts +0 -39
  103. package/dist/esm/components/FieldAi/components/TextArea/TextArea.js +0 -27
  104. package/dist/esm/components/FieldAi/components/TextArea/index.d.ts +0 -1
  105. package/dist/esm/components/FieldAi/components/TextArea/index.js +0 -1
  106. package/dist/esm/components/FieldAi/components/TextArea/styles.module.css +0 -32
  107. package/dist/esm/components/FieldAi/components/WithPasswordValidation/WithPasswordValidation.d.ts +0 -10
  108. package/dist/esm/components/FieldAi/components/WithPasswordValidation/WithPasswordValidation.js +0 -17
  109. package/dist/esm/components/FieldAi/components/WithPasswordValidation/index.d.ts +0 -1
  110. package/dist/esm/components/FieldAi/components/WithPasswordValidation/index.js +0 -1
  111. package/dist/esm/components/FieldAi/components/WithPasswordValidation/styles.module.css +0 -6
  112. package/dist/esm/components/FieldAi/index.d.ts +0 -1
  113. package/dist/esm/components/FieldAi/index.js +0 -1
  114. package/dist/esm/components/FieldAi/styles.module.css +0 -61
  115. package/dist/esm/components/FieldAi/utils.d.ts +0 -10
  116. package/dist/esm/components/FieldAi/utils.js +0 -15
  117. package/dist/esm/components/FieldCode/FieldCode.d.ts +0 -33
  118. package/dist/esm/components/FieldCode/FieldCode.js +0 -41
  119. package/dist/esm/components/FieldCode/components/Cell/Cell.d.ts +0 -5
  120. package/dist/esm/components/FieldCode/components/Cell/Cell.js +0 -21
  121. package/dist/esm/components/FieldCode/components/Cell/index.d.ts +0 -1
  122. package/dist/esm/components/FieldCode/components/Cell/index.js +0 -1
  123. package/dist/esm/components/FieldCode/components/Cell/styles.module.css +0 -3
  124. package/dist/esm/components/FieldCode/components/ResendCode/ResendCode.d.ts +0 -8
  125. package/dist/esm/components/FieldCode/components/ResendCode/ResendCode.js +0 -25
  126. package/dist/esm/components/FieldCode/components/ResendCode/index.d.ts +0 -1
  127. package/dist/esm/components/FieldCode/components/ResendCode/index.js +0 -1
  128. package/dist/esm/components/FieldCode/components/ResendCode/utils.d.ts +0 -1
  129. package/dist/esm/components/FieldCode/components/ResendCode/utils.js +0 -5
  130. package/dist/esm/components/FieldCode/components/index.d.ts +0 -2
  131. package/dist/esm/components/FieldCode/components/index.js +0 -2
  132. package/dist/esm/components/FieldCode/constants.d.ts +0 -14
  133. package/dist/esm/components/FieldCode/constants.js +0 -7
  134. package/dist/esm/components/FieldCode/hooks/index.d.ts +0 -4
  135. package/dist/esm/components/FieldCode/hooks/index.js +0 -4
  136. package/dist/esm/components/FieldCode/hooks/useCodeInput.d.ts +0 -22
  137. package/dist/esm/components/FieldCode/hooks/useCodeInput.js +0 -95
  138. package/dist/esm/components/FieldCode/hooks/useFieldCodeValidate.d.ts +0 -8
  139. package/dist/esm/components/FieldCode/hooks/useFieldCodeValidate.js +0 -21
  140. package/dist/esm/components/FieldCode/hooks/useFieldHelpers.d.ts +0 -13
  141. package/dist/esm/components/FieldCode/hooks/useFieldHelpers.js +0 -31
  142. package/dist/esm/components/FieldCode/hooks/useFocusCell.d.ts +0 -5
  143. package/dist/esm/components/FieldCode/hooks/useFocusCell.js +0 -19
  144. package/dist/esm/components/FieldCode/index.d.ts +0 -2
  145. package/dist/esm/components/FieldCode/index.js +0 -2
  146. package/dist/esm/components/FieldCode/styles.module.css +0 -30
  147. package/dist/esm/components/FieldCode/utils.d.ts +0 -6
  148. package/dist/esm/components/FieldCode/utils.js +0 -13
  149. package/src/components/FieldAi/FieldAi.tsx +0 -201
  150. package/src/components/FieldAi/components/AlertButton/AlertButton.tsx +0 -16
  151. package/src/components/FieldAi/components/AlertButton/index.ts +0 -1
  152. package/src/components/FieldAi/components/AlertButton/styles.module.scss +0 -20
  153. package/src/components/FieldAi/components/CheckItem/CheckItem.tsx +0 -45
  154. package/src/components/FieldAi/components/CheckItem/index.ts +0 -1
  155. package/src/components/FieldAi/components/CheckItem/styles.module.scss +0 -44
  156. package/src/components/FieldAi/components/MobileFieldAi/MobileFieldAi.tsx +0 -57
  157. package/src/components/FieldAi/components/MobileFieldAi/index.ts +0 -1
  158. package/src/components/FieldAi/components/MobileFieldAi/styles.module.scss +0 -90
  159. package/src/components/FieldAi/components/PasswordValidation/PasswordValidation.tsx +0 -85
  160. package/src/components/FieldAi/components/PasswordValidation/index.ts +0 -1
  161. package/src/components/FieldAi/components/PasswordValidation/styles.module.scss +0 -34
  162. package/src/components/FieldAi/components/TextArea/TextArea.tsx +0 -113
  163. package/src/components/FieldAi/components/TextArea/index.ts +0 -1
  164. package/src/components/FieldAi/components/TextArea/styles.module.scss +0 -35
  165. package/src/components/FieldAi/components/WithPasswordValidation/WithPasswordValidation.tsx +0 -63
  166. package/src/components/FieldAi/components/WithPasswordValidation/index.ts +0 -1
  167. package/src/components/FieldAi/components/WithPasswordValidation/styles.module.scss +0 -8
  168. package/src/components/FieldAi/index.ts +0 -1
  169. package/src/components/FieldAi/styles.module.scss +0 -85
  170. package/src/components/FieldAi/utils.ts +0 -27
  171. package/src/components/FieldCode/FieldCode.tsx +0 -125
  172. package/src/components/FieldCode/components/Cell/Cell.tsx +0 -32
  173. package/src/components/FieldCode/components/Cell/index.ts +0 -1
  174. package/src/components/FieldCode/components/Cell/styles.module.scss +0 -5
  175. package/src/components/FieldCode/components/ResendCode/ResendCode.tsx +0 -33
  176. package/src/components/FieldCode/components/ResendCode/index.ts +0 -1
  177. package/src/components/FieldCode/components/ResendCode/utils.ts +0 -5
  178. package/src/components/FieldCode/components/index.ts +0 -2
  179. package/src/components/FieldCode/constants.ts +0 -20
  180. package/src/components/FieldCode/hooks/index.ts +0 -4
  181. package/src/components/FieldCode/hooks/useCodeInput.ts +0 -147
  182. package/src/components/FieldCode/hooks/useFieldCodeValidate.ts +0 -35
  183. package/src/components/FieldCode/hooks/useFieldHelpers.ts +0 -52
  184. package/src/components/FieldCode/hooks/useFocusCell.ts +0 -29
  185. package/src/components/FieldCode/index.ts +0 -2
  186. package/src/components/FieldCode/styles.module.scss +0 -40
  187. package/src/components/FieldCode/utils.ts +0 -23
@@ -1,7 +0,0 @@
1
- import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
2
- import { ValidationPassword, ValidationPasswordKey } from '../../utils';
3
- export type WithPasswordTooltipProps = WithLayoutType<{
4
- passwordValidation: ValidationPassword;
5
- animatedKey?: ValidationPasswordKey | null;
6
- }>;
7
- export declare function PasswordValidation({ passwordValidation, layoutType, animatedKey }: WithPasswordTooltipProps): import("react/jsx-runtime").JSX.Element;
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
3
- import { useLocale } from '@cloud-ru/uikit-product-locale';
4
- import { isTouchDevice as isTouchDeviceHelper } from '../../../../helpers';
5
- import { CheckItem } from '../CheckItem';
6
- import styles from './styles.module.css';
7
- export function PasswordValidation({ passwordValidation, layoutType, animatedKey }) {
8
- const { t } = useLocale('FieldsPredefined');
9
- const allCriteriaMet = useMemo(() => Object.values(passwordValidation).every(item => item), [passwordValidation]);
10
- const isTouchDevice = isTouchDeviceHelper(layoutType);
11
- if (isTouchDevice) {
12
- if (allCriteriaMet) {
13
- return (_jsx("div", { className: styles.validationItemsContainer, "data-layout-type": layoutType, children: _jsx(CheckItem, { checked: true, label: t('FieldAi.secret.passwordTooltip.titleSuccess'), layoutType: layoutType, shouldHide: false }) }));
14
- }
15
- }
16
- return (_jsx("div", { className: styles.validationItemsContainer, "data-layout-type": layoutType, children: _jsxs("div", { className: styles.validationList, children: [_jsx(CheckItem, { checked: passwordValidation.minLength, label: t('FieldAi.secret.passwordTooltip.minLength'), layoutType: layoutType, shouldHide: isTouchDevice, animated: animatedKey === 'minLength' }), _jsx(CheckItem, { checked: passwordValidation.onlyLatin, label: t('FieldAi.secret.passwordTooltip.onlyLatin'), layoutType: layoutType, shouldHide: isTouchDevice, animated: animatedKey === 'onlyLatin' }), _jsx(CheckItem, { checked: passwordValidation.hasLetterCases, label: t('FieldAi.secret.passwordTooltip.hasLetterCases'), layoutType: layoutType, shouldHide: isTouchDevice, animated: animatedKey === 'hasLetterCases' }), _jsx(CheckItem, { checked: passwordValidation.hasNumber, label: t('FieldAi.secret.passwordTooltip.hasNumber'), layoutType: layoutType, shouldHide: isTouchDevice, animated: animatedKey === 'hasNumber' }), _jsx(CheckItem, { checked: passwordValidation.hasSymbol, label: t('FieldAi.secret.passwordTooltip.hasSymbol'), layoutType: layoutType, shouldHide: isTouchDevice, animated: animatedKey === 'hasSymbol' }), _jsx(CheckItem, { checked: passwordValidation.noSpaces, label: t('FieldAi.secret.passwordTooltip.noSpaces'), layoutType: layoutType, shouldHide: isTouchDevice, animated: animatedKey === 'noSpaces' })] }) }));
17
- }
@@ -1 +0,0 @@
1
- export * from './PasswordValidation';
@@ -1 +0,0 @@
1
- export * from './PasswordValidation';
@@ -1,36 +0,0 @@
1
- .tooltipText{
2
- display:flex;
3
- flex-direction:column;
4
- }
5
-
6
- .validationList{
7
- display:flex;
8
- flex-direction:column;
9
- gap:12px;
10
- }
11
-
12
- .validationItemsContainer{
13
- font-family:var(--sans-body-m-font-family, SB Sans Interface);
14
- font-weight:var(--sans-body-m-font-weight, Regular);
15
- line-height:var(--sans-body-m-line-height, 20px);
16
- font-size:var(--sans-body-m-font-size, 14px);
17
- letter-spacing:var(--sans-body-m-letter-spacing, 0.1px);
18
- paragraph-spacing:var(--sans-body-m-paragraph-spacing, 7.7px);
19
- color:var(--sys-neutral-text-main, #41424e);
20
- display:flex;
21
- flex-direction:column;
22
- gap:12px;
23
- }
24
- .validationItemsContainer[data-layout-type=mobile], .validationItemsContainer[data-layout-type=tablet]{
25
- gap:8px;
26
- font-family:var(--sans-body-s-font-family, SB Sans Interface);
27
- font-weight:var(--sans-body-s-font-weight, Regular);
28
- line-height:var(--sans-body-s-line-height, 16px);
29
- font-size:var(--sans-body-s-font-size, 12px);
30
- letter-spacing:var(--sans-body-s-letter-spacing, 0.1px);
31
- paragraph-spacing:var(--sans-body-s-paragraph-spacing, 6.6px);
32
- padding:8px 16px;
33
- }
34
- .validationItemsContainer[data-layout-type=mobile] .validationList, .validationItemsContainer[data-layout-type=tablet] .validationList{
35
- gap:2px;
36
- }
@@ -1,39 +0,0 @@
1
- import { ChangeEvent, FocusEventHandler, KeyboardEventHandler, RefAttributes } from 'react';
2
- import { InputPrivateProps } from '@snack-uikit/input-private';
3
- import { WithSupportProps } from '@snack-uikit/utils';
4
- export type TextAreaProps = RefAttributes<HTMLTextAreaElement> & WithSupportProps<{
5
- /** HTML-аттрибут name */
6
- name?: string;
7
- /** HTML-аттрибут value */
8
- value?: string;
9
- /** Колбек смены значения */
10
- onChange?(value: string, e: ChangeEvent<HTMLTextAreaElement>): void;
11
- /** HTML-аттрибут id */
12
- id?: string;
13
- className?: string;
14
- /** Плейсхолдер */
15
- placeholder?: string;
16
- /** Является ли поле доступным только на чтение */
17
- readonly?: boolean;
18
- /** Является ли поле деактивированным */
19
- disabled?: boolean;
20
- /** Включен ли автокомплит */
21
- autoComplete?: boolean;
22
- /** Максимальное кол-во символов */
23
- maxLength?: number;
24
- /** Колбек получения фокуса */
25
- onFocus?: FocusEventHandler<HTMLTextAreaElement>;
26
- /** Колбек потери фокуса */
27
- onBlur?: FocusEventHandler<HTMLTextAreaElement>;
28
- /** Колбек нажатия клавиши клавиатуры */
29
- onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;
30
- /** HTML-аттрибут tab-index */
31
- tabIndex?: number;
32
- /** Минимальное кол-во строк, до которого размер поля может быть увеличен @default 3*/
33
- minRows?: number;
34
- /** Включение проверки орфографии @default true*/
35
- spellCheck?: boolean;
36
- /** Режим работы экранной клавиатуры */
37
- inputMode?: InputPrivateProps['inputMode'];
38
- }>;
39
- export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & RefAttributes<HTMLTextAreaElement>>;
@@ -1,27 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import cn from 'classnames';
14
- import { forwardRef, useState, } from 'react';
15
- import TextareaAutosize from 'react-textarea-autosize';
16
- import { extractSupportProps, useLayoutEffect } from '@snack-uikit/utils';
17
- import styles from './styles.module.css';
18
- export const TextArea = forwardRef((_a, ref) => {
19
- var { name, value = '', onChange, placeholder, id, className, disabled = false, readonly = false, autoComplete = false, maxLength, onFocus, onBlur, onKeyDown, tabIndex, minRows = 3, spellCheck, inputMode } = _a, rest = __rest(_a, ["name", "value", "onChange", "placeholder", "id", "className", "disabled", "readonly", "autoComplete", "maxLength", "onFocus", "onBlur", "onKeyDown", "tabIndex", "minRows", "spellCheck", "inputMode"]);
20
- // fix of height on the initial render
21
- // see https://github.com/Andarist/react-textarea-autosize/issues/337#issuecomment-1024980737
22
- const [, setIsRerendered] = useState(false);
23
- useLayoutEffect(() => setIsRerendered(true), []);
24
- const onChangeHandler = e => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value, e);
25
- const stopPropagation = e => e.stopPropagation();
26
- return (_jsx(TextareaAutosize, Object.assign({ id: id, name: name, value: value, ref: ref, className: cn(className, styles.textarea), autoComplete: autoComplete ? 'on' : 'off', placeholder: placeholder, disabled: disabled, readOnly: readonly, maxLength: maxLength, onChange: onChangeHandler, onClick: stopPropagation, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, tabIndex: tabIndex, minRows: minRows, spellCheck: spellCheck, inputMode: inputMode }, extractSupportProps(rest))));
27
- });
@@ -1 +0,0 @@
1
- export * from './TextArea';
@@ -1 +0,0 @@
1
- export * from './TextArea';
@@ -1,32 +0,0 @@
1
- .textarea{
2
- resize:none;
3
- box-sizing:border-box;
4
- width:100%;
5
- max-width:100%;
6
- margin:0;
7
- padding:0;
8
- color:var(--sys-neutral-text-main, #41424e);
9
- background-color:transparent;
10
- border:none;
11
- border-radius:0;
12
- outline:0;
13
- }
14
- .textarea::-moz-placeholder{
15
- color:var(--sys-neutral-text-disabled, #aaaebd);
16
- }
17
- .textarea::placeholder{
18
- color:var(--sys-neutral-text-disabled, #aaaebd);
19
- }
20
- .textarea::-webkit-scrollbar{
21
- width:0;
22
- max-width:0;
23
- }
24
- .textarea:-moz-read-only{
25
- color:var(--sys-neutral-text-support, #6d707f);
26
- }
27
- .textarea:read-only{
28
- color:var(--sys-neutral-text-support, #6d707f);
29
- }
30
- .textarea[disabled]{
31
- color:var(--sys-neutral-text-disabled, #aaaebd);
32
- }
@@ -1,10 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
3
- import { ValidationPassword, ValidationPasswordKey } from '../../utils';
4
- export type WithPasswordTooltipProps = WithLayoutType<{
5
- showValidation?: boolean;
6
- children: ReactNode;
7
- passwordValidation: ValidationPassword;
8
- animatedKey?: ValidationPasswordKey | null;
9
- }>;
10
- export declare function WithPasswordValidation({ showValidation, passwordValidation, layoutType, children, animatedKey, }: WithPasswordTooltipProps): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | null | undefined;
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AdaptiveTooltip } from '@cloud-ru/uikit-product-mobile-tooltip';
3
- import { isTouchDevice } from '../../../../helpers';
4
- import { PasswordValidation } from '../PasswordValidation';
5
- import styles from './styles.module.css';
6
- export function WithPasswordValidation({ showValidation, passwordValidation, layoutType, children, animatedKey, }) {
7
- if (isTouchDevice(layoutType)) {
8
- if (showValidation) {
9
- return (_jsxs("div", { className: styles.validationContainer, children: [_jsx(PasswordValidation, { passwordValidation: passwordValidation, layoutType: layoutType, animatedKey: animatedKey }), children] }));
10
- }
11
- return children;
12
- }
13
- if (showValidation) {
14
- return (_jsx(AdaptiveTooltip, { placement: 'left-end', layoutType: layoutType, tip: _jsx(PasswordValidation, { passwordValidation: passwordValidation, layoutType: layoutType, animatedKey: animatedKey }), offset: 8, children: children }));
15
- }
16
- return children;
17
- }
@@ -1 +0,0 @@
1
- export * from './WithPasswordValidation';
@@ -1 +0,0 @@
1
- export * from './WithPasswordValidation';
@@ -1,6 +0,0 @@
1
- .validationContainer{
2
- display:flex;
3
- flex-direction:column;
4
- gap:8px;
5
- background-color:var(--sys-neutral-background1-level, #fdfdfd);
6
- }
@@ -1 +0,0 @@
1
- export * from './FieldAi';
@@ -1 +0,0 @@
1
- export * from './FieldAi';
@@ -1,61 +0,0 @@
1
- .wrapper{
2
- display:flex;
3
- flex-direction:column;
4
- gap:var(--dimension-050m, 4px);
5
- position:relative;
6
- }
7
-
8
- .passwordWrapper{
9
- gap:0;
10
- }
11
-
12
- .alert{
13
- display:flex;
14
- gap:8px;
15
- padding:4px 8px;
16
- border-radius:8px 8px 0 0;
17
- border:1px solid var(--sys-blue-decor-activated, #aac4ea);
18
- background-color:var(--sys-blue-decor-default, #d6e2f4);
19
- box-sizing:border-box;
20
- height:38px;
21
- position:absolute;
22
- left:0;
23
- top:-26px;
24
- width:100%;
25
- color:var(--sys-neutral-text-main, #41424e);
26
- }
27
-
28
- .alertText{
29
- flex:1;
30
- min-width:0;
31
- color:var(--sys-neutral-text-main, #41424e);
32
- }
33
-
34
- .secured textarea{
35
- -webkit-text-security:disc;
36
- text-security:disc;
37
- }
38
-
39
- .mobileSubmitButton{
40
- position:relative !important;
41
- flex-shrink:0 !important;
42
- }
43
- .mobileSubmitButton:after{
44
- content:"";
45
- display:flex;
46
- width:48px;
47
- height:48px;
48
- position:absolute;
49
- top:50%;
50
- left:50%;
51
- transform:translate(-50%, -50%);
52
- }
53
-
54
- .submitButton:not([data-disabled]){
55
- background:radial-gradient(229.88% 112% at 37.5% 77.08%, #26D07C 19.86%, #5FD7C2 50.73%, #7CB5F2 89.88%);
56
- }
57
-
58
- .textarea > :first-child[data-validation=default]:not([data-readonly]):not([data-disable-focus]):focus-within:not([data-disabled]){
59
- border-color:transparent;
60
- background:linear-gradient(var(--sys-neutral-background2-level), var(--sys-neutral-background2-level) 0) padding-box, radial-gradient(57.79% 100% at 50% 0%, #7cb5f2 38%, #5fd7c2 79%, #26d07c 90%) border-box;
61
- }
@@ -1,10 +0,0 @@
1
- export type ValidationPassword = {
2
- onlyLatin: boolean;
3
- minLength: boolean;
4
- hasLetterCases: boolean;
5
- hasNumber: boolean;
6
- hasSymbol: boolean;
7
- noSpaces: boolean;
8
- };
9
- export type ValidationPasswordKey = keyof ValidationPassword;
10
- export declare const getValidationPassword: (password?: string) => ValidationPassword;
@@ -1,15 +0,0 @@
1
- const MIN_PASSWORD_LENGTH = 8;
2
- const NUMBER_REGEX = /[0-9]/;
3
- const CAPITAL_REGEX = /\p{Lu}/u;
4
- const LOWER_REGEX = /\p{Ll}/u;
5
- const SYMBOLS_REGEX = /[\p{P}\p{S}]/u;
6
- const NO_SPACES = /^\S*$/u;
7
- const LATIN_REGEX = /^[a-zA-Z0-9\p{P}\p{S}]+$/u;
8
- export const getValidationPassword = (password = '') => ({
9
- onlyLatin: Boolean(password.match(LATIN_REGEX)),
10
- minLength: password.length >= MIN_PASSWORD_LENGTH,
11
- hasLetterCases: Boolean(password.match(CAPITAL_REGEX)) && Boolean(password.match(LOWER_REGEX)),
12
- hasNumber: Boolean(password.match(NUMBER_REGEX)),
13
- hasSymbol: Boolean(password.match(SYMBOLS_REGEX)),
14
- noSpaces: Boolean(password.match(NO_SPACES)),
15
- });
@@ -1,33 +0,0 @@
1
- import { FieldDecoratorProps } from '@snack-uikit/fields';
2
- import { type ResendCodeProps } from './components';
3
- import { type FieldCodeFocusEffect } from './constants';
4
- import { UseCodeInputParams } from './hooks';
5
- export type FieldCodeRef = {
6
- /** Перенести фокус на ячейку с индексом `index` */
7
- moveFocus: (index: number) => void;
8
- /** Убрать фокус со всех ячеек кода */
9
- blurFields: () => void;
10
- /** Сбросить значение кода */
11
- resetCode: () => void;
12
- };
13
- /** Собственные пропсы `FieldCode` */
14
- export type FieldCodeOwnProps = {
15
- /** CSS-класс компонента */
16
- className?: string;
17
- /** CSS-класс ячейки кода */
18
- cellClassName?: string;
19
- /** Позиции, после которых нужно вставить пробел (индексы символов, после которых будет пробел) */
20
- spacing?: number[];
21
- /** Подсветить пустые символы кода */
22
- showEmptyChars?: boolean;
23
- /** Компонент отправки нового кода */
24
- resendCode?: ResendCodeProps;
25
- /** Сценарии автофокуса; по умолчанию — первая ячейка при монтировании и после сброса (см. `FieldCodeFocusEffect`) */
26
- focusEffects?: readonly FieldCodeFocusEffect[];
27
- /** Сообщение при неверном коде, если не передан свой `error` */
28
- invalidCode?: string;
29
- };
30
- export type FieldCodeProps = FieldCodeOwnProps & Omit<UseCodeInputParams, 'moveFocus'> & Pick<FieldDecoratorProps, 'size' | 'disabled' | 'label' | 'error' | 'data-test-id'>;
31
- export declare const FieldCode: import("react").ForwardRefExoticComponent<FieldCodeOwnProps & Omit<UseCodeInputParams, "moveFocus"> & Pick<FieldDecoratorProps, "size" | "label" | "error" | "disabled" | "data-test-id"> & import("react").RefAttributes<FieldCodeRef>>;
32
- export type { FieldCodeFocusEffect } from './constants';
33
- export { FIELD_CODE_DEFAULT_FOCUS_EFFECTS } from './constants';
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import cn from 'classnames';
3
- import { forwardRef, useImperativeHandle } from 'react';
4
- import { FieldDecorator } from '@snack-uikit/fields';
5
- import { Cell, ResendCode } from './components';
6
- import { FIELD_CODE_DEFAULT_FOCUS_EFFECTS } from './constants';
7
- import { useCodeInput, useFieldHelpers, useFocusCell } from './hooks';
8
- import styles from './styles.module.css';
9
- import { getCellValidationState } from './utils';
10
- export const FieldCode = forwardRef(function FieldCode(props, ref) {
11
- var _a;
12
- const { codeLength, className, cellClassName, value, onChange, spacing, onComplete, size, disabled, label, error, invalidCode, showEmptyChars, resendCode, focusEffects = FIELD_CODE_DEFAULT_FOCUS_EFFECTS, 'data-test-id': dataTestId, } = props;
13
- const { inputsRef, moveFocus, blurFields } = useFocusCell(codeLength);
14
- const { code, cellHandlers, onChangeCode } = useCodeInput({ value, onChange, codeLength, moveFocus, onComplete });
15
- const { resetCode } = useFieldHelpers({
16
- onChangeCode,
17
- focusEffects,
18
- moveFocus,
19
- showEmptyChars,
20
- code,
21
- codeLength,
22
- });
23
- useImperativeHandle(ref, () => ({
24
- moveFocus,
25
- blurFields,
26
- resetCode,
27
- }), [moveFocus, blurFields, resetCode]);
28
- const resolvedError = error !== null && error !== void 0 ? error : invalidCode;
29
- const resolvedDecoratorProps = {
30
- label,
31
- disabled,
32
- size,
33
- error: resolvedError,
34
- };
35
- return (_jsxs("div", Object.assign({ className: cn(styles.fieldCode, className) }, (dataTestId ? { 'data-test-id': dataTestId } : undefined), { children: [_jsx(FieldDecorator, Object.assign({}, resolvedDecoratorProps, { children: _jsx("div", { className: styles.codeContainer, "data-size": size, children: code.map((char, index) => (_jsx(Cell, { ref: inputRef => {
36
- if (inputRef) {
37
- inputsRef.current[index] = inputRef;
38
- }
39
- }, className: cn((spacing === null || spacing === void 0 ? void 0 : spacing.includes(index)) && styles.cellSpacing, cellClassName), size: size, value: char, disabled: disabled, autoComplete: index === 0 ? 'one-time-code' : undefined, onKeyDown: e => cellHandlers.onKeyDown(e, index), onPaste: cellHandlers.onPaste, onChange: e => cellHandlers.onChange(e, index), validationState: getCellValidationState(char, showEmptyChars, Boolean(resolvedError)) }, index))) }) })), resendCode ? _jsx(ResendCode, Object.assign({}, resendCode, { size: (_a = resendCode.size) !== null && _a !== void 0 ? _a : size })) : null] })));
40
- });
41
- export { FIELD_CODE_DEFAULT_FOCUS_EFFECTS } from './constants';
@@ -1,5 +0,0 @@
1
- import { FieldTextProps } from '@snack-uikit/fields';
2
- export declare const Cell: import("react").ForwardRefExoticComponent<{
3
- /** CSS-класс ячейки кода */
4
- className?: string;
5
- } & Pick<FieldTextProps, "size" | "onPaste" | "onChange" | "onKeyDown" | "value" | "disabled" | "autoComplete" | "validationState"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,21 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import cn from 'classnames';
14
- import { forwardRef } from 'react';
15
- import { FieldText } from '@snack-uikit/fields';
16
- import { ZERO_WIDTH_SPACE } from '../../constants';
17
- import styles from './styles.module.css';
18
- export const Cell = forwardRef((props, ref) => {
19
- const { className, size, value } = props, fieldCellProps = __rest(props, ["className", "size", "value"]);
20
- return (_jsx(FieldText, Object.assign({ inputMode: 'numeric', ref: ref, className: cn(styles.cell, className), "data-size": size, showClearButton: false, value: value === ZERO_WIDTH_SPACE ? '' : value, size: size }, fieldCellProps)));
21
- });
@@ -1 +0,0 @@
1
- export * from './Cell';
@@ -1 +0,0 @@
1
- export * from './Cell';
@@ -1,3 +0,0 @@
1
- .cell input{
2
- text-align:center;
3
- }
@@ -1,8 +0,0 @@
1
- import { ButtonFunctionProps } from '@snack-uikit/button';
2
- export type ResendCodeProps = {
3
- /** Колбек отправки нового кода */
4
- onResend: () => void;
5
- /** Количество секунд до следующего отправления кода */
6
- secondsToNextResend: number;
7
- } & Pick<ButtonFunctionProps, 'size' | 'disabled'>;
8
- export declare function ResendCode(props: ResendCodeProps): import("react/jsx-runtime").JSX.Element;
@@ -1,25 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { UpdateSVG } from '@cloud-ru/uikit-product-icons';
14
- import { useLocale } from '@cloud-ru/uikit-product-locale';
15
- import { ButtonFunction } from '@snack-uikit/button';
16
- import { formatSecondsAsMmSs } from './utils';
17
- export function ResendCode(props) {
18
- const { onResend, secondsToNextResend } = props, buttonProps = __rest(props, ["onResend", "secondsToNextResend"]);
19
- const { t } = useLocale('FieldsPredefined');
20
- return (_jsx(ButtonFunction, Object.assign({ label: secondsToNextResend > 0
21
- ? t('FieldCode.resendCodeButtons.resendCodeWithVia', {
22
- timer: formatSecondsAsMmSs(secondsToNextResend),
23
- })
24
- : t('FieldCode.resendCodeButtons.resendCode'), onClick: onResend, icon: _jsx(UpdateSVG, {}), iconPosition: 'before' }, buttonProps)));
25
- }
@@ -1 +0,0 @@
1
- export * from './ResendCode';
@@ -1 +0,0 @@
1
- export * from './ResendCode';
@@ -1 +0,0 @@
1
- export declare function formatSecondsAsMmSs(totalSeconds: number): string;
@@ -1,5 +0,0 @@
1
- export function formatSecondsAsMmSs(totalSeconds) {
2
- const minutes = Math.floor(totalSeconds / 60);
3
- const seconds = totalSeconds % 60;
4
- return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
5
- }
@@ -1,2 +0,0 @@
1
- export * from './Cell';
2
- export * from './ResendCode';
@@ -1,2 +0,0 @@
1
- export * from './Cell';
2
- export * from './ResendCode';
@@ -1,14 +0,0 @@
1
- export declare const ZERO_WIDTH_SPACE = "\u200B";
2
- /**
3
- * Когда дергать `moveFocus` у `FieldCode` (массив `focusEffects`, порядок не важен).
4
- * @see {@link FIELD_CODE_DEFAULT_FOCUS_EFFECTS}
5
- */
6
- export type FieldCodeFocusEffect =
7
- /** После монтирования — ячейка `0`. */
8
- 'firstCellOnMount'
9
- /** После `ref.resetCode()` — ячейка `0`. */
10
- | 'firstCellOnReset'
11
- /** При включении `showEmptyChars` — первая пустая (все заполнены — последняя); не на каждый ввод. */
12
- | 'firstCellWhenShowEmptyChars';
13
- /** Дефолтный набор для `focusEffects`. */
14
- export declare const FIELD_CODE_DEFAULT_FOCUS_EFFECTS: readonly FieldCodeFocusEffect[];
@@ -1,7 +0,0 @@
1
- export const ZERO_WIDTH_SPACE = '\u200B';
2
- /** Дефолтный набор для `focusEffects`. */
3
- export const FIELD_CODE_DEFAULT_FOCUS_EFFECTS = [
4
- 'firstCellOnMount',
5
- 'firstCellOnReset',
6
- 'firstCellWhenShowEmptyChars',
7
- ];
@@ -1,4 +0,0 @@
1
- export * from './useCodeInput';
2
- export * from './useFieldCodeValidate';
3
- export * from './useFocusCell';
4
- export * from './useFieldHelpers';
@@ -1,4 +0,0 @@
1
- export * from './useCodeInput';
2
- export * from './useFieldCodeValidate';
3
- export * from './useFocusCell';
4
- export * from './useFieldHelpers';
@@ -1,22 +0,0 @@
1
- import { ClipboardEvent, KeyboardEvent } from 'react';
2
- export type UseCodeInputParams = {
3
- /** Количество цифр в коде (ожидается целое ≥ 1) */
4
- codeLength: number;
5
- /** Значение кода */
6
- value?: string;
7
- /** Колбек изменения значения */
8
- onChange?: (code: string) => void;
9
- /** Функция фокуса */
10
- moveFocus: (index: number) => void;
11
- /** Колбек достижения ввода всех символов кода */
12
- onComplete?: (code: string) => void;
13
- };
14
- export declare function useCodeInput(params: UseCodeInputParams): {
15
- code: string[];
16
- cellHandlers: {
17
- onKeyDown: (e: KeyboardEvent<HTMLInputElement>, index: number) => void;
18
- onPaste: (e: ClipboardEvent<HTMLInputElement>) => void;
19
- onChange: (code: string, index: number) => void;
20
- };
21
- onChangeCode: (value: any, ...args: any[]) => any | void;
22
- };