Skip to content

Commit 698c0ff

Browse files
authored
feat: add tour (vueComponent#6332)
* feat v4 add tour * fix type error * sync tour from antd5.4.6 & fix type error * fix error
1 parent db4148a commit 698c0ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3943
-56
lines changed

components/_util/hooks/useId.ts

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { ref } from 'vue';
2+
import canUseDom from '../../_util/canUseDom';
3+
4+
let uuid = 0;
5+
6+
/** Is client side and not jsdom */
7+
export const isBrowserClient = process.env.NODE_ENV !== 'test' && canUseDom();
8+
9+
/** Get unique id for accessibility usage */
10+
export function getUUID(): number | string {
11+
let retId: string | number;
12+
13+
// Test never reach
14+
/* istanbul ignore if */
15+
if (isBrowserClient) {
16+
retId = uuid;
17+
uuid += 1;
18+
} else {
19+
retId = 'TEST_OR_SSR';
20+
}
21+
22+
return retId;
23+
}
24+
25+
export default function useId(id = ref('')) {
26+
// Inner id for accessibility usage. Only work in client side
27+
const innerId = `vc_unique_${getUUID()}`;
28+
29+
return id.value || innerId;
30+
}

components/components.ts

+3
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,6 @@ export { default as Segmented } from './segmented';
258258

259259
export type { QRCodeProps } from './qrcode';
260260
export { default as QRCode } from './qrcode';
261+
262+
export type { TourProps, TourStepProps } from './tour';
263+
export { default as Tour } from './tour';

components/locale/en_US.ts

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ const localeValues: Locale = {
3535
triggerAsc: 'Click to sort ascending',
3636
cancelSort: 'Click to cancel sorting',
3737
},
38+
Tour: {
39+
Next: 'Next',
40+
Previous: 'Previous',
41+
Finish: 'Finish',
42+
},
3843
Modal: {
3944
okText: 'OK',
4045
cancelText: 'Cancel',

components/locale/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { PickerLocale as DatePickerLocale } from '../date-picker/generatePi
1010
import type { PaginationLocale } from '../pagination/Pagination';
1111
import type { TableLocale } from '../table/interface';
1212
import type { UploadLocale } from '../upload/interface';
13+
import type { TourLocale } from '../tour/interface';
1314

1415
interface TransferLocaleForEmpty {
1516
description: string;
@@ -43,6 +44,7 @@ export interface Locale {
4344
copied?: any;
4445
expand?: any;
4546
};
47+
Tour?: TourLocale;
4648
QRCode?: {
4749
expired?: string;
4850
refresh?: string;

components/locale/pt_BR.ts

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ const localeValues: Locale = {
3333
triggerAsc: 'Clique organiza por ascendente',
3434
cancelSort: 'Clique para cancelar organização',
3535
},
36+
Tour: {
37+
Next: 'Próximo',
38+
Previous: 'Anterior',
39+
Finish: 'Finalizar',
40+
},
3641
Modal: {
3742
okText: 'OK',
3843
cancelText: 'Cancelar',

components/locale/zh_CN.ts

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ const localeValues: Locale = {
3535
triggerAsc: '点击升序',
3636
cancelSort: '取消排序',
3737
},
38+
Tour: {
39+
Next: '下一步',
40+
Previous: '上一步',
41+
Finish: '结束导览',
42+
},
3843
Modal: {
3944
okText: '确定',
4045
cancelText: '取消',

components/locale/zh_HK.ts

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ const localeValues: Locale = {
3232
triggerAsc: '點擊升序',
3333
cancelSort: '取消排序',
3434
},
35+
Tour: {
36+
Next: '下一步',
37+
Previous: '上一步',
38+
Finish: '結束導覽',
39+
},
3540
Modal: {
3641
okText: '確定',
3742
cancelText: '取消',

components/locale/zh_TW.ts

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ const localeValues: Locale = {
3232
triggerAsc: '點擊升序',
3333
cancelSort: '取消排序',
3434
},
35+
Tour: {
36+
Next: '下一步',
37+
Previous: '上一步',
38+
Finish: '結束導覽',
39+
},
3540
Modal: {
3641
okText: '確定',
3742
cancelText: '取消',

components/theme/interface/alias.ts

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export interface AliasToken extends MapToken {
9494

9595
boxShadow: string;
9696
boxShadowSecondary: string;
97+
boxShadowTertiary: string;
9798

9899
linkDecoration: CSSProperties['textDecoration'];
99100
linkHoverDecoration: CSSProperties['textDecoration'];

components/theme/interface/components.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import type { ComponentToken as TooltipComponentToken } from '../../tooltip/styl
4444
import type { ComponentToken as TransferComponentToken } from '../../transfer/style';
4545
import type { ComponentToken as TypographyComponentToken } from '../../typography/style';
4646
import type { ComponentToken as UploadComponentToken } from '../../upload/style';
47-
// import type { ComponentToken as TourComponentToken } from '../../tour/style';
47+
import type { ComponentToken as TourComponentToken } from '../../tour/style';
4848
import type { ComponentToken as QRCodeComponentToken } from '../../qrcode/style';
4949
// import type { ComponentToken as AppComponentToken } from '../../app/style';
5050
import type { ComponentToken as WaveToken } from '../../_util/wave/style';
@@ -110,7 +110,7 @@ export interface ComponentTokenMap {
110110
Table?: TableComponentToken;
111111
Space?: SpaceComponentToken;
112112
Progress?: ProgressComponentToken;
113-
// Tour?: TourComponentToken;
113+
Tour?: TourComponentToken;
114114
QRCode?: QRCodeComponentToken;
115115
// App?: AppComponentToken;
116116

components/theme/util/alias.ts

+5
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ export default function formatToken(derivativeToken: RawMergedToken): AliasToken
134134
0 3px 6px -4px rgba(0, 0, 0, 0.12),
135135
0 9px 28px 8px rgba(0, 0, 0, 0.05)
136136
`,
137+
boxShadowTertiary: `
138+
0 1px 2px 0 rgba(0, 0, 0, 0.03),
139+
0 1px 6px -1px rgba(0, 0, 0, 0.02),
140+
0 2px 4px 0 rgba(0, 0, 0, 0.02)
141+
`,
137142

138143
screenXS,
139144
screenXSMin: screenXS,

0 commit comments

Comments
 (0)