@snack-uikit/fields 0.32.5-preview-1bd2190e.0 → 0.32.5

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.32.5 (2024-11-14)
7
+
8
+
9
+ ### Dependencies
10
+
11
+ * **FF-5678:** up deps classnames/uncontrollable ([8f0d645](https://github.com/cloud-ru-tech/snack-uikit/commit/8f0d645fc7eb8eaf95660cd0ae7d4b550821059b))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.32.4 (2024-11-12)
7
18
 
8
19
  ### Only dependencies have been changed
@@ -42,11 +42,6 @@ const getDefaultValue = (min, max) => {
42
42
  }
43
43
  return 0;
44
44
  };
45
- const SymbolWidth = {
46
- s: 8,
47
- m: 9,
48
- l: 10
49
- };
50
45
  exports.FieldStepper = (0, react_1.forwardRef)((_a, ref) => {
51
46
  var {
52
47
  id,
@@ -204,68 +199,54 @@ exports.FieldStepper = (0, react_1.forwardRef)((_a, ref) => {
204
199
  readonly: readonly,
205
200
  variant: constants_1.CONTAINER_VARIANT.SingleLine,
206
201
  inputRef: inputRef,
207
- prefix: (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
208
- tabIndex: -1,
209
- ref: minusButtonRef,
210
- size: 'xs',
211
- className: styles_module_scss_1.default.button,
212
- icon: (0, jsx_runtime_1.jsx)(icons_1.MinusSVG, {}),
213
- onClick: handleMinusButtonClick,
214
- onKeyDown: handleMinusButtonKeyDown,
215
- disabled: isMinusButtonDisabled,
216
- "data-test-id": 'field-stepper__minus-button'
217
- }),
218
- postfix: (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
219
- ref: plusButtonRef,
220
- tabIndex: -1,
221
- size: 'xs',
222
- className: styles_module_scss_1.default.button,
223
- icon: (0, jsx_runtime_1.jsx)(icons_1.PlusSVG, {}),
224
- onClick: handlePlusButtonClick,
225
- onKeyDown: handlePlusButtonKeyDown,
226
- disabled: isPlusButtonDisabled,
227
- "data-test-id": 'field-stepper__plus-button'
202
+ prefix: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
203
+ children: [(0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
204
+ tabIndex: -1,
205
+ ref: minusButtonRef,
206
+ size: 'xs',
207
+ className: styles_module_scss_1.default.button,
208
+ icon: (0, jsx_runtime_1.jsx)(icons_1.MinusSVG, {}),
209
+ onClick: handleMinusButtonClick,
210
+ onKeyDown: handleMinusButtonKeyDown,
211
+ disabled: isMinusButtonDisabled,
212
+ "data-test-id": 'field-stepper__minus-button'
213
+ }), prefixSettings.show && prefixSettings.render({
214
+ key: prefixSettings.id
215
+ })]
228
216
  }),
229
- children: (0, jsx_runtime_1.jsxs)("div", {
230
- style: {
231
- display: 'flex',
232
- justifyContent: 'center',
233
- gap: 4,
234
- maxWidth: '100%'
235
- },
236
- children: [(0, jsx_runtime_1.jsx)("div", {
237
- children: prefixSettings.show && prefixSettings.render({
238
- key: prefixSettings.id
239
- })
240
- }), (0, jsx_runtime_1.jsx)("div", {
241
- style: {
242
- width: String(value).length * SymbolWidth[size],
243
- maxWidth: '100%'
244
- },
245
- children: (0, jsx_runtime_1.jsx)(input_private_1.InputPrivate, {
246
- ref: (0, merge_refs_1.default)(ref, inputRef),
247
- className: styles_module_scss_1.default.stepper,
248
- "data-size": size,
249
- value: String(value),
250
- tabIndex: 0,
251
- onKeyDown: handleInputKeyDown,
252
- onChange: handleInputChange,
253
- onBlur: handleInputBlur,
254
- onFocus: handleInputFocus,
255
- disabled: disabled,
256
- readonly: readonly,
257
- type: 'number',
258
- id: id,
259
- name: name,
260
- min: min,
261
- max: max,
262
- "data-test-id": 'field-stepper__input'
263
- })
264
- }), (0, jsx_runtime_1.jsx)("div", {
265
- children: postfixSettings.show && postfixSettings.render({
266
- key: postfixSettings.id
267
- })
217
+ postfix: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
218
+ children: [postfixSettings.show && postfixSettings.render({
219
+ key: postfixSettings.id
220
+ }), (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
221
+ ref: plusButtonRef,
222
+ tabIndex: -1,
223
+ size: 'xs',
224
+ className: styles_module_scss_1.default.button,
225
+ icon: (0, jsx_runtime_1.jsx)(icons_1.PlusSVG, {}),
226
+ onClick: handlePlusButtonClick,
227
+ onKeyDown: handlePlusButtonKeyDown,
228
+ disabled: isPlusButtonDisabled,
229
+ "data-test-id": 'field-stepper__plus-button'
268
230
  })]
231
+ }),
232
+ children: (0, jsx_runtime_1.jsx)(input_private_1.InputPrivate, {
233
+ ref: (0, merge_refs_1.default)(ref, inputRef),
234
+ className: styles_module_scss_1.default.stepper,
235
+ "data-size": size,
236
+ value: String(value),
237
+ tabIndex: 0,
238
+ onKeyDown: handleInputKeyDown,
239
+ onChange: handleInputChange,
240
+ onBlur: handleInputBlur,
241
+ onFocus: handleInputFocus,
242
+ disabled: disabled,
243
+ readonly: readonly,
244
+ type: 'number',
245
+ id: id,
246
+ name: name,
247
+ min: min,
248
+ max: max,
249
+ "data-test-id": 'field-stepper__input'
269
250
  })
270
251
  })
271
252
  })
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import mergeRefs from 'merge-refs';
14
14
  import { forwardRef, useEffect, useRef, useState, } from 'react';
15
15
  import { ButtonFunction } from '@snack-uikit/button';
@@ -34,11 +34,6 @@ const getDefaultValue = (min, max) => {
34
34
  }
35
35
  return 0;
36
36
  };
37
- const SymbolWidth = {
38
- s: 8,
39
- m: 9,
40
- l: 10,
41
- };
42
37
  export const FieldStepper = forwardRef((_a, ref) => {
43
38
  var { id, name, value: valueProp, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFINITY, step = 1, disabled = false, readonly = false, allowMoreThanLimits = true, onChange: onChangeProp, onFocus, onBlur, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, prefix, postfix } = _a, rest = __rest(_a, ["id", "name", "value", "min", "max", "step", "disabled", "readonly", "allowMoreThanLimits", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "error", "prefix", "postfix"]);
44
39
  const { t } = useLocale('Fields');
@@ -131,13 +126,5 @@ export const FieldStepper = forwardRef((_a, ref) => {
131
126
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
132
127
  }
133
128
  };
134
- return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, validationState: fieldValidationState, error: error }, extractSupportProps(rest), { children: _jsx(Tooltip, { tip: tooltip, open: allowMoreThanLimits ? false : tooltipOpen, "data-test-id": 'field-stepper__limit-tooltip', children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: inputRef, prefix: _jsx(ButtonFunction, { tabIndex: -1, ref: minusButtonRef, size: 'xs', className: styles.button, icon: _jsx(MinusSVG, {}), onClick: handleMinusButtonClick, onKeyDown: handleMinusButtonKeyDown, disabled: isMinusButtonDisabled, "data-test-id": 'field-stepper__minus-button' }), postfix: _jsx(ButtonFunction, { ref: plusButtonRef, tabIndex: -1, size: 'xs', className: styles.button, icon: _jsx(PlusSVG, {}), onClick: handlePlusButtonClick, onKeyDown: handlePlusButtonKeyDown, disabled: isPlusButtonDisabled, "data-test-id": 'field-stepper__plus-button' }), children: _jsxs("div", { style: {
135
- display: 'flex',
136
- justifyContent: 'center',
137
- gap: 4,
138
- maxWidth: '100%',
139
- }, children: [_jsx("div", { children: prefixSettings.show && prefixSettings.render({ key: prefixSettings.id }) }), _jsx("div", { style: {
140
- width: String(value).length * SymbolWidth[size],
141
- maxWidth: '100%',
142
- }, children: _jsx(InputPrivate, { ref: mergeRefs(ref, inputRef), className: styles.stepper, "data-size": size, value: String(value), tabIndex: 0, onKeyDown: handleInputKeyDown, onChange: handleInputChange, onBlur: handleInputBlur, onFocus: handleInputFocus, disabled: disabled, readonly: readonly, type: 'number', id: id, name: name, min: min, max: max, "data-test-id": 'field-stepper__input' }) }), _jsx("div", { children: postfixSettings.show && postfixSettings.render({ key: postfixSettings.id }) })] }) }) }) })));
129
+ return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, validationState: fieldValidationState, error: error }, extractSupportProps(rest), { children: _jsx(Tooltip, { tip: tooltip, open: allowMoreThanLimits ? false : tooltipOpen, "data-test-id": 'field-stepper__limit-tooltip', children: _jsx(FieldContainerPrivate, { size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, inputRef: inputRef, prefix: _jsxs(_Fragment, { children: [_jsx(ButtonFunction, { tabIndex: -1, ref: minusButtonRef, size: 'xs', className: styles.button, icon: _jsx(MinusSVG, {}), onClick: handleMinusButtonClick, onKeyDown: handleMinusButtonKeyDown, disabled: isMinusButtonDisabled, "data-test-id": 'field-stepper__minus-button' }), prefixSettings.show && prefixSettings.render({ key: prefixSettings.id })] }), postfix: _jsxs(_Fragment, { children: [postfixSettings.show && postfixSettings.render({ key: postfixSettings.id }), _jsx(ButtonFunction, { ref: plusButtonRef, tabIndex: -1, size: 'xs', className: styles.button, icon: _jsx(PlusSVG, {}), onClick: handlePlusButtonClick, onKeyDown: handlePlusButtonKeyDown, disabled: isPlusButtonDisabled, "data-test-id": 'field-stepper__plus-button' })] }), children: _jsx(InputPrivate, { ref: mergeRefs(ref, inputRef), className: styles.stepper, "data-size": size, value: String(value), tabIndex: 0, onKeyDown: handleInputKeyDown, onChange: handleInputChange, onBlur: handleInputBlur, onFocus: handleInputFocus, disabled: disabled, readonly: readonly, type: 'number', id: id, name: name, min: min, max: max, "data-test-id": 'field-stepper__input' }) }) }) })));
143
130
  });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Fields",
7
- "version": "0.32.5-preview-1bd2190e.0",
7
+ "version": "0.32.5",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -36,25 +36,25 @@
36
36
  "license": "Apache-2.0",
37
37
  "scripts": {},
38
38
  "dependencies": {
39
- "@snack-uikit/button": "0.19.2",
40
- "@snack-uikit/calendar": "0.11.4",
41
- "@snack-uikit/color-picker": "0.3.2",
42
- "@snack-uikit/divider": "3.2.0",
43
- "@snack-uikit/dropdown": "0.4.0",
39
+ "@snack-uikit/button": "0.19.3",
40
+ "@snack-uikit/calendar": "0.11.5",
41
+ "@snack-uikit/color-picker": "0.3.3",
42
+ "@snack-uikit/divider": "3.2.1",
43
+ "@snack-uikit/dropdown": "0.4.1",
44
44
  "@snack-uikit/icons": "0.24.0",
45
- "@snack-uikit/input-private": "4.2.1",
46
- "@snack-uikit/list": "0.21.4",
47
- "@snack-uikit/scroll": "0.9.0",
48
- "@snack-uikit/skeleton": "0.5.0",
49
- "@snack-uikit/slider": "0.3.1",
50
- "@snack-uikit/tag": "0.11.1",
51
- "@snack-uikit/tooltip": "0.15.0",
52
- "@snack-uikit/truncate-string": "0.6.0",
45
+ "@snack-uikit/input-private": "4.2.2",
46
+ "@snack-uikit/list": "0.21.5",
47
+ "@snack-uikit/scroll": "0.9.1",
48
+ "@snack-uikit/skeleton": "0.5.1",
49
+ "@snack-uikit/slider": "0.3.2",
50
+ "@snack-uikit/tag": "0.11.2",
51
+ "@snack-uikit/tooltip": "0.15.1",
52
+ "@snack-uikit/truncate-string": "0.6.1",
53
53
  "@snack-uikit/utils": "3.5.0",
54
- "classnames": "2.3.2",
54
+ "classnames": "2.5.1",
55
55
  "copy-to-clipboard": "3.3.3",
56
56
  "fuzzy-search": "3.2.1",
57
- "merge-refs": "1.2.2",
57
+ "merge-refs": "1.3.0",
58
58
  "react-textarea-autosize": "8.5.3",
59
59
  "uncontrollable": "8.0.4"
60
60
  },
@@ -65,5 +65,5 @@
65
65
  "peerDependencies": {
66
66
  "@snack-uikit/locale": "*"
67
67
  },
68
- "gitHead": "9ba12a400b500296598a57048295ebd19c6bf22e"
68
+ "gitHead": "b9670e68c6af5fdd5dfceeae29ef3af8c89e5e6b"
69
69
  }
@@ -76,12 +76,6 @@ const getDefaultValue = (min: number, max: number) => {
76
76
  return 0;
77
77
  };
78
78
 
79
- const SymbolWidth = {
80
- s: 8,
81
- m: 9,
82
- l: 10,
83
- };
84
-
85
79
  export const FieldStepper = forwardRef<HTMLInputElement, FieldStepperProps>(
86
80
  (
87
81
  {
@@ -256,70 +250,58 @@ export const FieldStepper = forwardRef<HTMLInputElement, FieldStepperProps>(
256
250
  variant={CONTAINER_VARIANT.SingleLine}
257
251
  inputRef={inputRef}
258
252
  prefix={
259
- <ButtonFunction
260
- tabIndex={-1}
261
- ref={minusButtonRef}
262
- size='xs'
263
- className={styles.button}
264
- icon={<MinusSVG />}
265
- onClick={handleMinusButtonClick}
266
- onKeyDown={handleMinusButtonKeyDown}
267
- disabled={isMinusButtonDisabled}
268
- data-test-id='field-stepper__minus-button'
269
- />
253
+ <>
254
+ <ButtonFunction
255
+ tabIndex={-1}
256
+ ref={minusButtonRef}
257
+ size='xs'
258
+ className={styles.button}
259
+ icon={<MinusSVG />}
260
+ onClick={handleMinusButtonClick}
261
+ onKeyDown={handleMinusButtonKeyDown}
262
+ disabled={isMinusButtonDisabled}
263
+ data-test-id='field-stepper__minus-button'
264
+ />
265
+ {prefixSettings.show && prefixSettings.render({ key: prefixSettings.id })}
266
+ </>
270
267
  }
271
268
  postfix={
272
- <ButtonFunction
273
- ref={plusButtonRef}
274
- tabIndex={-1}
275
- size='xs'
276
- className={styles.button}
277
- icon={<PlusSVG />}
278
- onClick={handlePlusButtonClick}
279
- onKeyDown={handlePlusButtonKeyDown}
280
- disabled={isPlusButtonDisabled}
281
- data-test-id='field-stepper__plus-button'
282
- />
269
+ <>
270
+ {postfixSettings.show && postfixSettings.render({ key: postfixSettings.id })}
271
+
272
+ <ButtonFunction
273
+ ref={plusButtonRef}
274
+ tabIndex={-1}
275
+ size='xs'
276
+ className={styles.button}
277
+ icon={<PlusSVG />}
278
+ onClick={handlePlusButtonClick}
279
+ onKeyDown={handlePlusButtonKeyDown}
280
+ disabled={isPlusButtonDisabled}
281
+ data-test-id='field-stepper__plus-button'
282
+ />
283
+ </>
283
284
  }
284
285
  >
285
- <div
286
- style={{
287
- display: 'flex',
288
- justifyContent: 'center',
289
- gap: 4,
290
- maxWidth: '100%',
291
- }}
292
- >
293
- <div>{prefixSettings.show && prefixSettings.render({ key: prefixSettings.id })}</div>
294
-
295
- <div
296
- style={{
297
- width: String(value).length * SymbolWidth[size],
298
- maxWidth: '100%',
299
- }}
300
- >
301
- <InputPrivate
302
- ref={mergeRefs(ref, inputRef)}
303
- className={styles.stepper}
304
- data-size={size}
305
- value={String(value)}
306
- tabIndex={0}
307
- onKeyDown={handleInputKeyDown}
308
- onChange={handleInputChange}
309
- onBlur={handleInputBlur}
310
- onFocus={handleInputFocus}
311
- disabled={disabled}
312
- readonly={readonly}
313
- type='number'
314
- id={id}
315
- name={name}
316
- min={min}
317
- max={max}
318
- data-test-id='field-stepper__input'
319
- />
320
- </div>
321
- <div>{postfixSettings.show && postfixSettings.render({ key: postfixSettings.id })}</div>
322
- </div>
286
+ <InputPrivate
287
+ ref={mergeRefs(ref, inputRef)}
288
+ className={styles.stepper}
289
+ data-size={size}
290
+ value={String(value)}
291
+ tabIndex={0}
292
+ onKeyDown={handleInputKeyDown}
293
+ onChange={handleInputChange}
294
+ onBlur={handleInputBlur}
295
+ onFocus={handleInputFocus}
296
+ disabled={disabled}
297
+ readonly={readonly}
298
+ type='number'
299
+ id={id}
300
+ name={name}
301
+ min={min}
302
+ max={max}
303
+ data-test-id='field-stepper__input'
304
+ />
323
305
  </FieldContainerPrivate>
324
306
  </Tooltip>
325
307
  </FieldDecorator>