Skip to content

Commit f5f0b1f

Browse files
committed
BREAKING CHANGE: ActionSheetItem rename autoClose
1 parent 9632d8f commit f5f0b1f

File tree

8 files changed

+43
-43
lines changed

8 files changed

+43
-43
lines changed

src/components/ActionSheet/ActionSheet.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ describe("ActionSheet", () => {
3636
it.each([
3737
{},
3838
{ selectable: true },
39-
{ autoclose: true },
40-
{ autoclose: true, selectable: true },
39+
{ autoClose: true },
40+
{ autoClose: true, selectable: true },
4141
])("when %s", async (props) => {
4242
const handlers = { onClick: jest.fn(), onChange: jest.fn() };
4343
const { unmount } = render(

src/components/ActionSheet/ActionSheet.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ export const ActionSheet: React.FC<ActionSheetProps> = ({
8585
}, [closing, fallbackTransitionFinish]);
8686

8787
const onItemClick = React.useCallback<ItemClickHandler>(
88-
(action, immediateAction, autoclose) => (event) => {
88+
(action, immediateAction, autoClose) => (event) => {
8989
event.persist();
9090
immediateAction && immediateAction(event);
91-
if (autoclose) {
91+
if (autoClose) {
9292
_action.current = () => action && action(event);
9393
setClosing(true);
9494
} else {

src/components/ActionSheet/ActionSheetContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type ActionType<T> = (event: React.MouseEvent<T>) => void;
55
export type ItemClickHandler<T extends Element = Element> = (
66
action: ActionType<T> | undefined,
77
immediateAction: ActionType<T> | undefined,
8-
autoclose: boolean
8+
autoClose: boolean
99
) => (event: React.MouseEvent) => void;
1010

1111
export type ActionSheetContextType<T extends Element = Element> = {

src/components/ActionSheet/Readme.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ const openBase = () =>
2828
<ActionSheet
2929
onClose={onClose}
3030
iosCloseItem={
31-
<ActionSheetItem autoclose mode="cancel">
31+
<ActionSheetItem autoClose mode="cancel">
3232
Отменить
3333
</ActionSheetItem>
3434
}
3535
toggleRef={baseTargetRef}
3636
>
37-
<ActionSheetItem autoclose>Сохранить в закладках</ActionSheetItem>
38-
<ActionSheetItem autoclose>Закрепить запись</ActionSheetItem>
39-
<ActionSheetItem autoclose>Выключить комментирование</ActionSheetItem>
40-
<ActionSheetItem autoclose>Закрепить запись</ActionSheetItem>
41-
<ActionSheetItem autoclose mode="destructive">
37+
<ActionSheetItem autoClose>Сохранить в закладках</ActionSheetItem>
38+
<ActionSheetItem autoClose>Закрепить запись</ActionSheetItem>
39+
<ActionSheetItem autoClose>Выключить комментирование</ActionSheetItem>
40+
<ActionSheetItem autoClose>Закрепить запись</ActionSheetItem>
41+
<ActionSheetItem autoClose mode="destructive">
4242
Удалить запись
4343
</ActionSheetItem>
4444
</ActionSheet>
@@ -49,26 +49,26 @@ const openIcons = () =>
4949
<ActionSheet
5050
onClose={onClose}
5151
iosCloseItem={
52-
<ActionSheetItem autoclose mode="cancel">
52+
<ActionSheetItem autoClose mode="cancel">
5353
Отменить
5454
</ActionSheetItem>
5555
}
5656
toggleRef={iconsTargetRef}
5757
>
58-
<ActionSheetItem autoclose before={<Icon28EditOutline />}>
58+
<ActionSheetItem autoClose before={<Icon28EditOutline />}>
5959
Редактировать профиль
6060
</ActionSheetItem>
61-
<ActionSheetItem autoclose before={<Icon28ListPlayOutline />}>
61+
<ActionSheetItem autoClose before={<Icon28ListPlayOutline />}>
6262
Слушать далее
6363
</ActionSheetItem>
64-
<ActionSheetItem autoclose before={<Icon28ShareOutline />}>
64+
<ActionSheetItem autoClose before={<Icon28ShareOutline />}>
6565
Поделиться
6666
</ActionSheetItem>
67-
<ActionSheetItem autoclose before={<Icon28CopyOutline />}>
67+
<ActionSheetItem autoClose before={<Icon28CopyOutline />}>
6868
Скопировать ссылку
6969
</ActionSheetItem>
7070
<ActionSheetItem
71-
autoclose
71+
autoClose
7272
before={
7373
platform === IOS ? (
7474
<Icon28DeleteOutline />
@@ -88,30 +88,30 @@ const openSubtitle = () =>
8888
<ActionSheet
8989
onClose={onClose}
9090
iosCloseItem={
91-
<ActionSheetItem autoclose mode="cancel">
91+
<ActionSheetItem autoClose mode="cancel">
9292
Отменить
9393
</ActionSheetItem>
9494
}
9595
toggleRef={subtitleTargetRef}
9696
>
9797
<ActionSheetItem
9898
before={<Icon28SettingsOutline />}
99-
autoclose
99+
autoClose
100100
subtitle="Авто"
101101
>
102102
Качество
103103
</ActionSheetItem>
104104
<ActionSheetItem
105105
before={<Icon28SubtitlesOutline />}
106-
autoclose
106+
autoClose
107107
subtitle="Отсутствуют"
108108
disabled
109109
>
110110
Субтитры
111111
</ActionSheetItem>
112112
<ActionSheetItem
113113
before={<Icon28PlaySpeedOutline />}
114-
autoclose
114+
autoClose
115115
subtitle="Обычная"
116116
>
117117
Скорость воспроизведения
@@ -124,7 +124,7 @@ const openSelectable = () =>
124124
<ActionSheet
125125
onClose={onClose}
126126
iosCloseItem={
127-
<ActionSheetItem autoclose mode="cancel">
127+
<ActionSheetItem autoClose mode="cancel">
128128
Отменить
129129
</ActionSheetItem>
130130
}
@@ -135,7 +135,7 @@ const openSelectable = () =>
135135
checked={filter === "best"}
136136
name="filter"
137137
value="best"
138-
autoclose
138+
autoClose
139139
selectable
140140
>
141141
Лучшие друзья
@@ -145,7 +145,7 @@ const openSelectable = () =>
145145
checked={filter === "relatives"}
146146
name="filter"
147147
value="relatives"
148-
autoclose
148+
autoClose
149149
selectable
150150
>
151151
Родственники
@@ -155,7 +155,7 @@ const openSelectable = () =>
155155
checked={filter === "collegues"}
156156
name="filter"
157157
value="collegues"
158-
autoclose
158+
autoClose
159159
selectable
160160
>
161161
Коллеги
@@ -165,7 +165,7 @@ const openSelectable = () =>
165165
checked={filter === "school"}
166166
name="filter"
167167
value="school"
168-
autoclose
168+
autoClose
169169
selectable
170170
>
171171
Друзья по школе
@@ -175,7 +175,7 @@ const openSelectable = () =>
175175
checked={filter === "university"}
176176
name="filter"
177177
value="university"
178-
autoclose
178+
autoClose
179179
selectable
180180
>
181181
Друзья по вузу
@@ -188,14 +188,14 @@ const openTitle = () =>
188188
<ActionSheet
189189
onClose={onClose}
190190
iosCloseItem={
191-
<ActionSheetItem autoclose mode="cancel">
191+
<ActionSheetItem autoClose mode="cancel">
192192
Отменить
193193
</ActionSheetItem>
194194
}
195195
header="Вы действительно хотите удалить это видео из Ваших видео?"
196196
toggleRef={titleTargetRef}
197197
>
198-
<ActionSheetItem autoclose mode="destructive">
198+
<ActionSheetItem autoClose mode="destructive">
199199
Удалить видео
200200
</ActionSheetItem>
201201
</ActionSheet>
@@ -206,17 +206,17 @@ const openBaseTop = () =>
206206
<ActionSheet
207207
onClose={onClose}
208208
iosCloseItem={
209-
<ActionSheetItem autoclose mode="cancel">
209+
<ActionSheetItem autoClose mode="cancel">
210210
Отменить
211211
</ActionSheetItem>
212212
}
213213
toggleRef={baseTopTargetRef}
214214
>
215-
<ActionSheetItem autoclose>Сохранить в закладках</ActionSheetItem>
216-
<ActionSheetItem autoclose>Закрепить запись</ActionSheetItem>
217-
<ActionSheetItem autoclose>Выключить комментирование</ActionSheetItem>
218-
<ActionSheetItem autoclose>Закрепить запись</ActionSheetItem>
219-
<ActionSheetItem autoclose mode="destructive">
215+
<ActionSheetItem autoClose>Сохранить в закладках</ActionSheetItem>
216+
<ActionSheetItem autoClose>Закрепить запись</ActionSheetItem>
217+
<ActionSheetItem autoClose>Выключить комментирование</ActionSheetItem>
218+
<ActionSheetItem autoClose>Закрепить запись</ActionSheetItem>
219+
<ActionSheetItem autoClose mode="destructive">
220220
Удалить запись
221221
</ActionSheetItem>
222222
</ActionSheet>

src/components/ActionSheetItem/ActionSheetItem.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ export interface ActionSheetItemProps
3434
before?: React.ReactNode;
3535
meta?: React.ReactNode;
3636
subtitle?: React.ReactNode;
37-
autoclose?: boolean;
37+
autoClose?: boolean;
3838
selectable?: boolean;
3939
disabled?: boolean;
4040
/**
41-
* Если autoclose === true, onClick будет вызван после завершения анимации скрытия и после вызова onClose.
41+
* Если autoClose === true, onClick будет вызван после завершения анимации скрытия и после вызова onClose.
4242
* Из этого следует, что в объекте события значения полей типа `currentTarget` будут не определены.
4343
* Если вам нужен объект события именно на момент клика, используйте `onImmediateClick`.
4444
*/
@@ -48,7 +48,7 @@ export interface ActionSheetItemProps
4848

4949
const ActionSheetItemComponent: React.FC<ActionSheetItemProps> = ({
5050
children,
51-
autoclose,
51+
autoClose,
5252
mode = "default",
5353
meta,
5454
subtitle,
@@ -82,7 +82,7 @@ const ActionSheetItemComponent: React.FC<ActionSheetItemProps> = ({
8282
onClick={
8383
selectable
8484
? onClick
85-
: onItemClick(onClick, onImmediateClick, Boolean(autoclose))
85+
: onItemClick(onClick, onImmediateClick, Boolean(autoClose))
8686
}
8787
activeMode="ActionSheetItem--active"
8888
// eslint-disable-next-line vkui/no-object-expression-in-arguments
@@ -164,7 +164,7 @@ const ActionSheetItemComponent: React.FC<ActionSheetItemProps> = ({
164164
name={name}
165165
value={value}
166166
onChange={onChange}
167-
onClick={onItemClick(noop, noop, Boolean(autoclose))}
167+
onClick={onItemClick(noop, noop, Boolean(autoClose))}
168168
defaultChecked={defaultChecked}
169169
checked={checked}
170170
disabled={restProps.disabled}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Элемент списка `ActionSheet`. Если в `ActionSheetItem` передать `autoclose={true}`, то `ActionSheet` сам вызовет
1+
Элемент списка `ActionSheet`. Если в `ActionSheetItem` передать `autoClose={true}`, то `ActionSheet` сам вызовет
22
переданный в него `onClose`.

src/components/FocusTrap/FocusTrap.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { SplitCol } from "../SplitCol/SplitCol";
1818
import { CellButton } from "../CellButton/CellButton";
1919

2020
const _children = ["first", "middle", "last"].map((item) => (
21-
<ActionSheetItem key={item} autoclose data-testid={item}>
21+
<ActionSheetItem key={item} autoClose data-testid={item}>
2222
{item} Item
2323
</ActionSheetItem>
2424
));

styleguide/Components/Setting/Setting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const Setting = ({
6464
const title = isPrimitive ? item : item.title;
6565
return (
6666
<ActionSheetItem
67-
autoclose
67+
autoClose
6868
key={value}
6969
value={value}
7070
onClick={() => onChange(value)}

0 commit comments

Comments
 (0)