Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tabs] Restores the edit-columns icon, causing a breaking change #11281

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rare-rings-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

Restores the Tab's `edit-columns` action type
1 change: 1 addition & 0 deletions polaris-react/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Přejmenovat zobrazení",
"duplicate": "Duplikování zobrazení",
"edit": "Upravit zobrazení",
"editColumns": "Upravit sloupce",
"delete": "Odstranit zobrazení",
"copy": "{name} – kopie",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Omdøb visning",
"duplicate": "Dupliker visning",
"edit": "Rediger visning",
"editColumns": "Rediger kolonner",
"delete": "Slet visning",
"copy": "Kopi af {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Ansicht umbenennen",
"duplicate": "Ansicht duplizieren",
"edit": "Ansicht bearbeiten",
"editColumns": "Spalten bearbeiten",
"delete": "Ansicht löschen",
"copy": "Kopie von {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@
"rename": "Rename view",
"duplicate": "Duplicate view",
"edit": "Edit view",
"editColumns": "Edit columns",
"delete": "Delete view",
"copy": "Copy of {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Cambiar nombre de vista",
"duplicate": "Duplicar vista",
"edit": "Editar vista",
"editColumns": "Editar columnas",
"delete": "Eliminar vista",
"copy": "Copia de {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Nimeä näkymä uudelleen",
"duplicate": "Kopioi näkymä",
"edit": "Muokkaa näkymää",
"editColumns": "Muokkaa sarakkeita",
"delete": "Poista näkymä",
"copy": "Kopio tiedostosta {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Renommer la vue",
"duplicate": "Dupliquer la vue",
"edit": "Modifier la vue",
"editColumns": "Modifier les colonnes",
"delete": "Supprimer la vue",
"copy": "Copie de {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Rinomina vista",
"duplicate": "Duplica vista",
"edit": "Modifica vista",
"editColumns": "Modifica colonne",
"delete": "Elimina vista",
"copy": "Copia di {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "ビューの名前を変更",
"duplicate": "ビューを複製",
"edit": "ビューを編集",
"editColumns": "列を編集",
"delete": "ビューを削除",
"copy": "{name}のコピー",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "보기 이름 바꾸기",
"duplicate": "보기 복제",
"edit": "보기 편집",
"editColumns": "열 편집",
"delete": "보기 삭제",
"copy": "{name}의 사본",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Gi visning nytt navn",
"duplicate": "Dupliser visning",
"edit": "Rediger visning",
"editColumns": "Rediger kolonner",
"delete": "Slett visning",
"copy": "Kopi av {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Naam van weergave wijzigen",
"duplicate": "Weergave dupliceren",
"edit": "Weergave bewerken",
"editColumns": "Kolommen bewerken",
"delete": "Weergave verwijderen",
"copy": "Kopie van {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Zmień nazwę widoku",
"duplicate": "Duplikuj widok",
"edit": "Edytuj widok",
"editColumns": "Edytuj kolumny",
"delete": "Usuń widok",
"copy": "Kopia {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Renomear visualização",
"duplicate": "Duplicar visualização",
"edit": "Editar visualização",
"editColumns": "Editar colunas",
"delete": "Excluir visualização",
"copy": "Cópia de {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Renomear visualização",
"duplicate": "Duplicar visualização",
"edit": "Editar visualização",
"editColumns": "Editar colunas",
"delete": "Eliminar visualização",
"copy": "Cópia de {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Döp om vy",
"duplicate": "Duplicera vy",
"edit": "Redigera vy",
"editColumns": "Redigera kolumner",
"delete": "Radera vy",
"copy": "Kopia av {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "เปลี่ยนชื่อมุมมอง",
"duplicate": "ทำซ้ำมุมมอง",
"edit": "แก้ไขมุมมอง",
"editColumns": "แก้ไขคอลัมน์",
"delete": "ลบมุมมอง",
"copy": "สำเนาของ {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Görünümü yeniden adlandır",
"duplicate": "Görünümü çoğalt",
"edit": "Görünümü düzenle",
"editColumns": "Sütunları düzenle",
"delete": "Görünümü sil",
"copy": "{name} kopyası",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "Đổi tên chế độ xem",
"duplicate": "Sao chép chế độ xem",
"edit": "Chỉnh sửa chế độ xem",
"editColumns": "Sửa cột",
"delete": "Xóa chế độ xem",
"copy": "Bản sao của {name}",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "重命名视图",
"duplicate": "复制视图",
"edit": "编辑视图",
"editColumns": "编辑列",
"delete": "删除视图",
"copy": "{name} 的副本",
"deleteModal": {
Expand Down
1 change: 1 addition & 0 deletions polaris-react/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"rename": "重新命名檢視畫面",
"duplicate": "複製檢視畫面",
"edit": "編輯檢視畫面",
"editColumns": "編輯欄",
"delete": "刪除檢視畫面",
"copy": "{name}的副本",
"deleteModal": {
Expand Down
12 changes: 11 additions & 1 deletion polaris-react/src/components/Tabs/Tabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ export function Fitted() {
);
}

type AlphaTabAction = 'rename' | 'edit' | 'duplicate' | 'delete';
type AlphaTabAction =
| 'rename'
| 'edit'
| 'edit-columns'
| 'duplicate'
| 'delete';

export function WithActions() {
const sleep = (ms: number) =>
Expand Down Expand Up @@ -159,6 +164,11 @@ export function WithActions() {
onAction: () => {},
onPrimaryAction: () => {},
},
{
type: 'edit-columns' as AlphaTabAction,
onAction: () => {},
onPrimaryAction: () => {},
},
{
type: 'delete' as AlphaTabAction,
onAction: () => {},
Expand Down
5 changes: 5 additions & 0 deletions polaris-react/src/components/Tabs/components/Tab/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
import {
InfoMinor,
DuplicateMinor,
Columns3Minor,
EditMinor,
DeleteMinor,
ChevronDownMinor,
Expand Down Expand Up @@ -220,6 +221,10 @@ export const Tab = forwardRef(
icon: EditMinor,
content: i18n.translate('Polaris.Tabs.Tab.edit'),
},
'edit-columns': {
icon: Columns3Minor,
content: i18n.translate('Polaris.Tabs.Tab.editColumns'),
},
delete: {
icon: DeleteMinor,
content: i18n.translate('Polaris.Tabs.Tab.delete'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ describe('Tab', () => {
onAction: jest.fn(),
onPrimaryAction: jest.fn(),
},
{
type: 'edit-columns',
onAction: jest.fn(),
onPrimaryAction: jest.fn(),
},
{
type: 'duplicate',
onAction: jest.fn(),
Expand Down Expand Up @@ -155,6 +160,11 @@ describe('Tab', () => {
icon: expect.any(Function),
onAction: expect.any(Function),
},
{
content: 'Edit columns',
icon: expect.any(Function),
onAction: expect.any(Function),
},
{
content: 'Duplicate view',
icon: expect.any(Function),
Expand Down Expand Up @@ -197,6 +207,12 @@ describe('Tab', () => {
onAction: expect.any(Function),
disabled: true,
},
{
content: 'Edit columns',
icon: expect.any(Function),
onAction: expect.any(Function),
disabled: true,
},
{
content: 'Duplicate view',
icon: expect.any(Function),
Expand All @@ -217,6 +233,7 @@ describe('Tab', () => {
it.each([
['rename', 'Rename view'],
['edit', 'Edit view'],
['edit-columns', 'Edit columns'],
['duplicate', 'Duplicate view'],
['delete', 'Delete view'],
])(
Expand Down
7 changes: 6 additions & 1 deletion polaris-react/src/components/Tabs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import type {ReactNode} from 'react';

import type {ActionListItemDescriptor} from '../../types';

export type TabAction = 'rename' | 'edit' | 'duplicate' | 'delete';
export type TabAction =
| 'rename'
| 'edit'
| 'edit-columns'
| 'duplicate'
| 'delete';

interface TabActionDescriptor
extends Omit<ActionListItemDescriptor, 'onAction'> {
Expand Down