@cloud-ru/uikit-product-fields-predefined 0.15.3 → 0.16.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 (28) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +1 -0
  3. package/dist/cjs/components/FieldAi/FieldAi.d.ts +4 -0
  4. package/dist/cjs/components/FieldAi/FieldAi.js +6 -2
  5. package/dist/cjs/components/FieldAi/components/AlertButton/AlertButton.d.ts +5 -0
  6. package/dist/cjs/components/FieldAi/components/AlertButton/AlertButton.js +12 -0
  7. package/dist/cjs/components/FieldAi/components/AlertButton/index.d.ts +1 -0
  8. package/dist/cjs/components/FieldAi/components/AlertButton/index.js +17 -0
  9. package/dist/cjs/components/FieldAi/components/AlertButton/styles.module.css +17 -0
  10. package/dist/cjs/components/FieldAi/styles.module.css +29 -2
  11. package/dist/cjs/components/FieldPhone/FieldPhone.d.ts +1 -1
  12. package/dist/esm/components/FieldAi/FieldAi.d.ts +4 -0
  13. package/dist/esm/components/FieldAi/FieldAi.js +8 -4
  14. package/dist/esm/components/FieldAi/components/AlertButton/AlertButton.d.ts +5 -0
  15. package/dist/esm/components/FieldAi/components/AlertButton/AlertButton.js +6 -0
  16. package/dist/esm/components/FieldAi/components/AlertButton/index.d.ts +1 -0
  17. package/dist/esm/components/FieldAi/components/AlertButton/index.js +1 -0
  18. package/dist/esm/components/FieldAi/components/AlertButton/styles.module.css +17 -0
  19. package/dist/esm/components/FieldAi/styles.module.css +29 -2
  20. package/dist/esm/components/FieldPhone/FieldPhone.d.ts +1 -1
  21. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  22. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  23. package/package.json +2 -2
  24. package/src/components/FieldAi/FieldAi.tsx +28 -3
  25. package/src/components/FieldAi/components/AlertButton/AlertButton.tsx +16 -0
  26. package/src/components/FieldAi/components/AlertButton/index.ts +1 -0
  27. package/src/components/FieldAi/components/AlertButton/styles.module.scss +20 -0
  28. package/src/components/FieldAi/styles.module.scss +46 -7
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 0.16.0 (2026-01-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * **AINFR-4337:** alert for secure password field ([b44c4dc](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/b44c4dc95160f4758070c33380581a1103c530a5))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.15.3 (2025-12-24)
7
18
 
8
19
  ### Only dependencies have been changed
package/README.md CHANGED
@@ -106,6 +106,7 @@
106
106
  | resizable | `boolean` | - | Может ли ли пользователь изменять размеры поля (если св-во не включено, поле автоматически меняет свой размер) |
107
107
  | secure | `boolean \| "password"` | - | Режим ввода sensitive данных (пароля, API ключей, токенов, etc) |
108
108
  | onResetContextClick | `() => void` | - | Действие при клике по кнопке сброса контекста |
109
+ | onCancelSecure | `() => void` | - | Действие для отмены секьюрности поля |
109
110
  | ref | `LegacyRef<HTMLInputElement>` | - | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs} |
110
111
  | key | `Key` | - | |
111
112
  ## FieldChat
@@ -7,6 +7,8 @@ export type FieldAiProps = WithLayoutType<Omit<FieldTextAreaProps, 'placeholder'
7
7
  onSubmit(value: string): void;
8
8
  /** Действие при клике по кнопке сброса контекста */
9
9
  onResetContextClick?(): void;
10
+ /** Действие для отмены секьюрности поля */
11
+ onCancelSecure?(): void;
10
12
  }>;
11
13
  export declare const FieldAi: import("react").ForwardRefExoticComponent<Omit<FieldTextAreaProps, "size" | "label" | "required" | "placeholder" | "spellCheck" | "labelTooltip" | "footer"> & {
12
14
  /** Режим ввода sensitive данных (пароля, API ключей, токенов, etc) */
@@ -15,6 +17,8 @@ export declare const FieldAi: import("react").ForwardRefExoticComponent<Omit<Fie
15
17
  onSubmit(value: string): void;
16
18
  /** Действие при клике по кнопке сброса контекста */
17
19
  onResetContextClick?(): void;
20
+ /** Действие для отмены секьюрности поля */
21
+ onCancelSecure?(): void;
18
22
  } & {
19
23
  layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
20
24
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -22,17 +22,20 @@ const uikit_product_icons_1 = require("@cloud-ru/uikit-product-icons");
22
22
  const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
23
23
  const uikit_product_mobile_fields_1 = require("@cloud-ru/uikit-product-mobile-fields");
24
24
  const button_1 = require("@snack-uikit/button");
25
+ const figma_tokens_1 = require("@snack-uikit/figma-tokens");
25
26
  const tooltip_1 = require("@snack-uikit/tooltip");
27
+ const typography_1 = require("@snack-uikit/typography");
26
28
  const FieldSubmitButton_1 = require("../../helperComponents/FieldSubmitButton");
27
29
  const TextAreaActionsFooter_1 = require("../../helperComponents/TextAreaActionsFooter");
28
30
  const helpers_1 = require("../../helpers");
29
31
  const AIDisclaimer_1 = require("../AIDisclaimer/AIDisclaimer");
32
+ const AlertButton_1 = require("./components/AlertButton");
30
33
  const MobileFieldAi_1 = require("./components/MobileFieldAi");
31
34
  const WithPasswordValidation_1 = require("./components/WithPasswordValidation");
32
35
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
33
36
  const utils_1 = require("./utils");
34
37
  exports.FieldAi = (0, react_1.forwardRef)((_a, ref) => {
35
- var { secure = false, onSubmit: handleSubmitProp, value, onResetContextClick, disabled, className } = _a, props = __rest(_a, ["secure", "onSubmit", "value", "onResetContextClick", "disabled", "className"]);
38
+ var { secure = false, onSubmit: handleSubmitProp, value, onResetContextClick, onCancelSecure, disabled, className } = _a, props = __rest(_a, ["secure", "onSubmit", "value", "onResetContextClick", "onCancelSecure", "disabled", "className"]);
36
39
  const { layoutType, validationState } = props;
37
40
  const { t } = (0, uikit_product_locale_1.useLocale)('FieldsPredefined');
38
41
  const isTouchDevice = (0, helpers_1.isTouchDevice)(layoutType);
@@ -44,6 +47,7 @@ exports.FieldAi = (0, react_1.forwardRef)((_a, ref) => {
44
47
  const passwordValidation = (0, react_1.useMemo)(() => (0, utils_1.getValidationPassword)(value), [value]);
45
48
  const isPasswordValid = isPasswordMode ? Object.values(passwordValidation).every(Boolean) : true;
46
49
  const showPasswordError = !isPasswordValid && secure && value;
50
+ const showPasswordAlert = Boolean(onCancelSecure) && secure === 'password';
47
51
  (0, react_1.useEffect)(() => () => {
48
52
  if (timerRef.current) {
49
53
  clearTimeout(timerRef.current);
@@ -84,5 +88,5 @@ exports.FieldAi = (0, react_1.forwardRef)((_a, ref) => {
84
88
  if (isTouchDevice && !secure) {
85
89
  return ((0, jsx_runtime_1.jsx)(MobileFieldAi_1.MobileFieldAi, Object.assign({}, props, (0, uikit_product_mobile_fields_1.getAdaptiveFieldProps)(props), { onSubmit: handleSubmit, submitEnabled: isValueValid && !disabled, ref: ref, value: value })));
86
90
  }
87
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.wrapper, className), children: [(0, jsx_runtime_1.jsx)(WithPasswordValidation_1.WithPasswordValidation, { showValidation: isPasswordMode, passwordValidation: passwordValidation, layoutType: layoutType, animatedKey: animatedValidationKey, children: (0, jsx_runtime_1.jsx)(uikit_product_mobile_fields_1.AdaptiveFieldTextArea, Object.assign({}, props, { ref: ref, value: value, size: 'm', minRows: secure ? 1 : 2, maxRows: secure ? 1 : 4, placeholder: secure ? t('FieldAi.secret.placeholder') : t('FieldAi.regular.placeholder'), className: (0, classnames_1.default)(styles_module_scss_1.default.textarea, secure && isValueHidden ? styles_module_scss_1.default.secured : undefined), onKeyDown: handleKeyDown, spellCheck: !secure, validationState: showPasswordError ? 'error' : validationState, footer: (0, jsx_runtime_1.jsx)(TextAreaActionsFooter_1.TextAreaActionsFooter, { left: secure && ((0, jsx_runtime_1.jsx)(button_1.ButtonFunction, { size: 'xs', icon: isValueHidden ? (0, jsx_runtime_1.jsx)(uikit_product_icons_1.EyeSVG, {}) : (0, jsx_runtime_1.jsx)(uikit_product_icons_1.EyeClosedSVG, {}), onClick: () => setIsValueHidden(prev => !prev) })), right: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [secure && onResetContextClick && ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: t('FieldAi.resetContext.tooltip'), hoverDelayOpen: 600, children: (0, jsx_runtime_1.jsx)(button_1.ButtonOutline, { size: 'xs', label: t('FieldAi.resetContext.label'), onClick: onResetContextClick, appearance: 'destructive' }) })), (0, jsx_runtime_1.jsx)(FieldSubmitButton_1.FieldSubmitButton, { showTooltip: !isTouchDevice, className: (0, classnames_1.default)(styles_module_scss_1.default.submitButton, isTouchDevice ? styles_module_scss_1.default.mobileSubmitButton : undefined), active: isValueValid && !disabled && isPasswordValid, handleClick: handleSubmit, size: isTouchDevice ? 's' : 'xs' })] }) }) })) }), !isPasswordMode && (0, jsx_runtime_1.jsx)(AIDisclaimer_1.AIDisclaimer, { layoutType: layoutType })] }));
91
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.wrapper, isPasswordMode && styles_module_scss_1.default.passwordWrapper, className), children: [showPasswordAlert && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.alert, children: [(0, jsx_runtime_1.jsx)(uikit_product_icons_1.PasswordLockSVG, { size: 16, color: figma_tokens_1.themeVars.sys.neutral.textSupport }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { className: styles_module_scss_1.default.alertText, children: t('FieldAi.secret.alert.text') }), (0, jsx_runtime_1.jsx)(AlertButton_1.AlertButton, { label: t('FieldAi.secret.alert.button'), onClick: onCancelSecure })] })), (0, jsx_runtime_1.jsx)(WithPasswordValidation_1.WithPasswordValidation, { showValidation: isPasswordMode, passwordValidation: passwordValidation, layoutType: layoutType, animatedKey: animatedValidationKey, children: (0, jsx_runtime_1.jsx)(uikit_product_mobile_fields_1.AdaptiveFieldTextArea, Object.assign({}, props, { ref: ref, value: value, size: 'm', minRows: secure ? 1 : 2, maxRows: secure ? 1 : 4, placeholder: secure ? t('FieldAi.secret.placeholder') : t('FieldAi.regular.placeholder'), className: (0, classnames_1.default)(styles_module_scss_1.default.textarea, secure && isValueHidden ? styles_module_scss_1.default.secured : undefined), onKeyDown: handleKeyDown, spellCheck: !secure, validationState: showPasswordError ? 'error' : validationState, footer: (0, jsx_runtime_1.jsx)(TextAreaActionsFooter_1.TextAreaActionsFooter, { left: secure && ((0, jsx_runtime_1.jsx)(button_1.ButtonFunction, { size: 'xs', icon: isValueHidden ? (0, jsx_runtime_1.jsx)(uikit_product_icons_1.EyeSVG, {}) : (0, jsx_runtime_1.jsx)(uikit_product_icons_1.EyeClosedSVG, {}), onClick: () => setIsValueHidden(prev => !prev) })), right: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [secure && onResetContextClick && ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: t('FieldAi.resetContext.tooltip'), hoverDelayOpen: 600, children: (0, jsx_runtime_1.jsx)(button_1.ButtonOutline, { size: 'xs', label: t('FieldAi.resetContext.label'), onClick: onResetContextClick, appearance: 'destructive' }) })), (0, jsx_runtime_1.jsx)(FieldSubmitButton_1.FieldSubmitButton, { showTooltip: !isTouchDevice, className: (0, classnames_1.default)(styles_module_scss_1.default.submitButton, isTouchDevice ? styles_module_scss_1.default.mobileSubmitButton : undefined), active: isValueValid && !disabled && isPasswordValid, handleClick: handleSubmit, size: isTouchDevice ? 's' : 'xs' })] }) }) })) }), !isPasswordMode && (0, jsx_runtime_1.jsx)(AIDisclaimer_1.AIDisclaimer, { layoutType: layoutType })] }));
88
92
  });
@@ -0,0 +1,5 @@
1
+ export type AlertButtonProps = {
2
+ label: string;
3
+ onClick?(): void;
4
+ };
5
+ export declare function AlertButton({ label, onClick }: AlertButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AlertButton = AlertButton;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const typography_1 = require("@snack-uikit/typography");
9
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
10
+ function AlertButton({ label, onClick }) {
11
+ return ((0, jsx_runtime_1.jsx)("button", { onClick: onClick, className: styles_module_scss_1.default.button, children: (0, jsx_runtime_1.jsx)(typography_1.Typography.SansLabelM, { className: styles_module_scss_1.default.label, children: label }) }));
12
+ }
@@ -0,0 +1 @@
1
+ export * from './AlertButton';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./AlertButton"), exports);
@@ -0,0 +1,17 @@
1
+ .button{
2
+ outline:none;
3
+ border:none;
4
+ background-color:transparent;
5
+ cursor:pointer;
6
+ height:16px;
7
+ display:flex;
8
+ align-items:center;
9
+ justify-content:center;
10
+ }
11
+
12
+ .label{
13
+ color:var(--sys-blue-text-support, #4877b0);
14
+ }
15
+ .label:hover{
16
+ color:var(--sys-neutral-text-main, #41424e);
17
+ }
@@ -2,6 +2,33 @@
2
2
  display:flex;
3
3
  flex-direction:column;
4
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);
5
32
  }
6
33
 
7
34
  .secured textarea{
@@ -25,10 +52,10 @@
25
52
  }
26
53
 
27
54
  .submitButton:not([data-disabled]){
28
- background:radial-gradient(92.53% 92.53% at 65.87% 21.69%, #7CB5F2 15%, #5FD7C2 45%, #26D07C 65%);
55
+ background:radial-gradient(92.53% 92.53% at 65.87% 21.69%, #7cb5f2 15%, #5fd7c2 45%, #26d07c 65%);
29
56
  }
30
57
 
31
58
  .textarea > :first-child[data-validation=default]:not([data-readonly]):not([data-disable-focus]):focus-within:not([data-disabled]){
32
59
  border-color:transparent;
33
- background:linear-gradient(var(--sys-neutral-background2-level), var(--sys-neutral-background2-level) 0) padding-box, radial-gradient(92.53% 92.53% at 65.87% 21.69%, #7CB5F2 8%, #78B9EC 17%, #70C6DD 28%, #64D8C7 38%, #5FD7C2 44%, #54D5B3 51%, #40D39C 58%, #26D07C 66%) border-box;
60
+ background:linear-gradient(var(--sys-neutral-background2-level), var(--sys-neutral-background2-level) 0) padding-box, radial-gradient(92.53% 92.53% at 65.87% 21.69%, #7cb5f2 8%, #78b9ec 17%, #70c6dd 28%, #64d8c7 38%, #5fd7c2 44%, #54d5b3 51%, #40d39c 58%, #26d07c 66%) border-box;
34
61
  }
@@ -11,7 +11,7 @@ export type FieldPhoneProps = WithLayoutType<Omit<FieldTextProps, 'prefix' | 'pr
11
11
  /** options — объект конфигурации для изменения стандартного списка стран */
12
12
  options?: CountrySettings;
13
13
  }>;
14
- export declare const FieldPhone: import("react").ForwardRefExoticComponent<Omit<FieldTextProps, "onKeyDown" | "maxLength" | "placeholder" | "inputMode" | "prefix" | "prefixIcon" | "postfix" | "autocomplete" | "decoratorRef" | "allowMoreThanMaxLength" | "button"> & {
14
+ export declare const FieldPhone: import("react").ForwardRefExoticComponent<Omit<FieldTextProps, "onKeyDown" | "maxLength" | "placeholder" | "button" | "inputMode" | "prefix" | "prefixIcon" | "postfix" | "autocomplete" | "decoratorRef" | "allowMoreThanMaxLength"> & {
15
15
  /** Включить скролл для основной части списка стран */
16
16
  scrollList?: boolean;
17
17
  onChange?(value: string): void;
@@ -7,6 +7,8 @@ export type FieldAiProps = WithLayoutType<Omit<FieldTextAreaProps, 'placeholder'
7
7
  onSubmit(value: string): void;
8
8
  /** Действие при клике по кнопке сброса контекста */
9
9
  onResetContextClick?(): void;
10
+ /** Действие для отмены секьюрности поля */
11
+ onCancelSecure?(): void;
10
12
  }>;
11
13
  export declare const FieldAi: import("react").ForwardRefExoticComponent<Omit<FieldTextAreaProps, "size" | "label" | "required" | "placeholder" | "spellCheck" | "labelTooltip" | "footer"> & {
12
14
  /** Режим ввода sensitive данных (пароля, API ключей, токенов, etc) */
@@ -15,6 +17,8 @@ export declare const FieldAi: import("react").ForwardRefExoticComponent<Omit<Fie
15
17
  onSubmit(value: string): void;
16
18
  /** Действие при клике по кнопке сброса контекста */
17
19
  onResetContextClick?(): void;
20
+ /** Действие для отмены секьюрности поля */
21
+ onCancelSecure?(): void;
18
22
  } & {
19
23
  layoutType: import("@cloud-ru/uikit-product-utils/.").LayoutType;
20
24
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -9,24 +9,27 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
13
  import cn from 'classnames';
14
14
  import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
15
- import { EyeClosedSVG, EyeSVG } from '@cloud-ru/uikit-product-icons';
15
+ import { EyeClosedSVG, EyeSVG, PasswordLockSVG } from '@cloud-ru/uikit-product-icons';
16
16
  import { useLocale } from '@cloud-ru/uikit-product-locale';
17
17
  import { AdaptiveFieldTextArea, getAdaptiveFieldProps, } from '@cloud-ru/uikit-product-mobile-fields';
18
18
  import { ButtonFunction, ButtonOutline } from '@snack-uikit/button';
19
+ import { themeVars } from '@snack-uikit/figma-tokens';
19
20
  import { Tooltip } from '@snack-uikit/tooltip';
21
+ import { Typography } from '@snack-uikit/typography';
20
22
  import { FieldSubmitButton } from '../../helperComponents/FieldSubmitButton';
21
23
  import { TextAreaActionsFooter } from '../../helperComponents/TextAreaActionsFooter';
22
24
  import { isTouchDevice as isTouchDeviceHelper } from '../../helpers';
23
25
  import { AIDisclaimer } from '../AIDisclaimer/AIDisclaimer';
26
+ import { AlertButton } from './components/AlertButton';
24
27
  import { MobileFieldAi } from './components/MobileFieldAi';
25
28
  import { WithPasswordValidation } from './components/WithPasswordValidation';
26
29
  import styles from './styles.module.css';
27
30
  import { getValidationPassword } from './utils';
28
31
  export const FieldAi = forwardRef((_a, ref) => {
29
- var { secure = false, onSubmit: handleSubmitProp, value, onResetContextClick, disabled, className } = _a, props = __rest(_a, ["secure", "onSubmit", "value", "onResetContextClick", "disabled", "className"]);
32
+ var { secure = false, onSubmit: handleSubmitProp, value, onResetContextClick, onCancelSecure, disabled, className } = _a, props = __rest(_a, ["secure", "onSubmit", "value", "onResetContextClick", "onCancelSecure", "disabled", "className"]);
30
33
  const { layoutType, validationState } = props;
31
34
  const { t } = useLocale('FieldsPredefined');
32
35
  const isTouchDevice = isTouchDeviceHelper(layoutType);
@@ -38,6 +41,7 @@ export const FieldAi = forwardRef((_a, ref) => {
38
41
  const passwordValidation = useMemo(() => getValidationPassword(value), [value]);
39
42
  const isPasswordValid = isPasswordMode ? Object.values(passwordValidation).every(Boolean) : true;
40
43
  const showPasswordError = !isPasswordValid && secure && value;
44
+ const showPasswordAlert = Boolean(onCancelSecure) && secure === 'password';
41
45
  useEffect(() => () => {
42
46
  if (timerRef.current) {
43
47
  clearTimeout(timerRef.current);
@@ -78,5 +82,5 @@ export const FieldAi = forwardRef((_a, ref) => {
78
82
  if (isTouchDevice && !secure) {
79
83
  return (_jsx(MobileFieldAi, Object.assign({}, props, getAdaptiveFieldProps(props), { onSubmit: handleSubmit, submitEnabled: isValueValid && !disabled, ref: ref, value: value })));
80
84
  }
81
- return (_jsxs("div", { className: cn(styles.wrapper, className), children: [_jsx(WithPasswordValidation, { showValidation: isPasswordMode, passwordValidation: passwordValidation, layoutType: layoutType, animatedKey: animatedValidationKey, children: _jsx(AdaptiveFieldTextArea, Object.assign({}, props, { ref: ref, value: value, size: 'm', minRows: secure ? 1 : 2, maxRows: secure ? 1 : 4, placeholder: secure ? t('FieldAi.secret.placeholder') : t('FieldAi.regular.placeholder'), className: cn(styles.textarea, secure && isValueHidden ? styles.secured : undefined), onKeyDown: handleKeyDown, spellCheck: !secure, validationState: showPasswordError ? 'error' : validationState, footer: _jsx(TextAreaActionsFooter, { left: secure && (_jsx(ButtonFunction, { size: 'xs', icon: isValueHidden ? _jsx(EyeSVG, {}) : _jsx(EyeClosedSVG, {}), onClick: () => setIsValueHidden(prev => !prev) })), right: _jsxs(_Fragment, { children: [secure && onResetContextClick && (_jsx(Tooltip, { tip: t('FieldAi.resetContext.tooltip'), hoverDelayOpen: 600, children: _jsx(ButtonOutline, { size: 'xs', label: t('FieldAi.resetContext.label'), onClick: onResetContextClick, appearance: 'destructive' }) })), _jsx(FieldSubmitButton, { showTooltip: !isTouchDevice, className: cn(styles.submitButton, isTouchDevice ? styles.mobileSubmitButton : undefined), active: isValueValid && !disabled && isPasswordValid, handleClick: handleSubmit, size: isTouchDevice ? 's' : 'xs' })] }) }) })) }), !isPasswordMode && _jsx(AIDisclaimer, { layoutType: layoutType })] }));
85
+ return (_jsxs("div", { className: cn(styles.wrapper, isPasswordMode && styles.passwordWrapper, className), children: [showPasswordAlert && (_jsxs("div", { className: styles.alert, children: [_jsx(PasswordLockSVG, { size: 16, color: themeVars.sys.neutral.textSupport }), _jsx(Typography.SansBodyS, { className: styles.alertText, children: t('FieldAi.secret.alert.text') }), _jsx(AlertButton, { label: t('FieldAi.secret.alert.button'), onClick: onCancelSecure })] })), _jsx(WithPasswordValidation, { showValidation: isPasswordMode, passwordValidation: passwordValidation, layoutType: layoutType, animatedKey: animatedValidationKey, children: _jsx(AdaptiveFieldTextArea, Object.assign({}, props, { ref: ref, value: value, size: 'm', minRows: secure ? 1 : 2, maxRows: secure ? 1 : 4, placeholder: secure ? t('FieldAi.secret.placeholder') : t('FieldAi.regular.placeholder'), className: cn(styles.textarea, secure && isValueHidden ? styles.secured : undefined), onKeyDown: handleKeyDown, spellCheck: !secure, validationState: showPasswordError ? 'error' : validationState, footer: _jsx(TextAreaActionsFooter, { left: secure && (_jsx(ButtonFunction, { size: 'xs', icon: isValueHidden ? _jsx(EyeSVG, {}) : _jsx(EyeClosedSVG, {}), onClick: () => setIsValueHidden(prev => !prev) })), right: _jsxs(_Fragment, { children: [secure && onResetContextClick && (_jsx(Tooltip, { tip: t('FieldAi.resetContext.tooltip'), hoverDelayOpen: 600, children: _jsx(ButtonOutline, { size: 'xs', label: t('FieldAi.resetContext.label'), onClick: onResetContextClick, appearance: 'destructive' }) })), _jsx(FieldSubmitButton, { showTooltip: !isTouchDevice, className: cn(styles.submitButton, isTouchDevice ? styles.mobileSubmitButton : undefined), active: isValueValid && !disabled && isPasswordValid, handleClick: handleSubmit, size: isTouchDevice ? 's' : 'xs' })] }) }) })) }), !isPasswordMode && _jsx(AIDisclaimer, { layoutType: layoutType })] }));
82
86
  });
@@ -0,0 +1,5 @@
1
+ export type AlertButtonProps = {
2
+ label: string;
3
+ onClick?(): void;
4
+ };
5
+ export declare function AlertButton({ label, onClick }: AlertButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Typography } from '@snack-uikit/typography';
3
+ import styles from './styles.module.css';
4
+ export function AlertButton({ label, onClick }) {
5
+ return (_jsx("button", { onClick: onClick, className: styles.button, children: _jsx(Typography.SansLabelM, { className: styles.label, children: label }) }));
6
+ }
@@ -0,0 +1 @@
1
+ export * from './AlertButton';
@@ -0,0 +1 @@
1
+ export * from './AlertButton';
@@ -0,0 +1,17 @@
1
+ .button{
2
+ outline:none;
3
+ border:none;
4
+ background-color:transparent;
5
+ cursor:pointer;
6
+ height:16px;
7
+ display:flex;
8
+ align-items:center;
9
+ justify-content:center;
10
+ }
11
+
12
+ .label{
13
+ color:var(--sys-blue-text-support, #4877b0);
14
+ }
15
+ .label:hover{
16
+ color:var(--sys-neutral-text-main, #41424e);
17
+ }
@@ -2,6 +2,33 @@
2
2
  display:flex;
3
3
  flex-direction:column;
4
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);
5
32
  }
6
33
 
7
34
  .secured textarea{
@@ -25,10 +52,10 @@
25
52
  }
26
53
 
27
54
  .submitButton:not([data-disabled]){
28
- background:radial-gradient(92.53% 92.53% at 65.87% 21.69%, #7CB5F2 15%, #5FD7C2 45%, #26D07C 65%);
55
+ background:radial-gradient(92.53% 92.53% at 65.87% 21.69%, #7cb5f2 15%, #5fd7c2 45%, #26d07c 65%);
29
56
  }
30
57
 
31
58
  .textarea > :first-child[data-validation=default]:not([data-readonly]):not([data-disable-focus]):focus-within:not([data-disabled]){
32
59
  border-color:transparent;
33
- background:linear-gradient(var(--sys-neutral-background2-level), var(--sys-neutral-background2-level) 0) padding-box, radial-gradient(92.53% 92.53% at 65.87% 21.69%, #7CB5F2 8%, #78B9EC 17%, #70C6DD 28%, #64D8C7 38%, #5FD7C2 44%, #54D5B3 51%, #40D39C 58%, #26D07C 66%) border-box;
60
+ background:linear-gradient(var(--sys-neutral-background2-level), var(--sys-neutral-background2-level) 0) padding-box, radial-gradient(92.53% 92.53% at 65.87% 21.69%, #7cb5f2 8%, #78b9ec 17%, #70c6dd 28%, #64d8c7 38%, #5fd7c2 44%, #54d5b3 51%, #40d39c 58%, #26d07c 66%) border-box;
34
61
  }
@@ -11,7 +11,7 @@ export type FieldPhoneProps = WithLayoutType<Omit<FieldTextProps, 'prefix' | 'pr
11
11
  /** options — объект конфигурации для изменения стандартного списка стран */
12
12
  options?: CountrySettings;
13
13
  }>;
14
- export declare const FieldPhone: import("react").ForwardRefExoticComponent<Omit<FieldTextProps, "onKeyDown" | "maxLength" | "placeholder" | "inputMode" | "prefix" | "prefixIcon" | "postfix" | "autocomplete" | "decoratorRef" | "allowMoreThanMaxLength" | "button"> & {
14
+ export declare const FieldPhone: import("react").ForwardRefExoticComponent<Omit<FieldTextProps, "onKeyDown" | "maxLength" | "placeholder" | "button" | "inputMode" | "prefix" | "prefixIcon" | "postfix" | "autocomplete" | "decoratorRef" | "allowMoreThanMaxLength"> & {
15
15
  /** Включить скролл для основной части списка стран */
16
16
  scrollList?: boolean;
17
17
  onChange?(value: string): void;