Skip to content

Commit

Permalink
chore: auto merge branches (ant-design#43940)
Browse files Browse the repository at this point in the history
chore: merge master into feature
  • Loading branch information
github-actions[bot] authored Aug 2, 2023
2 parents 8a16594 + 6ca1b6d commit a4212f4
Show file tree
Hide file tree
Showing 150 changed files with 3,229 additions and 660 deletions.
6 changes: 3 additions & 3 deletions .dumi/pages/index/components/Theme/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export default function Theme() {
...ThemeDefault,
themeType,
...ThemesInfo[themeType],
} as any;
};

setThemeData(mergedData);
form.setFieldsValue(mergedData);
Expand Down Expand Up @@ -517,13 +517,13 @@ export default function Theme() {
const posStyle: React.CSSProperties = {
position: 'absolute',
};
const leftTopImageStyle = {
const leftTopImageStyle: React.CSSProperties = {
left: '50%',
transform: 'translate3d(-900px, 0, 0)',
top: -100,
height: 500,
};
const rightBottomImageStyle = {
const rightBottomImageStyle: React.CSSProperties = {
right: '50%',
transform: 'translate3d(750px, 0, 0)',
bottom: -100,
Expand Down
16 changes: 15 additions & 1 deletion .dumi/rehypeAntd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function rehypeAntd(): UnifiedTransformer<HastRoot> {
return (tree, vFile) => {
const { filename } = vFile.data.frontmatter as any;

unistUtilVisit.visit(tree, 'element', (node) => {
unistUtilVisit.visit(tree, 'element', (node, i, parent) => {
if (node.tagName === 'DumiDemoGrid') {
// replace DumiDemoGrid to DemoWrapper, to implement demo toolbar
node.tagName = 'DemoWrapper';
Expand Down Expand Up @@ -66,6 +66,20 @@ function rehypeAntd(): UnifiedTransformer<HastRoot> {
node.tagName = 'LocaleLink';
} else if (node.type === 'element' && node.tagName === 'video') {
node.tagName = 'VideoPlayer';
} else if (node.tagName === 'SourceCode') {
const { lang } = node.properties;
if (lang === 'sandpack') {
parent!.children.splice(i!, 1, {
type: 'element',
tagName: 'Sandpack',
children: [
{
type: 'text',
value: (node.children[0] as any).value,
},
],
});
}
}
});
};
Expand Down
3 changes: 3 additions & 0 deletions .dumi/theme/builtins/Sandpack/Sandpack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Sandpack } from '@codesandbox/sandpack-react';

export default Sandpack;
91 changes: 91 additions & 0 deletions .dumi/theme/builtins/Sandpack/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import type { ReactNode } from 'react';
import React, { Suspense } from 'react';
import { useSearchParams, useServerInsertedHTML } from 'dumi';
import { createStyles } from 'antd-style';
import { getSandpackCssText } from '@codesandbox/sandpack-react';
import { Skeleton } from 'antd';

const OriginSandpack = React.lazy(() => import('./Sandpack'));

const setup = {
dependencies: {
react: '^18.0.0',
'react-dom': '^18.0.0',
antd: '^5.0.0',
},
devDependencies: {
'@types/react': '^18.0.0',
'@types/react-dom': '^18.0.0',
typescript: '^5',
},
entry: 'index.tsx',
};

const options = {
activeFile: 'app.tsx' as never,
visibleFiles: ['index.tsx', 'app.tsx', 'package.json'] as any,
showLineNumbers: true,
editorHeight: '500px',
};

const indexContent = `import React from 'react';
import { createRoot } from 'react-dom/client';
import App from './app';
const root = createRoot(document.getElementById("root"));
root.render(<App />);
`;

const useStyle = createStyles(({ token, css }) => ({
fallback: css`
width: 100%;
> * {
width: 100% !important;
border-radius: 8px;
}
`,
placeholder: css`
color: ${token.colorTextDescription};
font-size: 16px;
`,
}));

const SandpackFallback = () => {
const { styles } = useStyle();

return (
<div className={styles.fallback}>
<Skeleton.Node active style={{ height: 500, width: '100%' }}>
<span className={styles.placeholder}>Loading Demo...</span>
</Skeleton.Node>
</div>
);
};

const Sandpack = ({ children }: { children: ReactNode }) => {
const [searchParams] = useSearchParams();

useServerInsertedHTML(() => (
<style
data-sandpack="true"
id="sandpack"
dangerouslySetInnerHTML={{ __html: getSandpackCssText() }}
/>
));

return (
<Suspense fallback={<SandpackFallback />}>
<OriginSandpack
theme={searchParams.getAll('theme').includes('dark') ? 'dark' : undefined}
customSetup={setup}
options={options}
files={{
'index.tsx': indexContent,
'app.tsx': children,
}}
/>
</Suspense>
);
};

export default Sandpack;
4 changes: 2 additions & 2 deletions .dumi/theme/common/Color/ColorStyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ColorStyle = () => {
if (index <= 10) {
return `
.palette-${color}-${index} {
background: ${(token as any)[`${color}-${index}`]};
background: ${token[`${color}-${index}`]};
}
${makePalette(color, index + 1)}
`;
Expand All @@ -37,7 +37,7 @@ ${makePalette(color, index + 1)}
if (index <= 13) {
return `
.palette-gray-${index} {
background: ${(gray as any)[index]};
background: ${gray[index]};
}
${makeGrayPalette(index + 1)}
`;
Expand Down
30 changes: 24 additions & 6 deletions .dumi/theme/common/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,49 @@
import type { MouseEvent } from 'react';
import React, { forwardRef, startTransition } from 'react';
import { useNavigate } from 'dumi';
import React, { forwardRef, useLayoutEffect, useMemo, useTransition } from 'react';
import { useLocation, useNavigate } from 'dumi';
import nprogress from 'nprogress';

export type LinkProps = {
to?: string;
to?: string | { pathname?: string; search?: string; hash?: string };
children?: React.ReactNode;
className?: string;
};

const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {
const { to, children, ...rest } = props;
const [isPending, startTransition] = useTransition();
const navigate = useNavigate();
const { pathname } = useLocation();

const href = useMemo(() => {
if (typeof to === 'object') {
return `${to.pathname || pathname}${to.search || ''}${to.hash || ''}`;
}
return to;
}, [to]);

const handleClick = (e: MouseEvent<HTMLAnchorElement>) => {
if (!to.startsWith('http')) {
if (!href.startsWith('http')) {
// Should support open in new tab
if (!e.metaKey && !e.ctrlKey && !e.shiftKey) {
e.preventDefault();
startTransition(() => {
navigate(to);
navigate(href);
});
}
}
};

useLayoutEffect(() => {
if (isPending) {
nprogress.start();
} else {
nprogress.done();
}
}, [isPending]);

return (
<a ref={ref} href={to} onClick={handleClick} {...rest}>
<a ref={ref} href={href} onClick={handleClick} {...rest}>
{children}
</a>
);
Expand Down
5 changes: 2 additions & 3 deletions .dumi/theme/layouts/GlobalLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import {
StyleProvider,
extractStyle,
} from '@ant-design/cssinjs';
import { createSearchParams, useOutlet, useSearchParams } from 'dumi';
import { useServerInsertedHTML } from 'umi';
import React, { useCallback, useEffect, useMemo } from 'react';
import type { DirectionType } from 'antd/es/config-provider';
import { createSearchParams, useOutlet, useSearchParams, useServerInsertedHTML } from 'dumi';
import { App, theme as antdTheme } from 'antd';
import type { DirectionType } from 'antd/es/config-provider';
import useLayoutState from '../../hooks/useLayoutState';
import SiteThemeProvider from '../SiteThemeProvider';
import useLocation from '../../hooks/useLocation';
Expand Down
15 changes: 9 additions & 6 deletions .dumi/theme/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,14 @@ const RoutesPlugin = (api: IApi) => {
// fs.writeFileSync(tmpFilePath, file.content, 'utf8');

// extract all emotion style tags from body
file.content = file.content.replace(/<style data-emotion[\S\s]+?<\/style>/g, (s) => {
globalStyles += s;
file.content = file.content.replace(
/<style (data-emotion|data-sandpack)[\S\s]+?<\/style>/g,
(s) => {
globalStyles += s;

return '';
});
return '';
},
);

// insert emotion style tags to head
file.content = file.content.replace('</head>', `${globalStyles}</head>`);
Expand All @@ -142,14 +145,14 @@ const RoutesPlugin = (api: IApi) => {
});

// Insert antd style to head
const matchRegex = /<style data-type="antd-cssinjs">(.*)<\/style>/;
const matchRegex = /<style data-type="antd-cssinjs">(.*?)<\/style>/;
const matchList = file.content.match(matchRegex) || [];

let antdStyle = '';

matchList.forEach((text) => {
file.content = file.content.replace(text, '');
antdStyle = text.replace(matchRegex, '$1');
antdStyle += text.replace(matchRegex, '$1');
});

const cssFile = writeCSSFile('antd', antdStyle, antdStyle);
Expand Down
10 changes: 8 additions & 2 deletions .dumi/theme/slots/Header/More.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ import { DownOutlined } from '@ant-design/icons';
import { createStyles } from 'antd-style';
import { FormattedMessage } from 'dumi';
import React from 'react';
import classnames from 'classnames';
import type { MenuProps } from 'antd';
import { Button, Dropdown } from 'antd';
import type { SharedProps } from './interface';

const useStyle = createStyles(({ css }) => ({
const useStyle = createStyles(({ css, token }) => ({
smallStyle: css`
font-size: 12px;
color: #777;
margin-left: 0.3em;
`,
down: css`
color: ${token.colorTextQuaternary};
`,
downOutlined: css`
font-size: 9px;
margin: -1px 0 0 2px;
Expand Down Expand Up @@ -84,7 +88,9 @@ const More: React.FC<SharedProps> = ({ isRTL }) => {
<Dropdown menu={{ items: getEcosystemGroup() }} placement="bottomRight">
<Button size="small">
<FormattedMessage id="app.header.menu.more" />
<DownOutlined className={isRTL ? styles.downOutlinedRTL : styles.downOutlined} />
<DownOutlined
className={classnames(isRTL ? styles.downOutlinedRTL : styles.downOutlined, styles.down)}
/>
</Button>
</Dropdown>
);
Expand Down
3 changes: 2 additions & 1 deletion .dumi/theme/slots/Header/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { FormattedMessage, Link, useFullSidebarData, useLocation } from 'dumi';
import { FormattedMessage, useFullSidebarData, useLocation } from 'dumi';
import { MenuOutlined } from '@ant-design/icons';
import { createStyles, css } from 'antd-style';
import type { MenuProps } from 'antd';
Expand All @@ -8,6 +8,7 @@ import { getEcosystemGroup } from './More';
import * as utils from '../../utils';
import type { SharedProps } from './interface';
import useLocale from '../../../hooks/useLocale';
import Link from '../../common/Link';

// ============================= Theme =============================
const locales = {
Expand Down
41 changes: 41 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,47 @@ timeline: true

---

## 5.8.1

`2023-08-02`

- 🐞 Fix unexpected warning of deprecated `clearIcon` [#43945](https://github.com/ant-design/ant-design/pull/43945) [@kiner-tang](https://github.com/kiner-tang)
- TypeScript
- 🤖 Export `MappingAlgorithm` as type of theme algorithm. [#43953](https://github.com/ant-design/ant-design/pull/43953)

## 5.8.0

`2023-08-01`

- 🔥 Component Token support `algorithm` to calculate derivative tokens same as global. [#43810](https://github.com/ant-design/ant-design/pull/43810) [@MadCcc](https://github.com/MadCcc)
- 🔥 Modal hooks function support `await` call. [#43470](https://github.com/ant-design/ant-design/pull/43470)
- 🔥 ConfigProvider support `wave` to customize wave effect. [#43784](https://github.com/ant-design/ant-design/pull/43784)
- 🆕 Form support `getFieldsValue({ strict: true })` to support only Item bind values. [#43828](https://github.com/ant-design/ant-design/pull/43828)
- 🆕 Descriptions support `items` prop. [#43483](https://github.com/ant-design/ant-design/pull/43483) [@RedJue](https://github.com/RedJue)
- 🆕 ColorPicker support `disabledAlpha` prop. [#43355](https://github.com/ant-design/ant-design/pull/43355) [@RedJue](https://github.com/RedJue)
- 🆕 Avatar.Group support `shape` prop. [#43817](https://github.com/ant-design/ant-design/pull/43817) [@li-jia-nan](https://github.com/li-jia-nan)
- 🆕 AutoComplete/Cascader/DatePicker/Input.Textarea/TimePicker/TreeSelect support `allowClear` prop to customize clear button。[#43582](https://github.com/ant-design/ant-design/discussions/43582) [@kiner-tang](https://github.com/kiner-tang)
- 🆕 RangePicker `presets` support callback functions. [#43476](https://github.com/ant-design/ant-design/pull/43476) [@Wxh16144](https://github.com/Wxh16144)
- 🆕 Added the `preview={{ movable: Boolean }}` prop to the Image component to support dragging and dropping into folders. [#43823](https://github.com/ant-design/ant-design/pull/43823) [@linxianxi](https://github.com/linxianxi)
- 🆕 Slider `tooltip` support `autoAdjustOverflow` prop. [#43788](https://github.com/ant-design/ant-design/pull/43788)
- 🆕 Added the `selectionsIcon` property to the Transfer component to support custom icons for the dropdown menu. [#43773](https://github.com/ant-design/ant-design/pull/43773) [@li-jia-nan](https://github.com/li-jia-nan)
- 🗑 Select, Tree-Select and Cascader deprecated `showArrow` prop. Now suffix arrow should be configured with `suffixIcon`. [#43520](https://github.com/ant-design/ant-design/pull/43520) [@MuxinFeng](https://github.com/MuxinFeng)
- 🐞 Optimized the import method for `@ant-design/icons` to avoid importing all icons. [#43915](https://github.com/ant-design/ant-design/pull/43915) [@ssxenon01](https://github.com/ssxenon01)
- 🐞 Fix Anchor not trigger `getCurrentAnchor` when scroll. [#43916](https://github.com/ant-design/ant-design/pull/43916)
- 🐞 Fix Tooltip `hover` not trigger on `disabled` element. [#43872](https://github.com/ant-design/ant-design/pull/43872)
- 🐞 Fix ColorPicker not calling `onChangeComplete` callback when changing value. [#43867](https://github.com/ant-design/ant-design/pull/43867) [@RedJue](https://github.com/RedJue)
- 🐞 Fix `Modal.confirm` `locale` setting were reset. [#43277](https://github.com/ant-design/ant-design/pull/43277) [@Yuiai01](https://github.com/Yuiai01)
- 🐞 Fix Slide description info and slider handle overlap issue. [#43780](https://github.com/ant-design/ant-design/pull/43780) [@Wxh16144](https://github.com/Wxh16144)
- 🐞 Fix InputNumber handler style in large size. [#43875](https://github.com/ant-design/ant-design/pull/43875) [@yee94](https://github.com/yee94)
- 🐞 Fix Select popup flip position motion not correct. [#43764](https://github.com/ant-design/ant-design/pull/43764)
- 💄 Optimized the design of icons including CloseCircleFilled/CloseSquareFilled/CloseOutlined/CloseCircleOutlined/CloseSquareOutlined/ExportOutlined/ImportOutlined. [824500](https://github.com/ant-design/ant-design-icons/commit/824500349894a87562f033dbdc5e3c5d301a2f5c)
- 💄 Fix when using with other component libraries that use `@ant-design/cssinjs`, antd styles will always be inserted at the top to avoid style override issues caused by loading order. [#43847](https://github.com/ant-design/ant-design/pull/43847)
- 💄 Optimize message and notification to not to extract style in SSR. [#43808](https://github.com/ant-design/ant-design/pull/43808)
- ⌨️ Fix Select `aria-activedescendant` didn't conform to valid value. [#43800](https://github.com/ant-design/ant-design/pull/43800)
- ⌨️ Fix `Layout.Header` accessibility role. [#43749](https://github.com/ant-design/ant-design/pull/43749) [@khalibloo](https://github.com/khalibloo)
- TypeScript
- 🤖 `Form.Item` support for generic pairs `name` props verification. [#43904](https://github.com/ant-design/ant-design/pull/43904) [@crazyair](https://github.com/crazyair)

## 5.7.3

`2023-07-24`
Expand Down
Loading

0 comments on commit a4212f4

Please sign in to comment.