@snack-uikit/fields 0.38.3 → 0.39.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.
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.39.0 (2025-02-04)
7
+
8
+
9
+ ### Features
10
+
11
+ * **PDS-161:** add type attribute to FieldText ([520fb32](https://github.com/cloud-ru-tech/snack-uikit/commit/520fb3214bc951ce4888745f633376f1a109c083))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.38.3 (2025-02-04)
7
18
 
8
19
  ### Only dependencies have been changed
package/README.md CHANGED
@@ -450,6 +450,7 @@ FieldStepper в основном предназначен для работы с
450
450
  | prefix | `ReactNode` | - | Произвольный префикс для поля |
451
451
  | postfix | `ReactNode` | - | Произвольный постфикс для поля |
452
452
  | button | `Button` | - | Кнопка действия внутри поля |
453
+ | type | "text" \| "tel" \| "email" | text | |
453
454
  | onChange | `(value: string, e?: ChangeEvent<HTMLInputElement>) => void` | - | Колбек смены значения |
454
455
  | value | `string` | - | Значение input |
455
456
  | id | `string` | - | Значение html-атрибута id |
@@ -25,6 +25,7 @@ type FieldTextOwnProps = {
25
25
  postfix?: ReactNode;
26
26
  /** Кнопка действия внутри поля */
27
27
  button?: Button;
28
+ type?: 'text' | 'tel' | 'email';
28
29
  };
29
30
  export type FieldTextProps = WithSupportProps<FieldTextOwnProps & InputProps & WrapperProps>;
30
31
  export declare const FieldText: import("react").ForwardRefExoticComponent<{
@@ -61,9 +61,10 @@ exports.FieldText = (0, react_1.forwardRef)((_a, ref) => {
61
61
  postfix,
62
62
  button: buttonProp,
63
63
  onPaste,
64
- onKeyDown
64
+ onKeyDown,
65
+ type = 'text'
65
66
  } = _a,
66
- rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "onChange", "onFocus", "onBlur", "onCopyButtonClick", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "autoComplete", "prefixIcon", "prefix", "postfix", "button", "onPaste", "onKeyDown"]);
67
+ rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "onChange", "onFocus", "onBlur", "onCopyButtonClick", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "autoComplete", "prefixIcon", "prefix", "postfix", "button", "onPaste", "onKeyDown", "type"]);
67
68
  const [value = '', onChange] = (0, hooks_1.useValueControl)({
68
69
  value: valueProp,
69
70
  defaultValue: '',
@@ -203,7 +204,7 @@ exports.FieldText = (0, react_1.forwardRef)((_a, ref) => {
203
204
  placeholder: placeholder,
204
205
  disabled: disabled,
205
206
  readonly: readonly,
206
- type: 'text',
207
+ type: type,
207
208
  maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined,
208
209
  id: id,
209
210
  name: name,
@@ -25,6 +25,7 @@ type FieldTextOwnProps = {
25
25
  postfix?: ReactNode;
26
26
  /** Кнопка действия внутри поля */
27
27
  button?: Button;
28
+ type?: 'text' | 'tel' | 'email';
28
29
  };
29
30
  export type FieldTextProps = WithSupportProps<FieldTextOwnProps & InputProps & WrapperProps>;
30
31
  export declare const FieldText: import("react").ForwardRefExoticComponent<{
@@ -21,7 +21,7 @@ import { getValidationState } from '../../utils/getValidationState';
21
21
  import { FieldDecorator } from '../FieldDecorator';
22
22
  import { getContainerVariant } from './helpers';
23
23
  export const FieldText = forwardRef((_a, ref) => {
24
- var { id, name, value: valueProp, placeholder, maxLength, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, allowMoreThanMaxLength = false, onChange: onChangeProp, onFocus, onBlur, onCopyButtonClick, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, autoComplete, prefixIcon, prefix, postfix, button: buttonProp, onPaste, onKeyDown } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "onChange", "onFocus", "onBlur", "onCopyButtonClick", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "autoComplete", "prefixIcon", "prefix", "postfix", "button", "onPaste", "onKeyDown"]);
24
+ var { id, name, value: valueProp, placeholder, maxLength, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, allowMoreThanMaxLength = false, onChange: onChangeProp, onFocus, onBlur, onCopyButtonClick, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, autoComplete, prefixIcon, prefix, postfix, button: buttonProp, onPaste, onKeyDown, type = 'text' } = _a, rest = __rest(_a, ["id", "name", "value", "placeholder", "maxLength", "disabled", "readonly", "showCopyButton", "showClearButton", "allowMoreThanMaxLength", "onChange", "onFocus", "onBlur", "onCopyButtonClick", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "autoComplete", "prefixIcon", "prefix", "postfix", "button", "onPaste", "onKeyDown", "type"]);
25
25
  const [value = '', onChange] = useValueControl({
26
26
  value: valueProp,
27
27
  defaultValue: '',
@@ -91,5 +91,5 @@ export const FieldText = forwardRef((_a, ref) => {
91
91
  onInputKeyDown(event);
92
92
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
93
93
  };
94
- return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, length: maxLength ? { max: maxLength, current: value.length } : undefined, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, validationState: fieldValidationState, error: error }, extractSupportProps(rest), { children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: containerVariant, inputRef: localRef, prefix: prefixButtons, postfix: postfixButtons, disableFocus: isButtonFocused, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, tabIndex: inputTabIndex, onKeyDown: handleKeyDown, onPaste: onPaste, placeholder: placeholder, disabled: disabled, readonly: readonly, type: 'text', maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, id: id, name: name, autoComplete: autoComplete, "data-test-id": 'field-text__input' }) }) })));
94
+ return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, length: maxLength ? { max: maxLength, current: value.length } : undefined, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, validationState: fieldValidationState, error: error }, extractSupportProps(rest), { children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: containerVariant, inputRef: localRef, prefix: prefixButtons, postfix: postfixButtons, disableFocus: isButtonFocused, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, tabIndex: inputTabIndex, onKeyDown: handleKeyDown, onPaste: onPaste, placeholder: placeholder, disabled: disabled, readonly: readonly, type: type, maxLength: allowMoreThanMaxLength ? undefined : maxLength || undefined, id: id, name: name, autoComplete: autoComplete, "data-test-id": 'field-text__input' }) }) })));
95
95
  });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Fields",
7
- "version": "0.38.3",
7
+ "version": "0.39.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -65,5 +65,5 @@
65
65
  "peerDependencies": {
66
66
  "@snack-uikit/locale": "*"
67
67
  },
68
- "gitHead": "4beda461fbd94378a1534458d7942270226a39ef"
68
+ "gitHead": "a07145604050db9fe5d5ada9a4ae99d3cd6a1874"
69
69
  }
@@ -72,6 +72,9 @@ type FieldTextOwnProps = {
72
72
  postfix?: ReactNode;
73
73
  /** Кнопка действия внутри поля */
74
74
  button?: Button;
75
+
76
+ /* HTMLInputTypeAttribute */
77
+ type?: 'text' | 'tel' | 'email';
75
78
  };
76
79
 
77
80
  export type FieldTextProps = WithSupportProps<FieldTextOwnProps & InputProps & WrapperProps>;
@@ -111,6 +114,7 @@ export const FieldText = forwardRef<HTMLInputElement, FieldTextProps>(
111
114
  button: buttonProp,
112
115
  onPaste,
113
116
  onKeyDown,
117
+ type = 'text',
114
118
  ...rest
115
119
  },
116
120
  ref,
@@ -250,7 +254,7 @@ export const FieldText = forwardRef<HTMLInputElement, FieldTextProps>(
250
254
  placeholder={placeholder}
251
255
  disabled={disabled}
252
256
  readonly={readonly}
253
- type='text'
257
+ type={type}
254
258
  maxLength={allowMoreThanMaxLength ? undefined : maxLength || undefined}
255
259
  id={id}
256
260
  name={name}