@snack-uikit/calendar 0.13.20-preview-ff470bb3.0 → 0.13.20
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 +12 -0
- package/README.md +0 -1
- package/dist/cjs/components/TimePicker/TimePicker.d.ts +2 -7
- package/dist/cjs/components/TimePicker/TimePicker.js +1 -3
- package/dist/cjs/helperComponents/CalendarContext/CalendarContext.d.ts +1 -3
- package/dist/cjs/helperComponents/Footer/Footer.js +3 -6
- package/dist/cjs/helperComponents/Footer/styles.module.css +3 -7
- package/dist/cjs/types.d.ts +0 -6
- package/dist/esm/components/TimePicker/TimePicker.d.ts +2 -7
- package/dist/esm/components/TimePicker/TimePicker.js +1 -2
- package/dist/esm/helperComponents/CalendarContext/CalendarContext.d.ts +1 -3
- package/dist/esm/helperComponents/Footer/Footer.js +3 -3
- package/dist/esm/helperComponents/Footer/styles.module.css +3 -7
- package/dist/esm/types.d.ts +0 -6
- package/package.json +6 -6
- package/src/components/TimePicker/TimePicker.tsx +1 -8
- package/src/helperComponents/CalendarContext/CalendarContext.tsx +0 -3
- package/src/helperComponents/Footer/Footer.tsx +2 -6
- package/src/helperComponents/Footer/styles.module.scss +0 -6
- package/src/types.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.13.20 (2026-05-18)
|
|
7
|
+
|
|
8
|
+
### Only dependencies have been changed
|
|
9
|
+
* [@snack-uikit/button@0.19.18]($PUBLIC_PROJECT_URL/blob/master/packages/button/CHANGELOG.md)
|
|
10
|
+
* [@snack-uikit/divider@3.2.12]($PUBLIC_PROJECT_URL/blob/master/packages/divider/CHANGELOG.md)
|
|
11
|
+
* [@snack-uikit/list@0.33.1]($PUBLIC_PROJECT_URL/blob/master/packages/list/CHANGELOG.md)
|
|
12
|
+
* [@snack-uikit/utils@4.0.2]($PUBLIC_PROJECT_URL/blob/master/packages/utils/CHANGELOG.md)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
## 0.13.19 (2026-04-21)
|
|
7
19
|
|
|
8
20
|
### Only dependencies have been changed
|
package/README.md
CHANGED
|
@@ -128,7 +128,6 @@ function TimePickerExample() {
|
|
|
128
128
|
| defaultValue | `TimeValue` | - | Значение по-умолчанию для uncontrolled. |
|
|
129
129
|
| onChangeValue | `(value?: TimeValue) => void` | - | Колбек выбора значения |
|
|
130
130
|
| showSeconds | `boolean` | true | Показывать ли секунды |
|
|
131
|
-
| footerMode | enum TimePickerFooterMode: `"current-time-and-apply"`, `"apply-only"` | current-time-and-apply | Режим футера: выбор текущего времени (кнопка «Текущее») и компактная «Применить», либо одна широкая «Применить» с подписью. |
|
|
132
131
|
| size | enum Size: `"s"`, `"m"`, `"l"` | m | Размер |
|
|
133
132
|
| className | `string` | - | CSS-класс контейнера |
|
|
134
133
|
| fitToContainer | `boolean` | true | Отключает предустановленный размер, заставляя компонент подстраиваться к размеру контейнра: (width: 100%, height: 100%). |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
3
|
-
import { FocusDirection, Size,
|
|
3
|
+
import { FocusDirection, Size, TimeValue } from '../../types';
|
|
4
4
|
export type TimePickerProps = WithSupportProps<{
|
|
5
5
|
/** Выбранное значение.*/
|
|
6
6
|
value?: TimeValue;
|
|
@@ -12,11 +12,6 @@ export type TimePickerProps = WithSupportProps<{
|
|
|
12
12
|
onChangeValue?(value?: TimeValue): void;
|
|
13
13
|
/** Показывать ли секунды */
|
|
14
14
|
showSeconds?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Режим футера: выбор текущего времени (кнопка «Текущее») и компактная «Применить», либо одна широкая «Применить» с подписью.
|
|
17
|
-
* @default current-time-and-apply
|
|
18
|
-
*/
|
|
19
|
-
footerMode?: TimePickerFooterMode;
|
|
20
15
|
/**
|
|
21
16
|
* Размер
|
|
22
17
|
* @default m
|
|
@@ -36,4 +31,4 @@ export type TimePickerProps = WithSupportProps<{
|
|
|
36
31
|
focus(): void;
|
|
37
32
|
}>;
|
|
38
33
|
}>;
|
|
39
|
-
export declare function TimePicker({ className, size, fitToContainer, value: valueProp, defaultValue, onChangeValue, onFocusLeave, 'data-test-id': testId, navigationStartRef, showSeconds, today: todayProp,
|
|
34
|
+
export declare function TimePicker({ className, size, fitToContainer, value: valueProp, defaultValue, onChangeValue, onFocusLeave, 'data-test-id': testId, navigationStartRef, showSeconds, today: todayProp, }: TimePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -36,8 +36,7 @@ function TimePicker(_ref) {
|
|
|
36
36
|
'data-test-id': testId,
|
|
37
37
|
navigationStartRef,
|
|
38
38
|
showSeconds = true,
|
|
39
|
-
today: todayProp
|
|
40
|
-
footerMode = 'current-time-and-apply'
|
|
39
|
+
today: todayProp
|
|
41
40
|
} = _ref;
|
|
42
41
|
const [value, setValueState] = (0, uncontrollable_1.useUncontrolledProp)(valueProp, defaultValue, onChangeValue);
|
|
43
42
|
const setValueEventHandler = (0, utils_1.useEventHandler)(setValueState);
|
|
@@ -111,7 +110,6 @@ function TimePicker(_ref) {
|
|
|
111
110
|
onFocusLeave,
|
|
112
111
|
navigationStartRef,
|
|
113
112
|
showSeconds,
|
|
114
|
-
footerMode,
|
|
115
113
|
dateAndTime,
|
|
116
114
|
onTimeChange,
|
|
117
115
|
onDateAndTimeChange,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MutableRefObject, RefObject } from 'react';
|
|
2
2
|
import { ListProps } from '@snack-uikit/list';
|
|
3
|
-
import { BuildCellPropsFunction, CalendarMode, DateAndTime, FocusDirection, Range, Size,
|
|
3
|
+
import { BuildCellPropsFunction, CalendarMode, DateAndTime, FocusDirection, Range, Size, TimeValue, ViewMode } from '../../types';
|
|
4
4
|
export type CalendarContextType = {
|
|
5
5
|
size: Size;
|
|
6
6
|
/** Дата текущего дня */
|
|
@@ -21,8 +21,6 @@ export type CalendarContextType = {
|
|
|
21
21
|
viewShift: number;
|
|
22
22
|
focus?: string;
|
|
23
23
|
locale: Intl.Locale;
|
|
24
|
-
/** Режим футера time-picker */
|
|
25
|
-
footerMode?: TimePickerFooterMode;
|
|
26
24
|
onFocusLeave?(direction: FocusDirection): void;
|
|
27
25
|
buildCellProps?: BuildCellPropsFunction;
|
|
28
26
|
setFocus(address: string | undefined): void;
|
|
@@ -13,6 +13,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
13
13
|
const react_1 = require("react");
|
|
14
14
|
const button_1 = require("@snack-uikit/button");
|
|
15
15
|
const divider_1 = require("@snack-uikit/divider");
|
|
16
|
+
const icons_1 = require("@snack-uikit/icons");
|
|
16
17
|
const list_1 = require("@snack-uikit/list");
|
|
17
18
|
const locale_1 = require("@snack-uikit/locale");
|
|
18
19
|
const constants_1 = require("../../constants");
|
|
@@ -39,10 +40,8 @@ function Footer() {
|
|
|
39
40
|
getTestId,
|
|
40
41
|
referenceDate,
|
|
41
42
|
setViewShift,
|
|
42
|
-
onFocusLeave
|
|
43
|
-
footerMode = 'current-time-and-apply'
|
|
43
|
+
onFocusLeave
|
|
44
44
|
} = (0, react_1.useContext)(CalendarContext_1.CalendarContext);
|
|
45
|
-
const isApplyOnlyFooter = footerMode === 'apply-only';
|
|
46
45
|
const {
|
|
47
46
|
t
|
|
48
47
|
} = (0, locale_1.useLocale)('Calendar');
|
|
@@ -107,8 +106,6 @@ function Footer() {
|
|
|
107
106
|
className: styles_module_scss_1.default.currentWrapper,
|
|
108
107
|
"data-size": size,
|
|
109
108
|
children: [(0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
|
|
110
|
-
className: styles_module_scss_1.default.currentButton,
|
|
111
|
-
"data-hidden": isApplyOnlyFooter,
|
|
112
109
|
label: t('current'),
|
|
113
110
|
size: size === 's' ? 'xs' : 's',
|
|
114
111
|
onClick: handleCurrentClick,
|
|
@@ -116,7 +113,7 @@ function Footer() {
|
|
|
116
113
|
onKeyDown: handleCurrentKeyDown,
|
|
117
114
|
"data-test-id": getTestId('current-button')
|
|
118
115
|
}), (0, jsx_runtime_1.jsx)(button_1.ButtonFilled, {
|
|
119
|
-
|
|
116
|
+
icon: (0, jsx_runtime_1.jsx)(icons_1.CheckSVG, {}),
|
|
120
117
|
size: size === 's' ? 'xs' : 's',
|
|
121
118
|
disabled: isApplyButtonDisabled,
|
|
122
119
|
onClick: handleApplySelection,
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
padding-left:var(--space-drop-list-item-s-container-horizontal-padding, 8px);
|
|
30
30
|
padding-right:var(--space-drop-list-item-s-container-horizontal-padding, 8px);
|
|
31
31
|
gap:var(--space-drop-list-item-s-container-gap, 8px);
|
|
32
|
-
gap:var(--
|
|
32
|
+
gap:var(--space-calendar-footer-elements-s, 8px);
|
|
33
33
|
}
|
|
34
34
|
.currentWrapper[data-size=m]{
|
|
35
35
|
padding-top:var(--space-drop-list-item-m-container-vertical-padding, 8px);
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
padding-left:var(--space-drop-list-item-m-container-horizontal-padding, 10px);
|
|
38
38
|
padding-right:var(--space-drop-list-item-m-container-horizontal-padding, 10px);
|
|
39
39
|
gap:var(--space-drop-list-item-m-container-gap, 8px);
|
|
40
|
-
gap:var(--
|
|
40
|
+
gap:var(--space-calendar-footer-elements-m, 8px);
|
|
41
41
|
}
|
|
42
42
|
.currentWrapper[data-size=l]{
|
|
43
43
|
padding-top:var(--space-drop-list-item-l-container-vertical-padding, 12px);
|
|
@@ -45,9 +45,5 @@
|
|
|
45
45
|
padding-left:var(--space-drop-list-item-l-container-horizontal-padding, 12px);
|
|
46
46
|
padding-right:var(--space-drop-list-item-l-container-horizontal-padding, 12px);
|
|
47
47
|
gap:var(--space-drop-list-item-l-container-gap, 8px);
|
|
48
|
-
gap:var(--
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.currentButton[data-hidden=true]{
|
|
52
|
-
visibility:hidden;
|
|
48
|
+
gap:var(--space-calendar-footer-elements-l, 8px);
|
|
53
49
|
}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -38,12 +38,6 @@ export type TimeValue = {
|
|
|
38
38
|
minutes?: number;
|
|
39
39
|
seconds?: number;
|
|
40
40
|
};
|
|
41
|
-
/**
|
|
42
|
-
* Режим футера time-picker:
|
|
43
|
-
* - `current-time-and-apply` — кнопка выбора текущего времени и компактная «Применить»;
|
|
44
|
-
* - `apply-only` — одна широкая «Применить» с подписью.
|
|
45
|
-
*/
|
|
46
|
-
export type TimePickerFooterMode = 'current-time-and-apply' | 'apply-only';
|
|
47
41
|
export type DateAndTime = TimeValue & {
|
|
48
42
|
year?: number;
|
|
49
43
|
month?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
3
|
-
import { FocusDirection, Size,
|
|
3
|
+
import { FocusDirection, Size, TimeValue } from '../../types';
|
|
4
4
|
export type TimePickerProps = WithSupportProps<{
|
|
5
5
|
/** Выбранное значение.*/
|
|
6
6
|
value?: TimeValue;
|
|
@@ -12,11 +12,6 @@ export type TimePickerProps = WithSupportProps<{
|
|
|
12
12
|
onChangeValue?(value?: TimeValue): void;
|
|
13
13
|
/** Показывать ли секунды */
|
|
14
14
|
showSeconds?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Режим футера: выбор текущего времени (кнопка «Текущее») и компактная «Применить», либо одна широкая «Применить» с подписью.
|
|
17
|
-
* @default current-time-and-apply
|
|
18
|
-
*/
|
|
19
|
-
footerMode?: TimePickerFooterMode;
|
|
20
15
|
/**
|
|
21
16
|
* Размер
|
|
22
17
|
* @default m
|
|
@@ -36,4 +31,4 @@ export type TimePickerProps = WithSupportProps<{
|
|
|
36
31
|
focus(): void;
|
|
37
32
|
}>;
|
|
38
33
|
}>;
|
|
39
|
-
export declare function TimePicker({ className, size, fitToContainer, value: valueProp, defaultValue, onChangeValue, onFocusLeave, 'data-test-id': testId, navigationStartRef, showSeconds, today: todayProp,
|
|
34
|
+
export declare function TimePicker({ className, size, fitToContainer, value: valueProp, defaultValue, onChangeValue, onFocusLeave, 'data-test-id': testId, navigationStartRef, showSeconds, today: todayProp, }: TimePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,7 @@ import { getLocale, getTestIdBuilder } from '../../utils';
|
|
|
13
13
|
import styles from './styles.module.css';
|
|
14
14
|
const stubDate = new Date();
|
|
15
15
|
const stubFunc = () => { };
|
|
16
|
-
export function TimePicker({ className, size = SIZE.M, fitToContainer = true, value: valueProp, defaultValue, onChangeValue, onFocusLeave, 'data-test-id': testId, navigationStartRef, showSeconds = true, today: todayProp,
|
|
16
|
+
export function TimePicker({ className, size = SIZE.M, fitToContainer = true, value: valueProp, defaultValue, onChangeValue, onFocusLeave, 'data-test-id': testId, navigationStartRef, showSeconds = true, today: todayProp, }) {
|
|
17
17
|
const [value, setValueState] = useUncontrolledProp(valueProp, defaultValue, onChangeValue);
|
|
18
18
|
const setValueEventHandler = useEventHandler(setValueState);
|
|
19
19
|
const [internalValue, setInternalValue] = useState();
|
|
@@ -55,7 +55,6 @@ export function TimePicker({ className, size = SIZE.M, fitToContainer = true, va
|
|
|
55
55
|
onFocusLeave,
|
|
56
56
|
navigationStartRef,
|
|
57
57
|
showSeconds,
|
|
58
|
-
footerMode,
|
|
59
58
|
dateAndTime,
|
|
60
59
|
onTimeChange,
|
|
61
60
|
onDateAndTimeChange,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MutableRefObject, RefObject } from 'react';
|
|
2
2
|
import { ListProps } from '@snack-uikit/list';
|
|
3
|
-
import { BuildCellPropsFunction, CalendarMode, DateAndTime, FocusDirection, Range, Size,
|
|
3
|
+
import { BuildCellPropsFunction, CalendarMode, DateAndTime, FocusDirection, Range, Size, TimeValue, ViewMode } from '../../types';
|
|
4
4
|
export type CalendarContextType = {
|
|
5
5
|
size: Size;
|
|
6
6
|
/** Дата текущего дня */
|
|
@@ -21,8 +21,6 @@ export type CalendarContextType = {
|
|
|
21
21
|
viewShift: number;
|
|
22
22
|
focus?: string;
|
|
23
23
|
locale: Intl.Locale;
|
|
24
|
-
/** Режим футера time-picker */
|
|
25
|
-
footerMode?: TimePickerFooterMode;
|
|
26
24
|
onFocusLeave?(direction: FocusDirection): void;
|
|
27
25
|
buildCellProps?: BuildCellPropsFunction;
|
|
28
26
|
setFocus(address: string | undefined): void;
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { ButtonFilled, ButtonFunction } from '@snack-uikit/button';
|
|
4
4
|
import { Divider } from '@snack-uikit/divider';
|
|
5
|
+
import { CheckSVG } from '@snack-uikit/icons';
|
|
5
6
|
import { getDefaultItemId } from '@snack-uikit/list';
|
|
6
7
|
import { useLocale } from '@snack-uikit/locale';
|
|
7
8
|
import { CALENDAR_MODE } from '../../constants';
|
|
@@ -9,8 +10,7 @@ import { getMonthShift } from '../../utils';
|
|
|
9
10
|
import { CalendarContext } from '../CalendarContext';
|
|
10
11
|
import styles from './styles.module.css';
|
|
11
12
|
export function Footer() {
|
|
12
|
-
const { size, viewMode, mode, today, setValue, dateAndTime, isTimeFilled, isDateAndTimeFilled, onDateAndTimeChange, applyButtonRef, currentButtonRef, hoursKeyboardNavigationRef, minutesKeyboardNavigationRef, secondsKeyboardNavigationRef, showSeconds, getTestId, referenceDate, setViewShift, onFocusLeave,
|
|
13
|
-
const isApplyOnlyFooter = footerMode === 'apply-only';
|
|
13
|
+
const { size, viewMode, mode, today, setValue, dateAndTime, isTimeFilled, isDateAndTimeFilled, onDateAndTimeChange, applyButtonRef, currentButtonRef, hoursKeyboardNavigationRef, minutesKeyboardNavigationRef, secondsKeyboardNavigationRef, showSeconds, getTestId, referenceDate, setViewShift, onFocusLeave, } = useContext(CalendarContext);
|
|
14
14
|
const { t } = useLocale('Calendar');
|
|
15
15
|
if (![CALENDAR_MODE.DateTime, 'time'].includes(mode) || viewMode !== 'month') {
|
|
16
16
|
return null;
|
|
@@ -59,5 +59,5 @@ export function Footer() {
|
|
|
59
59
|
const newDate = new Date(year, month, day, hours, minutes, showSeconds ? seconds : 0);
|
|
60
60
|
setValue([newDate, newDate]);
|
|
61
61
|
};
|
|
62
|
-
return (_jsxs("div", { className: styles.footer, "data-size": size, children: [_jsx(Divider, { className: styles.divider }), _jsxs("div", { className: styles.currentWrapper, "data-size": size, children: [_jsx(ButtonFunction, {
|
|
62
|
+
return (_jsxs("div", { className: styles.footer, "data-size": size, children: [_jsx(Divider, { className: styles.divider }), _jsxs("div", { className: styles.currentWrapper, "data-size": size, children: [_jsx(ButtonFunction, { label: t('current'), size: size === 's' ? 'xs' : 's', onClick: handleCurrentClick, ref: currentButtonRef, onKeyDown: handleCurrentKeyDown, "data-test-id": getTestId('current-button') }), _jsx(ButtonFilled, { icon: _jsx(CheckSVG, {}), size: size === 's' ? 'xs' : 's', disabled: isApplyButtonDisabled, onClick: handleApplySelection, ref: applyButtonRef, onKeyDown: handleApplyKeyDown, "data-test-id": getTestId('apply-button') })] })] }));
|
|
63
63
|
}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
padding-left:var(--space-drop-list-item-s-container-horizontal-padding, 8px);
|
|
30
30
|
padding-right:var(--space-drop-list-item-s-container-horizontal-padding, 8px);
|
|
31
31
|
gap:var(--space-drop-list-item-s-container-gap, 8px);
|
|
32
|
-
gap:var(--
|
|
32
|
+
gap:var(--space-calendar-footer-elements-s, 8px);
|
|
33
33
|
}
|
|
34
34
|
.currentWrapper[data-size=m]{
|
|
35
35
|
padding-top:var(--space-drop-list-item-m-container-vertical-padding, 8px);
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
padding-left:var(--space-drop-list-item-m-container-horizontal-padding, 10px);
|
|
38
38
|
padding-right:var(--space-drop-list-item-m-container-horizontal-padding, 10px);
|
|
39
39
|
gap:var(--space-drop-list-item-m-container-gap, 8px);
|
|
40
|
-
gap:var(--
|
|
40
|
+
gap:var(--space-calendar-footer-elements-m, 8px);
|
|
41
41
|
}
|
|
42
42
|
.currentWrapper[data-size=l]{
|
|
43
43
|
padding-top:var(--space-drop-list-item-l-container-vertical-padding, 12px);
|
|
@@ -45,9 +45,5 @@
|
|
|
45
45
|
padding-left:var(--space-drop-list-item-l-container-horizontal-padding, 12px);
|
|
46
46
|
padding-right:var(--space-drop-list-item-l-container-horizontal-padding, 12px);
|
|
47
47
|
gap:var(--space-drop-list-item-l-container-gap, 8px);
|
|
48
|
-
gap:var(--
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.currentButton[data-hidden=true]{
|
|
52
|
-
visibility:hidden;
|
|
48
|
+
gap:var(--space-calendar-footer-elements-l, 8px);
|
|
53
49
|
}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -38,12 +38,6 @@ export type TimeValue = {
|
|
|
38
38
|
minutes?: number;
|
|
39
39
|
seconds?: number;
|
|
40
40
|
};
|
|
41
|
-
/**
|
|
42
|
-
* Режим футера time-picker:
|
|
43
|
-
* - `current-time-and-apply` — кнопка выбора текущего времени и компактная «Применить»;
|
|
44
|
-
* - `apply-only` — одна широкая «Применить» с подписью.
|
|
45
|
-
*/
|
|
46
|
-
export type TimePickerFooterMode = 'current-time-and-apply' | 'apply-only';
|
|
47
41
|
export type DateAndTime = TimeValue & {
|
|
48
42
|
year?: number;
|
|
49
43
|
month?: number;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Calendar",
|
|
7
|
-
"version": "0.13.20
|
|
7
|
+
"version": "0.13.20",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@snack-uikit/button": "0.19.
|
|
40
|
-
"@snack-uikit/divider": "3.2.
|
|
39
|
+
"@snack-uikit/button": "0.19.18",
|
|
40
|
+
"@snack-uikit/divider": "3.2.12",
|
|
41
41
|
"@snack-uikit/icons": "0.27.7",
|
|
42
|
-
"@snack-uikit/list": "0.33.
|
|
43
|
-
"@snack-uikit/utils": "4.0.
|
|
42
|
+
"@snack-uikit/list": "0.33.1",
|
|
43
|
+
"@snack-uikit/utils": "4.0.2",
|
|
44
44
|
"classnames": "2.5.1",
|
|
45
45
|
"uncontrollable": "8.0.4",
|
|
46
46
|
"weekstart": "2.0.0"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@snack-uikit/locale": "*"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a9f6571146845d828e00206abdedb160980cff97"
|
|
52
52
|
}
|
|
@@ -11,7 +11,7 @@ import { CalendarContext } from '../../helperComponents/CalendarContext';
|
|
|
11
11
|
import { Footer } from '../../helperComponents/Footer';
|
|
12
12
|
import { TimePickerBase } from '../../helperComponents/TimePickerBase';
|
|
13
13
|
import { useDateAndTime } from '../../hooks';
|
|
14
|
-
import { FocusDirection, Range, Size,
|
|
14
|
+
import { FocusDirection, Range, Size, TimeValue } from '../../types';
|
|
15
15
|
import { getLocale, getTestIdBuilder } from '../../utils';
|
|
16
16
|
import styles from './styles.module.scss';
|
|
17
17
|
|
|
@@ -29,11 +29,6 @@ export type TimePickerProps = WithSupportProps<{
|
|
|
29
29
|
onChangeValue?(value?: TimeValue): void;
|
|
30
30
|
/** Показывать ли секунды */
|
|
31
31
|
showSeconds?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Режим футера: выбор текущего времени (кнопка «Текущее») и компактная «Применить», либо одна широкая «Применить» с подписью.
|
|
34
|
-
* @default current-time-and-apply
|
|
35
|
-
*/
|
|
36
|
-
footerMode?: TimePickerFooterMode;
|
|
37
32
|
|
|
38
33
|
/**
|
|
39
34
|
* Размер
|
|
@@ -66,7 +61,6 @@ export function TimePicker({
|
|
|
66
61
|
navigationStartRef,
|
|
67
62
|
showSeconds = true,
|
|
68
63
|
today: todayProp,
|
|
69
|
-
footerMode = 'current-time-and-apply',
|
|
70
64
|
}: TimePickerProps) {
|
|
71
65
|
const [value, setValueState] = useUncontrolledProp<TimeValue | undefined>(valueProp, defaultValue, onChangeValue);
|
|
72
66
|
const setValueEventHandler = useEventHandler(setValueState);
|
|
@@ -133,7 +127,6 @@ export function TimePicker({
|
|
|
133
127
|
onFocusLeave,
|
|
134
128
|
navigationStartRef,
|
|
135
129
|
showSeconds,
|
|
136
|
-
footerMode,
|
|
137
130
|
dateAndTime,
|
|
138
131
|
onTimeChange,
|
|
139
132
|
onDateAndTimeChange,
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
FocusDirection,
|
|
11
11
|
Range,
|
|
12
12
|
Size,
|
|
13
|
-
TimePickerFooterMode,
|
|
14
13
|
TimeValue,
|
|
15
14
|
ViewMode,
|
|
16
15
|
} from '../../types';
|
|
@@ -36,8 +35,6 @@ export type CalendarContextType = {
|
|
|
36
35
|
viewShift: number;
|
|
37
36
|
focus?: string;
|
|
38
37
|
locale: Intl.Locale;
|
|
39
|
-
/** Режим футера time-picker */
|
|
40
|
-
footerMode?: TimePickerFooterMode;
|
|
41
38
|
onFocusLeave?(direction: FocusDirection): void;
|
|
42
39
|
buildCellProps?: BuildCellPropsFunction;
|
|
43
40
|
setFocus(address: string | undefined): void;
|
|
@@ -2,6 +2,7 @@ import { KeyboardEventHandler, useContext } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { ButtonFilled, ButtonFunction } from '@snack-uikit/button';
|
|
4
4
|
import { Divider } from '@snack-uikit/divider';
|
|
5
|
+
import { CheckSVG } from '@snack-uikit/icons';
|
|
5
6
|
import { getDefaultItemId } from '@snack-uikit/list';
|
|
6
7
|
import { useLocale } from '@snack-uikit/locale';
|
|
7
8
|
|
|
@@ -31,11 +32,8 @@ export function Footer() {
|
|
|
31
32
|
referenceDate,
|
|
32
33
|
setViewShift,
|
|
33
34
|
onFocusLeave,
|
|
34
|
-
footerMode = 'current-time-and-apply',
|
|
35
35
|
} = useContext(CalendarContext);
|
|
36
36
|
|
|
37
|
-
const isApplyOnlyFooter = footerMode === 'apply-only';
|
|
38
|
-
|
|
39
37
|
const { t } = useLocale('Calendar');
|
|
40
38
|
|
|
41
39
|
if (![CALENDAR_MODE.DateTime, 'time'].includes(mode) || viewMode !== 'month') {
|
|
@@ -108,8 +106,6 @@ export function Footer() {
|
|
|
108
106
|
|
|
109
107
|
<div className={styles.currentWrapper} data-size={size}>
|
|
110
108
|
<ButtonFunction
|
|
111
|
-
className={styles.currentButton}
|
|
112
|
-
data-hidden={isApplyOnlyFooter}
|
|
113
109
|
label={t('current')}
|
|
114
110
|
size={size === 's' ? 'xs' : 's'}
|
|
115
111
|
onClick={handleCurrentClick}
|
|
@@ -119,7 +115,7 @@ export function Footer() {
|
|
|
119
115
|
/>
|
|
120
116
|
|
|
121
117
|
<ButtonFilled
|
|
122
|
-
|
|
118
|
+
icon={<CheckSVG />}
|
|
123
119
|
size={size === 's' ? 'xs' : 's'}
|
|
124
120
|
disabled={isApplyButtonDisabled}
|
|
125
121
|
onClick={handleApplySelection}
|
package/src/types.ts
CHANGED
|
@@ -46,13 +46,6 @@ export type TimeValue = {
|
|
|
46
46
|
seconds?: number;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Режим футера time-picker:
|
|
51
|
-
* - `current-time-and-apply` — кнопка выбора текущего времени и компактная «Применить»;
|
|
52
|
-
* - `apply-only` — одна широкая «Применить» с подписью.
|
|
53
|
-
*/
|
|
54
|
-
export type TimePickerFooterMode = 'current-time-and-apply' | 'apply-only';
|
|
55
|
-
|
|
56
49
|
export type DateAndTime = TimeValue & {
|
|
57
50
|
year?: number;
|
|
58
51
|
month?: number;
|