@snack-uikit/fields 0.55.0 → 0.55.1-preview-ff470bb3.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/README.md +3 -2
- package/dist/cjs/components/FieldTime/FieldTime.d.ts +22 -2
- package/dist/cjs/components/FieldTime/FieldTime.js +5 -3
- package/dist/esm/components/FieldTime/FieldTime.d.ts +22 -2
- package/dist/esm/components/FieldTime/FieldTime.js +2 -2
- package/package.json +3 -3
- package/src/components/FieldTime/FieldTime.tsx +3 -1
package/README.md
CHANGED
|
@@ -938,6 +938,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
938
938
|
| onCopyButtonClick | `() => void` | - | Колбек клика по кнопке Копировать для поля |
|
|
939
939
|
| showSeconds | `boolean` | true | Показывать ли секунды |
|
|
940
940
|
| showClearButton | `boolean` | true | Отображение кнопки Очистки поля |
|
|
941
|
+
| footerMode | enum TimePickerFooterMode: `"current-and-apply"`, `"apply-only"` | current-and-apply | Режим футера: кнопка «Текущее время» и компактная «Применить», либо одна широкая «Применить» с подписью. |
|
|
941
942
|
| id | `string` | - | Значение html-атрибута id |
|
|
942
943
|
| name | `string` | - | Значение html-атрибута name |
|
|
943
944
|
| disabled | `boolean` | - | Является ли поле деактивированным |
|
|
@@ -962,8 +963,8 @@ FieldStepper в основном предназначен для работы с
|
|
|
962
963
|
### Props
|
|
963
964
|
| name | type | default value | description |
|
|
964
965
|
|------|------|---------------|-------------|
|
|
965
|
-
| __@metadata@
|
|
966
|
-
| __@hasInstance@
|
|
966
|
+
| __@metadata@2033* | `DecoratorMetadataObject` | - | |
|
|
967
|
+
| __@hasInstance@2031* | `(value: any) => boolean` | - | Determines whether the given value inherits from this function if this function was used as a constructor function. A constructor function can control which objects are recognized as its instances by 'instanceof' by overriding this method. |
|
|
967
968
|
| name* | `string` | - | Returns the name of the function. Function names are read-only and can not be changed. |
|
|
968
969
|
| caller* | `Function` | - | |
|
|
969
970
|
| arguments* | `any` | - | |
|
|
@@ -24,9 +24,29 @@ type FieldTimeOwnProps = {
|
|
|
24
24
|
* @default true
|
|
25
25
|
*/
|
|
26
26
|
showClearButton?: boolean;
|
|
27
|
-
}
|
|
27
|
+
} & Pick<TimePickerProps, 'footerMode'>;
|
|
28
28
|
export type FieldTimeProps = WithSupportProps<FieldTimeOwnProps & InputProps & WrapperProps>;
|
|
29
29
|
export declare const FieldTime: import("react").ForwardRefExoticComponent<{
|
|
30
30
|
'data-test-id'?: string;
|
|
31
|
-
} & import("react").AriaAttributes &
|
|
31
|
+
} & import("react").AriaAttributes & {
|
|
32
|
+
/** Открыт time-picker */
|
|
33
|
+
open?: boolean;
|
|
34
|
+
/** Колбек открытия пикера */
|
|
35
|
+
onOpenChange?(value: boolean): void;
|
|
36
|
+
/** Значение поля */
|
|
37
|
+
value?: TimePickerProps["value"];
|
|
38
|
+
/** Колбек смены значения */
|
|
39
|
+
onChange?: TimePickerProps["onChangeValue"];
|
|
40
|
+
/** Отображение кнопки копирования */
|
|
41
|
+
showCopyButton?: boolean;
|
|
42
|
+
/** Колбек клика по кнопке Копировать для поля */
|
|
43
|
+
onCopyButtonClick?(): void;
|
|
44
|
+
/** Показывать ли секунды */
|
|
45
|
+
showSeconds?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Отображение кнопки Очистки поля
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
showClearButton?: boolean;
|
|
51
|
+
} & Pick<TimePickerProps, "footerMode"> & InputProps & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
32
52
|
export {};
|
|
@@ -78,9 +78,10 @@ exports.FieldTime = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
78
78
|
validationState = constants_1.VALIDATION_STATE.Default,
|
|
79
79
|
error,
|
|
80
80
|
onCopyButtonClick,
|
|
81
|
-
autoFocus
|
|
81
|
+
autoFocus,
|
|
82
|
+
footerMode
|
|
82
83
|
} = _a,
|
|
83
|
-
rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "showSeconds", "size", "validationState", "error", "onCopyButtonClick", "autoFocus"]);
|
|
84
|
+
rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "showSeconds", "size", "validationState", "error", "onCopyButtonClick", "autoFocus", "footerMode"]);
|
|
84
85
|
const [isOpen, setIsOpen] = (0, uncontrollable_1.useUncontrolledProp)(open, false, onOpenChange);
|
|
85
86
|
const localRef = (0, react_1.useRef)(null);
|
|
86
87
|
const clearButtonRef = (0, react_1.useRef)(null);
|
|
@@ -264,7 +265,8 @@ exports.FieldTime = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
264
265
|
onFocusLeave: handleCalendarFocusLeave,
|
|
265
266
|
"data-test-id": 'field-time__timepicker',
|
|
266
267
|
fitToContainer: false,
|
|
267
|
-
showSeconds: showSeconds
|
|
268
|
+
showSeconds: showSeconds,
|
|
269
|
+
footerMode: footerMode
|
|
268
270
|
}),
|
|
269
271
|
children: (0, jsx_runtime_1.jsx)(helperComponents_1.FieldContainerPrivate, {
|
|
270
272
|
className: styles_module_scss_1.default.container,
|
|
@@ -24,9 +24,29 @@ type FieldTimeOwnProps = {
|
|
|
24
24
|
* @default true
|
|
25
25
|
*/
|
|
26
26
|
showClearButton?: boolean;
|
|
27
|
-
}
|
|
27
|
+
} & Pick<TimePickerProps, 'footerMode'>;
|
|
28
28
|
export type FieldTimeProps = WithSupportProps<FieldTimeOwnProps & InputProps & WrapperProps>;
|
|
29
29
|
export declare const FieldTime: import("react").ForwardRefExoticComponent<{
|
|
30
30
|
'data-test-id'?: string;
|
|
31
|
-
} & import("react").AriaAttributes &
|
|
31
|
+
} & import("react").AriaAttributes & {
|
|
32
|
+
/** Открыт time-picker */
|
|
33
|
+
open?: boolean;
|
|
34
|
+
/** Колбек открытия пикера */
|
|
35
|
+
onOpenChange?(value: boolean): void;
|
|
36
|
+
/** Значение поля */
|
|
37
|
+
value?: TimePickerProps["value"];
|
|
38
|
+
/** Колбек смены значения */
|
|
39
|
+
onChange?: TimePickerProps["onChangeValue"];
|
|
40
|
+
/** Отображение кнопки копирования */
|
|
41
|
+
showCopyButton?: boolean;
|
|
42
|
+
/** Колбек клика по кнопке Копировать для поля */
|
|
43
|
+
onCopyButtonClick?(): void;
|
|
44
|
+
/** Показывать ли секунды */
|
|
45
|
+
showSeconds?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Отображение кнопки Очистки поля
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
showClearButton?: boolean;
|
|
51
|
+
} & Pick<TimePickerProps, "footerMode"> & InputProps & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
32
52
|
export {};
|
|
@@ -40,7 +40,7 @@ const getStringTimeValue = (time, { showSeconds, locale }) => {
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
export const FieldTime = forwardRef((_a, ref) => {
|
|
43
|
-
var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onOpenChange, onChange, onFocus, onBlur: onBlurProp, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, showSeconds = true, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, onCopyButtonClick, autoFocus } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "showSeconds", "size", "validationState", "error", "onCopyButtonClick", "autoFocus"]);
|
|
43
|
+
var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onOpenChange, onChange, onFocus, onBlur: onBlurProp, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, showSeconds = true, size = SIZE.S, validationState = VALIDATION_STATE.Default, error, onCopyButtonClick, autoFocus, footerMode } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "showSeconds", "size", "validationState", "error", "onCopyButtonClick", "autoFocus", "footerMode"]);
|
|
44
44
|
const [isOpen, setIsOpen] = useUncontrolledProp(open, false, onOpenChange);
|
|
45
45
|
const localRef = useRef(null);
|
|
46
46
|
const clearButtonRef = useRef(null);
|
|
@@ -157,5 +157,5 @@ export const FieldTime = forwardRef((_a, ref) => {
|
|
|
157
157
|
: {
|
|
158
158
|
open: showDropList,
|
|
159
159
|
onOpenChange: setIsOpen,
|
|
160
|
-
}), { content: _jsx(TimePicker, { size: size, value: valueProp, onChangeValue: handleSelectTime, navigationStartRef: navigationStartRef, onFocusLeave: handleCalendarFocusLeave, "data-test-id": 'field-time__timepicker', fitToContainer: false, showSeconds: showSeconds }), children: _jsx(FieldContainerPrivate, { className: styles.container, size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, focused: showDropList, inputRef: localRef, postfix: postfixButtons, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value || '', placeholder: mask, onChange: handleChange, onFocus: inputHandlers.onFocus, onMouseDown: inputHandlers.onMouseDown, onBlur: onBlur, onKeyDown: handleInputKeyDown, onClick: onClick, disabled: disabled, readonly: readonly, tabIndex: inputTabIndex, type: 'text', inputMode: 'numeric', id: id, name: name, autoFocus: autoFocus, "data-test-id": 'field-time__input' }) }) })) })));
|
|
160
|
+
}), { content: _jsx(TimePicker, { size: size, value: valueProp, onChangeValue: handleSelectTime, navigationStartRef: navigationStartRef, onFocusLeave: handleCalendarFocusLeave, "data-test-id": 'field-time__timepicker', fitToContainer: false, showSeconds: showSeconds, footerMode: footerMode }), children: _jsx(FieldContainerPrivate, { className: styles.container, size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, focused: showDropList, inputRef: localRef, postfix: postfixButtons, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value || '', placeholder: mask, onChange: handleChange, onFocus: inputHandlers.onFocus, onMouseDown: inputHandlers.onMouseDown, onBlur: onBlur, onKeyDown: handleInputKeyDown, onClick: onClick, disabled: disabled, readonly: readonly, tabIndex: inputTabIndex, type: 'text', inputMode: 'numeric', id: id, name: name, autoFocus: autoFocus, "data-test-id": 'field-time__input' }) }) })) })));
|
|
161
161
|
});
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Fields",
|
|
7
|
-
"version": "0.55.0",
|
|
7
|
+
"version": "0.55.1-preview-ff470bb3.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@snack-uikit/button": "0.19.17",
|
|
40
|
-
"@snack-uikit/calendar": "0.13.
|
|
40
|
+
"@snack-uikit/calendar": "0.13.20-preview-ff470bb3.0",
|
|
41
41
|
"@snack-uikit/color-picker": "0.3.55",
|
|
42
42
|
"@snack-uikit/divider": "3.2.11",
|
|
43
43
|
"@snack-uikit/dropdown": "0.5.5",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@snack-uikit/locale": "*"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "9cb3640f627845ea5054cf3a16998c30419f1691"
|
|
70
70
|
}
|
|
@@ -61,7 +61,7 @@ type FieldTimeOwnProps = {
|
|
|
61
61
|
* @default true
|
|
62
62
|
*/
|
|
63
63
|
showClearButton?: boolean;
|
|
64
|
-
}
|
|
64
|
+
} & Pick<TimePickerProps, 'footerMode'>;
|
|
65
65
|
|
|
66
66
|
export type FieldTimeProps = WithSupportProps<FieldTimeOwnProps & InputProps & WrapperProps>;
|
|
67
67
|
|
|
@@ -114,6 +114,7 @@ export const FieldTime = forwardRef<HTMLInputElement, FieldTimeProps>(
|
|
|
114
114
|
error,
|
|
115
115
|
onCopyButtonClick,
|
|
116
116
|
autoFocus,
|
|
117
|
+
footerMode,
|
|
117
118
|
...rest
|
|
118
119
|
},
|
|
119
120
|
ref,
|
|
@@ -313,6 +314,7 @@ export const FieldTime = forwardRef<HTMLInputElement, FieldTimeProps>(
|
|
|
313
314
|
data-test-id='field-time__timepicker'
|
|
314
315
|
fitToContainer={false}
|
|
315
316
|
showSeconds={showSeconds}
|
|
317
|
+
footerMode={footerMode}
|
|
316
318
|
/>
|
|
317
319
|
}
|
|
318
320
|
>
|