@cloud-ru/ds-uikit-product-fields-predefined 4.0.5-preview-e8fe6b56.0 → 4.1.1
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 +14 -0
- package/dist/cjs/components/FieldCode/hooks/useCodeInput.js +1 -2
- package/dist/esm/components/FieldCode/hooks/useCodeInput.js +1 -2
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/components/FieldCode/hooks/useCodeInput.ts +1 -2
- package/dist/cjs/components/FieldCode/hooks/useRefState.d.ts +0 -7
- package/dist/cjs/components/FieldCode/hooks/useRefState.js +0 -21
- package/dist/esm/components/FieldCode/hooks/useRefState.d.ts +0 -7
- package/dist/esm/components/FieldCode/hooks/useRefState.js +0 -18
- package/src/components/FieldCode/hooks/useRefState.ts +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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
|
+
## 4.1.1 (2026-11-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @ds/uikit-product-fields-predefined
|
|
9
|
+
|
|
10
|
+
# 4.1.0 (2026-11-11)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **FF-9112:** use useRefState from utils ([712ed2a](https://github.com/cloud-ru-tech/snack-v2/commit/712ed2a25244ea744f34e19c4b05d416522d0939))
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- **AINFR-5574:** add ai-field-input, ai-attachment, some helper components ([3715925](https://github.com/cloud-ru-tech/snack-v2/commit/37159255b581aa6d898bbf9866d5ce2476c6aa28))
|
|
19
|
+
|
|
6
20
|
## 4.0.4 (2026-11-04)
|
|
7
21
|
|
|
8
22
|
**Note:** Version bump only for package @ds/uikit-product-fields-predefined
|
|
@@ -5,7 +5,6 @@ const utils_1 = require("@cloud-ru/ds-utils");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const constants_1 = require("../constants");
|
|
7
7
|
const utils_2 = require("../utils");
|
|
8
|
-
const useRefState_1 = require("./useRefState");
|
|
9
8
|
const buildCodeArray = (str, codeLength) => Array.from({ length: codeLength }, (_, idx) => str[idx] || constants_1.ZERO_WIDTH_SPACE);
|
|
10
9
|
function useCodeInput(params) {
|
|
11
10
|
const { value: valueProp, onChange: onChangeProp, codeLength, moveFocus, onComplete } = params;
|
|
@@ -14,7 +13,7 @@ function useCodeInput(params) {
|
|
|
14
13
|
onChange: onChangeProp,
|
|
15
14
|
defaultValue: '',
|
|
16
15
|
});
|
|
17
|
-
const codeRef = (0,
|
|
16
|
+
const codeRef = (0, utils_1.useRefState)(buildCodeArray(value, codeLength));
|
|
18
17
|
const updateCodeByIndex = (0, react_1.useCallback)((index, newChar) => {
|
|
19
18
|
codeRef.current[index] = newChar;
|
|
20
19
|
onChange?.(codeRef.current.join(''));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { useValueControl } from '@cloud-ru/ds-utils';
|
|
1
|
+
import { useRefState, useValueControl } from '@cloud-ru/ds-utils';
|
|
2
2
|
import { useCallback, useEffect } from 'react';
|
|
3
3
|
import { ZERO_WIDTH_SPACE } from '../constants.js';
|
|
4
4
|
import { isNumberChar, isStringCodeLength, isZeroWidthSpace } from '../utils.js';
|
|
5
|
-
import { useRefState } from './useRefState.js';
|
|
6
5
|
const buildCodeArray = (str, codeLength) => Array.from({ length: codeLength }, (_, idx) => str[idx] || ZERO_WIDTH_SPACE);
|
|
7
6
|
export function useCodeInput(params) {
|
|
8
7
|
const { value: valueProp, onChange: onChangeProp, codeLength, moveFocus, onComplete } = params;
|