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

feat: New component Bubble #19

Merged
merged 35 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b307b6d
fix: fix
li-jia-nan Jun 7, 2024
e4a7df3
feat: 🔥 New Component: Chatbox
li-jia-nan Jun 8, 2024
d42b16d
fix: fix
li-jia-nan Jun 8, 2024
a61a470
fix: fix
li-jia-nan Jun 8, 2024
0aee8e4
Merge branch master into New-Component-ChatBox
li-jia-nan Jun 11, 2024
2c9e488
fix: fix
li-jia-nan Jun 11, 2024
aaaa35b
fix: fix
li-jia-nan Jun 11, 2024
da22514
docs: update cover
li-jia-nan Jun 19, 2024
75e3871
fix: fix
li-jia-nan Jul 16, 2024
2ae436c
fix: fix
li-jia-nan Jul 22, 2024
8fa514b
fix: fix
li-jia-nan Jul 22, 2024
ed64d4f
fix: fix
li-jia-nan Jul 25, 2024
d9ec0e8
fix: fix
li-jia-nan Jul 25, 2024
8af2b36
Merge branch 'master' into New-Component-ChatBox
li-jia-nan Jul 25, 2024
63bdb34
fix: fix
li-jia-nan Jul 25, 2024
a28baf0
fix: fix
li-jia-nan Jul 25, 2024
9a1f172
fix: fix
li-jia-nan Jul 25, 2024
ed20cf5
fix: fix
li-jia-nan Jul 25, 2024
8ffa44a
Merge branch 'master' into New-Component-ChatBox
li-jia-nan Jul 26, 2024
d1c4714
chore: rename to Bubble
li-jia-nan Jul 29, 2024
b82683b
Merge branch 'New-Component-ChatBox' of github.com:ant-design/x into …
li-jia-nan Jul 29, 2024
fff08b4
fix: fix
li-jia-nan Jul 29, 2024
07c12da
fix: fix
li-jia-nan Jul 29, 2024
4d411a6
fix: fix
li-jia-nan Jul 29, 2024
a4d0fdd
refactor: avatarProps
zombieJ Aug 1, 2024
c8ba8ad
docs: all use avatarProps
zombieJ Aug 1, 2024
ef0e549
chore: simplify
zombieJ Aug 1, 2024
ad5b2b2
test: update snapshot
zombieJ Aug 1, 2024
ea67c3e
demo: simplify
zombieJ Aug 1, 2024
7dc29c0
chore: fix lint
zombieJ Aug 2, 2024
a78ce53
chore: continue typing
zombieJ Aug 2, 2024
9ffa866
test: update snapshot
zombieJ Aug 2, 2024
c7d00a7
chore: fix lint
zombieJ Aug 2, 2024
07c7fea
Merge branch 'master' into New-Component-ChatBox
zombieJ Aug 2, 2024
7385390
docs: update demo
li-jia-nan Aug 2, 2024
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
138 changes: 75 additions & 63 deletions .dumi/components/SemanticPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,66 @@ import classnames from 'classnames';

const MARK_BORDER_SIZE = 2;

const useStyle = createStyles(({ token }, markPos: [number, number, number, number]) => ({
container: css`
position: relative;
`,
colWrap: css`
border-right: 1px solid ${token.colorBorderSecondary};
display: flex;
justify-content: center;
align-items: center;
padding: ${token.paddingMD}px;
overflow: hidden;
`,
listWrap: css`
display: flex;
flex-direction: column;
list-style: none;
margin: 0;
padding: 0;
overflow: hidden;
`,
listItem: css`
cursor: pointer;
padding: ${token.paddingSM}px;
transition: background-color ${token.motionDurationFast} ease;
&:hover {
background-color: ${token.controlItemBgHover};
}
&:not(:first-of-type) {
border-top: 1px solid ${token.colorBorderSecondary};
}
`,
marker: css`
position: absolute;
border: ${MARK_BORDER_SIZE}px solid ${token.colorWarning};
box-sizing: border-box;
z-index: 999999;
box-shadow: 0 0 0 1px #fff;
pointer-events: none;
left: ${markPos[0] - MARK_BORDER_SIZE}px;
top: ${markPos[1] - MARK_BORDER_SIZE}px;
width: ${markPos[2] + MARK_BORDER_SIZE * 2}px;
height: ${markPos[3] + MARK_BORDER_SIZE * 2}px;
`,
markerActive: css`
opacity: 1;
`,
markerNotActive: css`
opacity: 0;
`,
markerMotion: css`
transition:
opacity ${token.motionDurationSlow} ease,
all ${token.motionDurationSlow} ease;
`,
markerNotMotion: css`
transition: opacity ${token.motionDurationSlow} ease;
`,
}));
const useStyle = createStyles(
({ token }, markPos: [number, number, number, number]) => ({
container: css`
position: relative;
`,
colWrap: css`
border-right: 1px solid ${token.colorBorderSecondary};
display: flex;
justify-content: center;
align-items: center;
padding: ${token.paddingMD}px;
overflow: hidden;
`,
listWrap: css`
display: flex;
flex-direction: column;
list-style: none;
margin: 0;
padding: 0;
overflow: hidden;
`,
listItem: css`
cursor: pointer;
padding: ${token.paddingSM}px;
transition: background-color ${token.motionDurationFast} ease;
&:hover {
background-color: ${token.controlItemBgHover};
}
&:not(:first-of-type) {
border-top: 1px solid ${token.colorBorderSecondary};
}
`,
marker: css`
position: absolute;
border: ${MARK_BORDER_SIZE}px solid ${token.colorWarning};
box-sizing: border-box;
z-index: 999999;
box-shadow: 0 0 0 1px #fff;
pointer-events: none;
left: ${markPos[0] - MARK_BORDER_SIZE}px;
top: ${markPos[1] - MARK_BORDER_SIZE}px;
width: ${markPos[2] + MARK_BORDER_SIZE * 2}px;
height: ${markPos[3] + MARK_BORDER_SIZE * 2}px;
`,
markerActive: css`
opacity: 1;
`,
markerNotActive: css`
opacity: 0;
`,
markerMotion: css`
transition:
opacity ${token.motionDurationSlow} ease,
all ${token.motionDurationSlow} ease;
`,
markerNotMotion: css`
transition: opacity ${token.motionDurationSlow} ease;
`,
}),
);

export interface SemanticPreviewProps {
semantics: { name: string; desc: string; version?: string }[];
Expand Down Expand Up @@ -101,14 +103,18 @@ const SemanticPreview: React.FC<SemanticPreviewProps> = (props) => {

const [positionMotion, setPositionMotion] = React.useState<boolean>(false);
const [hoverSemantic, setHoverSemantic] = React.useState<string | null>(null);
const [markPos, setMarkPos] = React.useState<[number, number, number, number]>([0, 0, 0, 0]);
const [markPos, setMarkPos] = React.useState<
[number, number, number, number]
>([0, 0, 0, 0]);

const { styles } = useStyle(markPos);

React.useEffect(() => {
if (hoverSemantic) {
const targetClassName = getMarkClassName(hoverSemantic);
const targetElement = containerRef.current?.querySelector<HTMLElement>(`.${targetClassName}`);
const targetElement = containerRef.current?.querySelector<HTMLElement>(
`.${targetClassName}`,
);
const containerRect = containerRef.current?.getBoundingClientRect();
const targetRect = targetElement?.getBoundingClientRect();
setMarkPos([
Expand Down Expand Up @@ -137,7 +143,9 @@ const SemanticPreview: React.FC<SemanticPreviewProps> = (props) => {
<div className={classnames(styles.container)} ref={containerRef}>
<Row style={{ minHeight: height }}>
<Col span={16} className={classnames(styles.colWrap)}>
<ConfigProvider theme={{ token: { motion: false } }}>{cloneNode}</ConfigProvider>
<ConfigProvider theme={{ token: { motion: false } }}>
{cloneNode}
</ConfigProvider>
</Col>
<Col span={8}>
<ul className={classnames(styles.listWrap)}>
Expand All @@ -153,9 +161,13 @@ const SemanticPreview: React.FC<SemanticPreviewProps> = (props) => {
<Typography.Title level={5} style={{ margin: 0 }}>
{semantic.name}
</Typography.Title>
{semantic.version && <Tag color="blue">{semantic.version}</Tag>}
{semantic.version && (
<Tag color="blue">{semantic.version}</Tag>
)}
</Flex>
<Typography.Paragraph style={{ margin: 0, fontSize: token.fontSizeSM }}>
<Typography.Paragraph
style={{ margin: 0, fontSize: token.fontSizeSM }}
>
{semantic.desc}
</Typography.Paragraph>
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion .dumi/preset/components-changelog-cn.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"ChatBox":[]}
{"Chatbox":[]}
2 changes: 1 addition & 1 deletion .dumi/preset/components-changelog-en.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"ChatBox":[]}
{"Chatbox":[]}
1 change: 1 addition & 0 deletions components/_util/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type AnyObject = Record<PropertyKey, any>;
11 changes: 9 additions & 2 deletions components/_util/warning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ type BaseTypeWarning = (
) => void;

type TypeWarning = BaseTypeWarning & {
deprecated: (valid: boolean, oldProp: string, newProp: string, message?: string) => void;
deprecated: (
valid: boolean,
oldProp: string,
newProp: string,
message?: string,
) => void;
};

export interface WarningContextProps {
Expand Down Expand Up @@ -70,7 +75,9 @@ export const devUseWarning: (component: string) => TypeWarning =
deprecatedWarnList = {};
}

deprecatedWarnList[component] = deprecatedWarnList[component] || [];
deprecatedWarnList[component] =
deprecatedWarnList[component] || [];

if (!deprecatedWarnList[component].includes(message || '')) {
deprecatedWarnList[component].push(message || '');
}
Expand Down

This file was deleted.

7 changes: 0 additions & 7 deletions components/chat-box/__tests__/__snapshots__/demo.test.ts.snap

This file was deleted.

10 changes: 0 additions & 10 deletions components/chat-box/__tests__/index.test.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions components/chat-box/demo/basic.md

This file was deleted.

6 changes: 0 additions & 6 deletions components/chat-box/demo/basic.tsx

This file was deleted.

44 changes: 0 additions & 44 deletions components/chat-box/index.en-US.md

This file was deleted.

17 changes: 0 additions & 17 deletions components/chat-box/index.tsx

This file was deleted.

45 changes: 0 additions & 45 deletions components/chat-box/index.zh-CN.md

This file was deleted.

13 changes: 0 additions & 13 deletions components/chat-box/interface.ts

This file was deleted.

1 change: 0 additions & 1 deletion components/chat-box/style/index.ts

This file was deleted.

Loading
Loading