From fe7cba601bdefe6c6edcde0b3e51c2d0ef542312 Mon Sep 17 00:00:00 2001 From: insekkei <1183448115@qq.com> Date: Fri, 29 Mar 2024 08:32:24 +0800 Subject: [PATCH 01/20] feat(typography): typography finished --- .vscode/settings.json | 2 +- package.json | 5 + site/site.config.mjs | 8 + src/_common | 2 +- .../__snapshots__/vitest-guide.test.jsx.snap | 6 +- src/index.ts | 1 + src/typography/Ellipsis.tsx | 99 ++++ src/typography/Paragraph.tsx | 38 ++ src/typography/Text.tsx | 166 +++++++ src/typography/Title.tsx | 39 ++ src/typography/Truncate.tsx | 429 ++++++++++++++++++ src/typography/__tests__/typography.test.tsx | 117 +++++ src/typography/_example/base.jsx | 47 ++ src/typography/_example/copyable.jsx | 36 ++ src/typography/_example/ellipsis.jsx | 59 +++ src/typography/_example/text.jsx | 25 + src/typography/_example/title.jsx | 17 + src/typography/api.md | 3 + src/typography/defaultProps.ts | 22 + src/typography/index.ts | 17 + src/typography/style/css.js | 1 + src/typography/style/index.js | 1 + src/typography/type.ts | 156 +++++++ src/typography/typography.en-US.md | 62 +++ src/typography/typography.md | 62 +++ src/typography/useEllipsis.tsx | 65 +++ 26 files changed, 1480 insertions(+), 5 deletions(-) create mode 100644 src/typography/Ellipsis.tsx create mode 100644 src/typography/Paragraph.tsx create mode 100644 src/typography/Text.tsx create mode 100644 src/typography/Title.tsx create mode 100644 src/typography/Truncate.tsx create mode 100644 src/typography/__tests__/typography.test.tsx create mode 100644 src/typography/_example/base.jsx create mode 100644 src/typography/_example/copyable.jsx create mode 100644 src/typography/_example/ellipsis.jsx create mode 100644 src/typography/_example/text.jsx create mode 100644 src/typography/_example/title.jsx create mode 100644 src/typography/api.md create mode 100644 src/typography/defaultProps.ts create mode 100644 src/typography/index.ts create mode 100644 src/typography/style/css.js create mode 100644 src/typography/style/index.js create mode 100644 src/typography/type.ts create mode 100644 src/typography/typography.en-US.md create mode 100644 src/typography/typography.md create mode 100644 src/typography/useEllipsis.tsx diff --git a/.vscode/settings.json b/.vscode/settings.json index e500d7a72c..4ca63e8b91 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,7 +22,7 @@ "editor.defaultFormatter": "esbenp.prettier-vscode" }, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "cSpell.words": ["activable", "actived", "borderless", "Cascader", "Popconfirm", "Swiper", "tdesign"] } \ No newline at end of file diff --git a/package.json b/package.json index 5e899cd039..3b38305d4d 100644 --- a/package.json +++ b/package.json @@ -203,13 +203,18 @@ "@types/tinycolor2": "^1.4.3", "@types/validator": "^13.1.3", "classnames": "~2.3.1", + "copy-to-clipboard": "^3.3.3", "dayjs": "~1.11.4", "hoist-non-react-statics": "~3.3.2", + "install": "^0.13.0", "lodash": "~4.17.15", "mitt": "^3.0.0", + "npm": "^10.5.0", "raf": "~3.4.1", "react-is": "^18.2.0", + "react-lines-ellipsis": "^0.15.4", "react-popper": "~2.3.0", + "react-show-more-text": "^1.7.1", "react-transition-group": "~4.4.1", "sortablejs": "^1.15.0", "tdesign-icons-react": "^0.3.0", diff --git a/site/site.config.mjs b/site/site.config.mjs index 48fe712750..1834e6222b 100644 --- a/site/site.config.mjs +++ b/site/site.config.mjs @@ -561,6 +561,14 @@ export const docs = [ component: () => import('tdesign-react/tooltip/tooltip.md'), componentEn: () => import('tdesign-react/tooltip/tooltip.en-US.md'), }, + { + title: 'Typography 排版', + titleEn: 'Typography', + name: 'typography', + path: '/react/components/typography', + component: () => import('tdesign-react/typography/typography.md'), + componentEn: () => import('tdesign-react/typography/typography.en-US.md'), + }, { title: 'Tree 树', titleEn: 'Tree', diff --git a/src/_common b/src/_common index 742a90e47e..27dd7faa14 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit 742a90e47eed782f9d09ab7f981f60a950846c48 +Subproject commit 27dd7faa1436f53ff4a65c4fa9e1a6f83db13317 diff --git a/src/guide/__tests__/__snapshots__/vitest-guide.test.jsx.snap b/src/guide/__tests__/__snapshots__/vitest-guide.test.jsx.snap index 7f42bdb144..63e07e8802 100644 --- a/src/guide/__tests__/__snapshots__/vitest-guide.test.jsx.snap +++ b/src/guide/__tests__/__snapshots__/vitest-guide.test.jsx.snap @@ -921,7 +921,7 @@ exports[`Guide Component > GuideStep.placement is equal to bottom-left 1`] = ` style="width: 16px; height: 16px; top: -8px; left: -8px;" />