@gravity-ui/aikit 0.6.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/atoms/ActionButton/__stories__/ActionButton.stories.d.ts +8 -0
- package/dist/components/atoms/ActionButton/__stories__/ActionButton.stories.js +48 -0
- package/dist/components/atoms/Alert/__stories__/Alert.stories.d.ts +10 -0
- package/dist/components/atoms/Alert/__stories__/Alert.stories.js +72 -0
- package/dist/components/atoms/ChatDate/__stories__/ChatDate.stories.d.ts +16 -0
- package/dist/components/atoms/ChatDate/__stories__/ChatDate.stories.js +83 -0
- package/dist/components/atoms/ContextIndicator/__stories__/ContextIndicator.stories.d.ts +17 -0
- package/dist/components/atoms/ContextIndicator/__stories__/ContextIndicator.stories.js +72 -0
- package/dist/components/atoms/ContextItem/__stories__/ContextItem.stories.d.ts +8 -0
- package/dist/components/atoms/ContextItem/__stories__/ContextItem.stories.js +36 -0
- package/dist/components/atoms/DiffStat/__stories__/DiffStat.stories.d.ts +8 -0
- package/dist/components/atoms/DiffStat/__stories__/DiffStat.stories.js +45 -0
- package/dist/components/atoms/Disclaimer/__stories__/Disclaimer.stories.d.ts +12 -0
- package/dist/components/atoms/Disclaimer/__stories__/Disclaimer.stories.js +64 -0
- package/dist/components/atoms/Loader/__stories__/Loader.stories.d.ts +8 -0
- package/dist/components/atoms/Loader/__stories__/Loader.stories.js +47 -0
- package/dist/components/atoms/MarkdownRenderer/__stories__/MarkdownRenderer.stories.d.ts +6 -0
- package/dist/components/atoms/MarkdownRenderer/__stories__/MarkdownRenderer.stories.js +49 -0
- package/dist/components/atoms/MessageBalloon/__stories__/MessageBalloon.stories.d.ts +6 -0
- package/dist/components/atoms/MessageBalloon/__stories__/MessageBalloon.stories.js +32 -0
- package/dist/components/atoms/Shimmer/__stories__/Shimmer.stories.d.ts +5 -0
- package/dist/components/atoms/Shimmer/__stories__/Shimmer.stories.js +28 -0
- package/dist/components/atoms/SubmitButton/__stories__/SubmitButton.stories.d.ts +13 -0
- package/dist/components/atoms/SubmitButton/__stories__/SubmitButton.stories.js +98 -0
- package/dist/components/atoms/ToolIndicator/__stories__/ToolIndicator.stories.d.ts +9 -0
- package/dist/components/atoms/ToolIndicator/__stories__/ToolIndicator.stories.js +34 -0
- package/dist/components/molecules/BaseMessage/__stories__/BaseMessage.stories.d.ts +9 -0
- package/dist/components/molecules/BaseMessage/__stories__/BaseMessage.stories.js +77 -0
- package/dist/components/molecules/BaseMessage/index.d.ts +1 -1
- package/dist/components/molecules/BaseMessage/index.js +51 -20
- package/dist/components/molecules/ButtonGroup/__stories__/ButtonGroup.stories.d.ts +6 -0
- package/dist/components/molecules/ButtonGroup/__stories__/ButtonGroup.stories.js +44 -0
- package/dist/components/molecules/PromptInputBody/__stories__/PromptInputBody.stories.d.ts +11 -0
- package/dist/components/molecules/PromptInputBody/__stories__/PromptInputBody.stories.js +62 -0
- package/dist/components/molecules/PromptInputFooter/__stories__/PromptInputFooter.stories.d.ts +11 -0
- package/dist/components/molecules/PromptInputFooter/__stories__/PromptInputFooter.stories.js +96 -0
- package/dist/components/molecules/PromptInputHeader/__stories__/PromptInputHeader.stories.d.ts +15 -0
- package/dist/components/molecules/PromptInputHeader/__stories__/PromptInputHeader.stories.js +123 -0
- package/dist/components/molecules/PromptInputPanel/__stories__/PromptInputPanel.stories.d.ts +8 -0
- package/dist/components/molecules/PromptInputPanel/__stories__/PromptInputPanel.stories.js +38 -0
- package/dist/components/molecules/Suggestions/__stories__/Suggestions.stories.d.ts +22 -0
- package/dist/components/molecules/Suggestions/__stories__/Suggestions.stories.js +182 -0
- package/dist/components/molecules/Tabs/__stories__/Tabs.stories.d.ts +9 -0
- package/dist/components/molecules/Tabs/__stories__/Tabs.stories.js +103 -0
- package/dist/components/molecules/ToolFooter/__stories__/ToolFooter.stories.d.ts +7 -0
- package/dist/components/molecules/ToolFooter/__stories__/ToolFooter.stories.js +58 -0
- package/dist/components/molecules/ToolFooter/index.js +8 -1
- package/dist/components/molecules/ToolHeader/__stories__/ToolHeader.stories.d.ts +8 -0
- package/dist/components/molecules/ToolHeader/__stories__/ToolHeader.stories.js +59 -0
- package/dist/components/molecules/ToolHeader/index.js +10 -1
- package/dist/components/molecules/ToolStatus/__stories__/ToolStatus.stories.d.ts +9 -0
- package/dist/components/molecules/ToolStatus/__stories__/ToolStatus.stories.js +44 -0
- package/dist/components/organisms/AssistantMessage/__stories__/AssistantMessage.stories.d.ts +13 -0
- package/dist/components/organisms/AssistantMessage/__stories__/AssistantMessage.stories.js +151 -0
- package/dist/components/organisms/Header/Header.js +16 -17
- package/dist/components/organisms/Header/__stories__/Header.stories.d.ts +15 -0
- package/dist/components/organisms/Header/__stories__/Header.stories.js +159 -0
- package/dist/components/organisms/Header/types.d.ts +2 -3
- package/dist/components/organisms/Header/useHeader.d.ts +2 -4
- package/dist/components/organisms/Header/useHeader.js +2 -24
- package/dist/components/organisms/MessageList/MessageList.js +5 -6
- package/dist/components/organisms/MessageList/__stories__/MessageList.stories.d.ts +25 -0
- package/dist/components/organisms/MessageList/__stories__/MessageList.stories.js +340 -0
- package/dist/components/organisms/PromptInput/__stories__/PromptInput.stories.d.ts +19 -0
- package/dist/components/organisms/PromptInput/__stories__/PromptInput.stories.js +304 -0
- package/dist/components/organisms/ThinkingMessage/__stories__/ThinkingMessage.stories.d.ts +12 -0
- package/dist/components/organisms/ThinkingMessage/__stories__/ThinkingMessage.stories.js +105 -0
- package/dist/components/organisms/ToolMessage/__stories__/ToolMessage.stories.d.ts +11 -0
- package/dist/components/organisms/ToolMessage/__stories__/ToolMessage.stories.js +70 -0
- package/dist/components/organisms/UserMessage/__stories__/UserMessage.stories.d.ts +9 -0
- package/dist/components/organisms/UserMessage/__stories__/UserMessage.stories.js +118 -0
- package/dist/components/pages/ChatContainer/__stories__/ChatContainer.stories.d.ts +79 -0
- package/dist/components/pages/ChatContainer/__stories__/ChatContainer.stories.js +1006 -0
- package/dist/components/templates/ChatContent/__stories__/ChatContent.stories.d.ts +14 -0
- package/dist/components/templates/ChatContent/__stories__/ChatContent.stories.js +315 -0
- package/dist/components/templates/EmptyContainer/__stories__/EmptyContainer.stories.d.ts +20 -0
- package/dist/components/templates/EmptyContainer/__stories__/EmptyContainer.stories.js +250 -0
- package/dist/components/templates/History/ChatItem.d.ts +2 -2
- package/dist/components/templates/History/ChatItem.js +2 -5
- package/dist/components/templates/History/History.scss +13 -9
- package/dist/components/templates/History/HistoryList.d.ts +3 -1
- package/dist/components/templates/History/HistoryList.js +9 -5
- package/dist/components/templates/History/__stories__/History.stories.d.ts +18 -0
- package/dist/components/templates/History/__stories__/History.stories.js +289 -0
- package/dist/demo/ContentWrapper/ContentWrapper.d.ts +4 -0
- package/dist/demo/ContentWrapper/ContentWrapper.js +9 -0
- package/dist/demo/ContentWrapper/index.d.ts +1 -0
- package/dist/demo/ContentWrapper/index.js +1 -0
- package/dist/demo/Showcase/Showcase.d.ts +9 -0
- package/dist/demo/Showcase/Showcase.js +7 -0
- package/dist/demo/Showcase/index.d.ts +1 -0
- package/dist/demo/Showcase/index.js +1 -0
- package/dist/demo/ShowcaseItem/ShowcaseItem.d.ts +8 -0
- package/dist/demo/ShowcaseItem/ShowcaseItem.js +7 -0
- package/dist/demo/ShowcaseItem/index.d.ts +1 -0
- package/dist/demo/ShowcaseItem/index.js +1 -0
- package/dist/demo/SwapArea/SwapArea.d.ts +2 -0
- package/dist/demo/SwapArea/SwapArea.js +7 -0
- package/dist/demo/SwapArea/index.d.ts +1 -0
- package/dist/demo/SwapArea/index.js +1 -0
- package/dist/hooks/useSmartScroll.d.ts +7 -2
- package/dist/hooks/useSmartScroll.js +24 -22
- package/dist/types/common.d.ts +13 -5
- package/dist/types/messages.d.ts +9 -6
- package/dist/utils/actionUtils.d.ts +14 -0
- package/dist/utils/actionUtils.js +17 -0
- package/dist/utils/messageUtils.d.ts +7 -9
- package/dist/utils/messageUtils.js +7 -1
- package/package.json +12 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { ActionButton } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof ActionButton>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
export declare const WithoutTooltip: Story;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Copy, Pencil } from '@gravity-ui/icons';
|
|
3
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
4
|
+
import { ActionButton } from '..';
|
|
5
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
6
|
+
import MDXDocs from './Docs.mdx';
|
|
7
|
+
export default {
|
|
8
|
+
title: 'atoms/ActionButton',
|
|
9
|
+
component: ActionButton,
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: MDXDocs,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const defaultDecorators = [
|
|
17
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Story, {}) })),
|
|
18
|
+
];
|
|
19
|
+
const mockOnClick = () => {
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
console.log('Button clicked');
|
|
22
|
+
};
|
|
23
|
+
export const Playground = {
|
|
24
|
+
args: {
|
|
25
|
+
tooltipTitle: 'Copy',
|
|
26
|
+
view: 'flat',
|
|
27
|
+
size: 'm',
|
|
28
|
+
children: _jsx(Icon, { data: Copy, size: 16 }),
|
|
29
|
+
onClick: mockOnClick,
|
|
30
|
+
},
|
|
31
|
+
decorators: defaultDecorators,
|
|
32
|
+
};
|
|
33
|
+
export const Default = {
|
|
34
|
+
args: {
|
|
35
|
+
tooltipTitle: 'Edit',
|
|
36
|
+
children: _jsx(Icon, { data: Pencil, size: 16 }),
|
|
37
|
+
onClick: mockOnClick,
|
|
38
|
+
},
|
|
39
|
+
decorators: defaultDecorators,
|
|
40
|
+
};
|
|
41
|
+
export const WithoutTooltip = {
|
|
42
|
+
args: {
|
|
43
|
+
children: _jsx(Icon, { data: Copy, size: 16 }),
|
|
44
|
+
view: 'outlined',
|
|
45
|
+
onClick: mockOnClick,
|
|
46
|
+
},
|
|
47
|
+
decorators: defaultDecorators,
|
|
48
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { AlertProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<AlertProps>;
|
|
6
|
+
export declare const Variant: StoryObj<AlertProps>;
|
|
7
|
+
export declare const Action: StoryFn<AlertProps>;
|
|
8
|
+
export declare const LongText: StoryFn<AlertProps>;
|
|
9
|
+
export declare const CustomIcon: StoryFn<AlertProps>;
|
|
10
|
+
export declare const CollapsibleWithLongContent: StoryFn<AlertProps>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Arrows3RotateLeft } from '@gravity-ui/icons';
|
|
3
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
4
|
+
import { Alert } from '..';
|
|
5
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
6
|
+
import { Showcase } from '../../../../demo/Showcase';
|
|
7
|
+
import { ShowcaseItem } from '../../../../demo/ShowcaseItem';
|
|
8
|
+
import MDXDocs from './Docs.mdx';
|
|
9
|
+
export default {
|
|
10
|
+
title: 'atoms/Alert',
|
|
11
|
+
component: Alert,
|
|
12
|
+
parameters: {
|
|
13
|
+
docs: {
|
|
14
|
+
page: MDXDocs,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
className: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Additional CSS class',
|
|
21
|
+
},
|
|
22
|
+
qa: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'QA/test identifier',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const defaultDecorators = [
|
|
29
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
|
|
30
|
+
];
|
|
31
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(Alert, Object.assign({}, args)) }));
|
|
32
|
+
Playground.args = {
|
|
33
|
+
text: 'Alert message',
|
|
34
|
+
variant: 'default',
|
|
35
|
+
};
|
|
36
|
+
export const Variant = {
|
|
37
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Default", children: _jsx(Alert, Object.assign({}, args, { variant: "default" })) }), _jsx(ShowcaseItem, { title: "Info", children: _jsx(Alert, Object.assign({}, args, { variant: "info" })) }), _jsx(ShowcaseItem, { title: "Warning", children: _jsx(Alert, Object.assign({}, args, { variant: "warning" })) }), _jsx(ShowcaseItem, { title: "Error", children: _jsx(Alert, Object.assign({}, args, { variant: "error" })) })] })),
|
|
38
|
+
decorators: defaultDecorators,
|
|
39
|
+
args: { text: 'Alert message' },
|
|
40
|
+
};
|
|
41
|
+
export const Action = (args) => (_jsx(ContentWrapper, { children: _jsx(Alert, Object.assign({}, args, { button: { content: 'Retry', onClick: () => ({}) } })) }));
|
|
42
|
+
Action.args = {
|
|
43
|
+
text: 'Alert message',
|
|
44
|
+
variant: 'default',
|
|
45
|
+
};
|
|
46
|
+
export const LongText = (args) => (_jsx(ContentWrapper, { children: _jsx(Alert, Object.assign({}, args, { button: { content: 'Retry', onClick: () => ({}) } })) }));
|
|
47
|
+
LongText.args = {
|
|
48
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
|
|
49
|
+
variant: 'warning',
|
|
50
|
+
};
|
|
51
|
+
export const CustomIcon = (args) => (_jsx(ContentWrapper, { children: _jsx(Alert, Object.assign({}, args, { icon: _jsx(Icon, { data: Arrows3RotateLeft, size: 20 }) })) }));
|
|
52
|
+
CustomIcon.args = {
|
|
53
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
|
|
54
|
+
variant: 'default',
|
|
55
|
+
button: { content: 'Retry', onClick: () => ({}) },
|
|
56
|
+
};
|
|
57
|
+
export const CollapsibleWithLongContent = (args) => (_jsx(ContentWrapper, { width: "430px", children: _jsx(Alert, Object.assign({}, args, { text: "Error occurred", initialExpanded: true, variant: "error", button: { content: 'Retry', onClick: () => ({}) }, content: _jsxs("div", { children: [_jsx("p", { children: "Full error log:" }), _jsx("pre", { style: {
|
|
58
|
+
margin: 0,
|
|
59
|
+
fontSize: '12px',
|
|
60
|
+
maxHeight: '200px',
|
|
61
|
+
overflow: 'auto',
|
|
62
|
+
}, children: `[2024-01-15 10:23:45] ERROR: Connection failed
|
|
63
|
+
[2024-01-15 10:23:45] DEBUG: Attempting to reconnect...
|
|
64
|
+
[2024-01-15 10:23:46] ERROR: Reconnection failed
|
|
65
|
+
[2024-01-15 10:23:46] DEBUG: Retrying in 5 seconds...
|
|
66
|
+
[2024-01-15 10:23:51] ERROR: Connection timeout
|
|
67
|
+
[2024-01-15 10:23:51] DEBUG: Stack trace:
|
|
68
|
+
at ConnectionManager.connect (connection.js:45)
|
|
69
|
+
at NetworkHandler.handleRequest (network.js:123)
|
|
70
|
+
at API.request (api.js:67)
|
|
71
|
+
at UserService.fetchData (user.js:23)
|
|
72
|
+
at Component.loadUser (component.js:10)` })] }) })) }));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { ChatDateProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<ChatDateProps>;
|
|
6
|
+
export declare const DateString: StoryFn<ChatDateProps>;
|
|
7
|
+
export declare const DateObject: StoryFn<ChatDateProps>;
|
|
8
|
+
export declare const Timestamp: StoryFn<ChatDateProps>;
|
|
9
|
+
export declare const WithTime: StoryFn<ChatDateProps>;
|
|
10
|
+
export declare const CustomFormat: StoryFn<ChatDateProps>;
|
|
11
|
+
export declare const CustomFormatWithTime: StoryFn<ChatDateProps>;
|
|
12
|
+
export declare const WithCustomStyle: StoryFn<ChatDateProps>;
|
|
13
|
+
export declare const DifferentFormats: StoryObj<ChatDateProps>;
|
|
14
|
+
export declare const DifferentDateTypes: StoryObj<ChatDateProps>;
|
|
15
|
+
export declare const RecentDates: StoryObj<ChatDateProps>;
|
|
16
|
+
export declare const InvalidDate: StoryFn<ChatDateProps>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChatDate } from '..';
|
|
3
|
+
import { RELATIVE_DATE_THRESHOLD } from '../../../../constants';
|
|
4
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
5
|
+
import { Showcase } from '../../../../demo/Showcase';
|
|
6
|
+
import { ShowcaseItem } from '../../../../demo/ShowcaseItem';
|
|
7
|
+
import MDXDocs from './Docs.mdx';
|
|
8
|
+
export default {
|
|
9
|
+
title: 'atoms/ChatDate',
|
|
10
|
+
component: ChatDate,
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
page: MDXDocs,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
date: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'Date value in string, Date, or number (timestamp) format',
|
|
20
|
+
},
|
|
21
|
+
format: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Custom format string (dayjs format)',
|
|
24
|
+
},
|
|
25
|
+
className: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'Additional CSS class',
|
|
28
|
+
},
|
|
29
|
+
qa: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'QA/test identifier',
|
|
32
|
+
},
|
|
33
|
+
style: {
|
|
34
|
+
control: 'object',
|
|
35
|
+
description: 'Inline styles for the component',
|
|
36
|
+
},
|
|
37
|
+
locale: {
|
|
38
|
+
control: 'text',
|
|
39
|
+
description: 'Locale for date formatting',
|
|
40
|
+
},
|
|
41
|
+
relative: {
|
|
42
|
+
control: 'boolean',
|
|
43
|
+
description: 'Display relative dates (today, yesterday, two days ago, etc.)',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const defaultDecorators = [
|
|
48
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
|
|
49
|
+
];
|
|
50
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args)) }));
|
|
51
|
+
Playground.args = {
|
|
52
|
+
date: new Date().toISOString(),
|
|
53
|
+
};
|
|
54
|
+
export const DateString = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z" })) }));
|
|
55
|
+
export const DateObject = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: new Date(2024, 0, 15, 10, 30) })) }));
|
|
56
|
+
export const Timestamp = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: 1705312200000 })) }));
|
|
57
|
+
export const WithTime = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", showTime: true })) }));
|
|
58
|
+
export const CustomFormat = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", format: "DD/MM/YYYY" })) }));
|
|
59
|
+
export const CustomFormatWithTime = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", format: "DD/MM/YYYY HH:mm", showTime: true })) }));
|
|
60
|
+
export const WithCustomStyle = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", style: { color: 'red', fontWeight: 'bold', fontSize: '18px' } })) }));
|
|
61
|
+
export const DifferentFormats = {
|
|
62
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Default", children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z" })) }), _jsx(ShowcaseItem, { title: "DD/MM/YYYY", children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", format: "DD/MM/YYYY" })) }), _jsx(ShowcaseItem, { title: "MM-DD-YYYY", children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", format: "MM-DD-YYYY" })) }), _jsx(ShowcaseItem, { title: "YYYY/MM/DD HH-mm", children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", format: "YYYY/MM/DD HH-mm", showTime: true })) })] })),
|
|
63
|
+
decorators: defaultDecorators,
|
|
64
|
+
};
|
|
65
|
+
export const DifferentDateTypes = {
|
|
66
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "ISO String", children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z" })) }), _jsx(ShowcaseItem, { title: "Date Object", children: _jsx(ChatDate, Object.assign({}, args, { date: new Date(2024, 0, 15, 10, 30) })) }), _jsx(ShowcaseItem, { title: "Timestamp", children: _jsx(ChatDate, Object.assign({}, args, { date: 1705312200000 })) })] })),
|
|
67
|
+
decorators: defaultDecorators,
|
|
68
|
+
};
|
|
69
|
+
export const RecentDates = {
|
|
70
|
+
render: (args) => {
|
|
71
|
+
const today = new Date('2025-11-11T10:19:59.971Z');
|
|
72
|
+
const getTitle = (daysAgo) => {
|
|
73
|
+
return daysAgo ? `[ + ${daysAgo} ]` : `[ 0 ]`;
|
|
74
|
+
};
|
|
75
|
+
return (_jsx(_Fragment, { children: Array.from({ length: RELATIVE_DATE_THRESHOLD + 1 }, (_, i) => {
|
|
76
|
+
const date = new Date(today);
|
|
77
|
+
date.setDate(date.getDate() - i);
|
|
78
|
+
return (_jsx(ShowcaseItem, { title: getTitle(i), children: _jsx(ChatDate, Object.assign({}, args, { date: date, relative: true })) }, i));
|
|
79
|
+
}) }));
|
|
80
|
+
},
|
|
81
|
+
decorators: defaultDecorators,
|
|
82
|
+
};
|
|
83
|
+
export const InvalidDate = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "invalid-date-string" })) }));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { type ContextIndicatorProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<ContextIndicatorProps>;
|
|
6
|
+
export declare const Empty: StoryFn<ContextIndicatorProps>;
|
|
7
|
+
export declare const Quarter: StoryFn<ContextIndicatorProps>;
|
|
8
|
+
export declare const Half: StoryFn<ContextIndicatorProps>;
|
|
9
|
+
export declare const ThreeQuarters: StoryFn<ContextIndicatorProps>;
|
|
10
|
+
export declare const Full: StoryFn<ContextIndicatorProps>;
|
|
11
|
+
export declare const WithNumber: StoryFn<ContextIndicatorProps>;
|
|
12
|
+
export declare const WithNumberHalf: StoryFn<ContextIndicatorProps>;
|
|
13
|
+
export declare const AllStates: StoryFn<ContextIndicatorProps>;
|
|
14
|
+
export declare const VerticalOrientation: StoryFn<ContextIndicatorProps>;
|
|
15
|
+
export declare const VerticalWithNumber: StoryFn<ContextIndicatorProps>;
|
|
16
|
+
export declare const AllReversedVariants: StoryFn<ContextIndicatorProps>;
|
|
17
|
+
export declare const GrayColors: StoryFn<ContextIndicatorProps>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ContextIndicator } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'atoms/ContextIndicator',
|
|
7
|
+
component: ContextIndicator,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
type: {
|
|
15
|
+
control: 'radio',
|
|
16
|
+
options: ['number', 'percent'],
|
|
17
|
+
description: 'Whether to use direct percentage or calculate from numbers',
|
|
18
|
+
},
|
|
19
|
+
usedContext: {
|
|
20
|
+
control: 'number',
|
|
21
|
+
description: 'Current context usage (percentage or absolute number)',
|
|
22
|
+
},
|
|
23
|
+
maxContext: {
|
|
24
|
+
control: 'number',
|
|
25
|
+
description: 'Maximum context available (only for type="number")',
|
|
26
|
+
if: { arg: 'type', eq: 'number' },
|
|
27
|
+
},
|
|
28
|
+
orientation: {
|
|
29
|
+
control: 'radio',
|
|
30
|
+
options: ['horizontal', 'vertical'],
|
|
31
|
+
description: 'Layout orientation of the indicator',
|
|
32
|
+
},
|
|
33
|
+
reversed: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Reverses the order of value and progress bar',
|
|
36
|
+
},
|
|
37
|
+
className: {
|
|
38
|
+
control: 'text',
|
|
39
|
+
description: 'Additional CSS class',
|
|
40
|
+
},
|
|
41
|
+
qa: {
|
|
42
|
+
control: 'text',
|
|
43
|
+
description: 'QA/test identifier',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args)) }));
|
|
48
|
+
Playground.args = {
|
|
49
|
+
type: 'number',
|
|
50
|
+
usedContext: 50,
|
|
51
|
+
maxContext: 100,
|
|
52
|
+
};
|
|
53
|
+
export const Empty = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0 })) }));
|
|
54
|
+
export const Quarter = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25 })) }));
|
|
55
|
+
export const Half = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50 })) }));
|
|
56
|
+
export const ThreeQuarters = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75 })) }));
|
|
57
|
+
export const Full = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100 })) }));
|
|
58
|
+
export const WithNumber = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "number", usedContext: 50, maxContext: 100 })) }));
|
|
59
|
+
export const WithNumberHalf = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "number", usedContext: 500, maxContext: 1000 })) }));
|
|
60
|
+
export const AllStates = (args) => (_jsx(ContentWrapper, { children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center' }, children: [_jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100 })) })] }) }));
|
|
61
|
+
export const VerticalOrientation = (args) => (_jsx(ContentWrapper, { children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'flex-end' }, children: [_jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0, orientation: "vertical" })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25, orientation: "vertical" })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50, orientation: "vertical" })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75, orientation: "vertical" })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100, orientation: "vertical" }))] }) }));
|
|
62
|
+
export const VerticalWithNumber = (args) => (_jsx(ContentWrapper, { children: _jsx("div", { style: { display: 'flex', gap: '16px', alignItems: 'flex-end' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "number", usedContext: 500, maxContext: 1000, orientation: "vertical" })) }) }));
|
|
63
|
+
export const AllReversedVariants = (args) => (_jsx(ContentWrapper, { children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '32px' }, children: [_jsxs("div", { children: [_jsx("h4", { style: { marginBottom: '16px' }, children: "Horizontal Reversed" }), _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center' }, children: [_jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0, reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25, reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50, reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75, reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100, reversed: true }))] })] }), _jsxs("div", { children: [_jsx("h4", { style: { marginBottom: '16px' }, children: "Vertical Reversed" }), _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'flex-start' }, children: [_jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0, orientation: "vertical", reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25, orientation: "vertical", reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50, orientation: "vertical", reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75, orientation: "vertical", reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100, orientation: "vertical", reversed: true }))] })] })] }) }));
|
|
64
|
+
export const GrayColors = (args) => (_jsx(ContentWrapper, { children: _jsxs("div", { style: {
|
|
65
|
+
display: 'flex',
|
|
66
|
+
gap: '16px',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
// Override all progress colors to gray
|
|
69
|
+
['--g-aikit-ci-color-progress-1']: '#999999',
|
|
70
|
+
['--g-aikit-ci-color-progress-2']: '#999999',
|
|
71
|
+
['--g-aikit-ci-color-progress-3']: '#999999',
|
|
72
|
+
}, children: [_jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100 })) })] }) }));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
3
|
+
import { ContextItem } from '..';
|
|
4
|
+
type ContextItemProps = React.ComponentProps<typeof ContextItem>;
|
|
5
|
+
declare const _default: Meta;
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare const Playground: StoryFn<ContextItemProps>;
|
|
8
|
+
export declare const WithoutRemoveButton: StoryFn<ContextItemProps>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ContextItem } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'atoms/ContextItem',
|
|
7
|
+
component: ContextItem,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
content: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Content of label',
|
|
17
|
+
},
|
|
18
|
+
className: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Additional CSS class',
|
|
21
|
+
},
|
|
22
|
+
qa: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'QA/test identifier',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextItem, Object.assign({}, args)) }));
|
|
29
|
+
Playground.args = {
|
|
30
|
+
content: 'My context',
|
|
31
|
+
onClick: () => { },
|
|
32
|
+
};
|
|
33
|
+
export const WithoutRemoveButton = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextItem, Object.assign({}, args)) }));
|
|
34
|
+
WithoutRemoveButton.args = {
|
|
35
|
+
content: 'My context without remove',
|
|
36
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
3
|
+
import { DiffStat } from '..';
|
|
4
|
+
type DiffStatProps = React.ComponentProps<typeof DiffStat>;
|
|
5
|
+
declare const _default: Meta;
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare const Playground: StoryFn<DiffStatProps>;
|
|
8
|
+
export declare const Lengths: StoryObj<typeof DiffStat>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { DiffStat } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import { Showcase } from '../../../../demo/Showcase';
|
|
5
|
+
import { ShowcaseItem } from '../../../../demo/ShowcaseItem';
|
|
6
|
+
import MDXDocs from './Docs.mdx';
|
|
7
|
+
export default {
|
|
8
|
+
title: 'atoms/DiffStat',
|
|
9
|
+
component: DiffStat,
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: MDXDocs,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
added: {
|
|
17
|
+
control: 'number',
|
|
18
|
+
description: 'Number of added lines',
|
|
19
|
+
},
|
|
20
|
+
deleted: {
|
|
21
|
+
control: 'number',
|
|
22
|
+
description: 'Number of deleted lines',
|
|
23
|
+
},
|
|
24
|
+
className: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Additional CSS class',
|
|
27
|
+
},
|
|
28
|
+
qa: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
description: 'QA/test identifier',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const defaultDecorators = [
|
|
35
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
|
|
36
|
+
];
|
|
37
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(DiffStat, Object.assign({}, args)) }));
|
|
38
|
+
Playground.args = {
|
|
39
|
+
added: 10,
|
|
40
|
+
deleted: 5,
|
|
41
|
+
};
|
|
42
|
+
export const Lengths = {
|
|
43
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Digits", children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }, children: [_jsx(DiffStat, Object.assign({}, args, { added: 0, deleted: 0 })), _jsx(DiffStat, Object.assign({}, args, { added: 0, deleted: 1 })), _jsx(DiffStat, Object.assign({}, args, { added: 1, deleted: 0 })), _jsx(DiffStat, Object.assign({}, args, { added: 1, deleted: 1 })), _jsx(DiffStat, Object.assign({}, args, { added: 5, deleted: 3 })), _jsx(DiffStat, Object.assign({}, args, { added: 9, deleted: 9 }))] }) }), _jsx(ShowcaseItem, { title: "Tens", children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }, children: [_jsx(DiffStat, Object.assign({}, args, { added: 10, deleted: 0 })), _jsx(DiffStat, Object.assign({}, args, { added: 0, deleted: 10 })), _jsx(DiffStat, Object.assign({}, args, { added: 10, deleted: 10 })), _jsx(DiffStat, Object.assign({}, args, { added: 25, deleted: 15 })), _jsx(DiffStat, Object.assign({}, args, { added: 50, deleted: 30 })), _jsx(DiffStat, Object.assign({}, args, { added: 99, deleted: 99 }))] }) }), _jsx(ShowcaseItem, { title: "Hundreds", children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }, children: [_jsx(DiffStat, Object.assign({}, args, { added: 100, deleted: 0 })), _jsx(DiffStat, Object.assign({}, args, { added: 0, deleted: 100 })), _jsx(DiffStat, Object.assign({}, args, { added: 100, deleted: 100 })), _jsx(DiffStat, Object.assign({}, args, { added: 250, deleted: 150 })), _jsx(DiffStat, Object.assign({}, args, { added: 500, deleted: 300 })), _jsx(DiffStat, Object.assign({}, args, { added: 999, deleted: 999 }))] }) }), _jsx(ShowcaseItem, { title: "Thousands", children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }, children: [_jsx(DiffStat, Object.assign({}, args, { added: 1000, deleted: 0 })), _jsx(DiffStat, Object.assign({}, args, { added: 0, deleted: 1000 })), _jsx(DiffStat, Object.assign({}, args, { added: 1000, deleted: 1000 })), _jsx(DiffStat, Object.assign({}, args, { added: 2500, deleted: 1500 })), _jsx(DiffStat, Object.assign({}, args, { added: 5000, deleted: 3000 })), _jsx(DiffStat, Object.assign({}, args, { added: 12345, deleted: 6789 }))] }) })] })),
|
|
44
|
+
decorators: defaultDecorators,
|
|
45
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { DisclaimerProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<DisclaimerProps>;
|
|
6
|
+
export declare const WithText: StoryFn<DisclaimerProps>;
|
|
7
|
+
export declare const WithChildren: StoryFn<DisclaimerProps>;
|
|
8
|
+
export declare const WithTextAndChildren: StoryFn<DisclaimerProps>;
|
|
9
|
+
export declare const WithCaptionVariant: StoryFn<DisclaimerProps>;
|
|
10
|
+
export declare const WithBody2Variant: StoryFn<DisclaimerProps>;
|
|
11
|
+
export declare const WithSubheaderVariant: StoryFn<DisclaimerProps>;
|
|
12
|
+
export declare const AllVariants: StoryFn<DisclaimerProps>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Disclaimer } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'atoms/Disclaimer',
|
|
7
|
+
component: Disclaimer,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
text: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Disclaimer text',
|
|
17
|
+
},
|
|
18
|
+
variant: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: [
|
|
21
|
+
'body-1',
|
|
22
|
+
'body-2',
|
|
23
|
+
'body-3',
|
|
24
|
+
'body-short',
|
|
25
|
+
'caption-1',
|
|
26
|
+
'caption-2',
|
|
27
|
+
'subheader-1',
|
|
28
|
+
'subheader-2',
|
|
29
|
+
'subheader-3',
|
|
30
|
+
'header-1',
|
|
31
|
+
'header-2',
|
|
32
|
+
'display-1',
|
|
33
|
+
'display-2',
|
|
34
|
+
'display-3',
|
|
35
|
+
'display-4',
|
|
36
|
+
'code-1',
|
|
37
|
+
'code-2',
|
|
38
|
+
'code-3',
|
|
39
|
+
'code-inline-1',
|
|
40
|
+
'code-inline-2',
|
|
41
|
+
'code-inline-3',
|
|
42
|
+
'inherit',
|
|
43
|
+
],
|
|
44
|
+
description: 'Text variant for typography styling',
|
|
45
|
+
},
|
|
46
|
+
className: {
|
|
47
|
+
control: 'text',
|
|
48
|
+
description: 'Additional CSS class',
|
|
49
|
+
},
|
|
50
|
+
qa: {
|
|
51
|
+
control: 'text',
|
|
52
|
+
description: 'QA/test identifier',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(Disclaimer, Object.assign({}, args)) }));
|
|
57
|
+
Playground.args = { text: 'This is a disclaimer text' };
|
|
58
|
+
export const WithText = (args) => (_jsx(ContentWrapper, { children: _jsx(Disclaimer, Object.assign({}, args, { text: "This is an important disclaimer message" })) }));
|
|
59
|
+
export const WithChildren = (args) => (_jsx(ContentWrapper, { children: _jsx(Disclaimer, Object.assign({}, args, { children: _jsx("span", { children: "Custom content goes here" }) })) }));
|
|
60
|
+
export const WithTextAndChildren = (args) => (_jsx(ContentWrapper, { children: _jsx(Disclaimer, Object.assign({}, args, { text: "Disclaimer text", children: _jsx("span", { children: "Additional content" }) })) }));
|
|
61
|
+
export const WithCaptionVariant = (args) => (_jsx(ContentWrapper, { children: _jsx(Disclaimer, Object.assign({}, args, { text: "Small disclaimer with caption-2 variant", variant: "caption-2" })) }));
|
|
62
|
+
export const WithBody2Variant = (args) => (_jsx(ContentWrapper, { children: _jsx(Disclaimer, Object.assign({}, args, { text: "Larger disclaimer with body-2 variant", variant: "body-2" })) }));
|
|
63
|
+
export const WithSubheaderVariant = (args) => (_jsx(ContentWrapper, { children: _jsx(Disclaimer, Object.assign({}, args, { text: "Prominent disclaimer with subheader-1 variant", variant: "subheader-1" })) }));
|
|
64
|
+
export const AllVariants = (args) => (_jsx(ContentWrapper, { children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px' }, children: [_jsx(Disclaimer, Object.assign({}, args, { text: "caption-1: Smallest text", variant: "caption-1" })), _jsx(Disclaimer, Object.assign({}, args, { text: "caption-2: Small text", variant: "caption-2" })), _jsx(Disclaimer, Object.assign({}, args, { text: "body-1: Default body text", variant: "body-1" })), _jsx(Disclaimer, Object.assign({}, args, { text: "body-2: Larger body text", variant: "body-2" })), _jsx(Disclaimer, Object.assign({}, args, { text: "body-3: Large body text", variant: "body-3" })), _jsx(Disclaimer, Object.assign({}, args, { text: "subheader-1: Subheader text", variant: "subheader-1" })), _jsx(Disclaimer, Object.assign({}, args, { text: "subheader-2: Larger subheader", variant: "subheader-2" })), _jsx(Disclaimer, Object.assign({}, args, { text: "header-1: Header text", variant: "header-1" }))] }) }));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { LoaderProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<LoaderProps>;
|
|
6
|
+
export declare const Loading: StoryFn<LoaderProps>;
|
|
7
|
+
export declare const Streaming: StoryFn<LoaderProps>;
|
|
8
|
+
export declare const Size: StoryObj<LoaderProps>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Loader } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import { Showcase } from '../../../../demo/Showcase';
|
|
5
|
+
import { ShowcaseItem } from '../../../../demo/ShowcaseItem';
|
|
6
|
+
import MDXDocs from './Docs.mdx';
|
|
7
|
+
export default {
|
|
8
|
+
title: 'atoms/Loader',
|
|
9
|
+
component: Loader,
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: MDXDocs,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
view: {
|
|
17
|
+
control: 'radio',
|
|
18
|
+
options: ['streaming', 'loading'],
|
|
19
|
+
description: 'View',
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
control: 'radio',
|
|
23
|
+
options: ['xs', 's', 'm'],
|
|
24
|
+
description: 'Size of element',
|
|
25
|
+
},
|
|
26
|
+
className: {
|
|
27
|
+
control: 'text',
|
|
28
|
+
description: 'Additional CSS class',
|
|
29
|
+
},
|
|
30
|
+
qa: {
|
|
31
|
+
control: 'text',
|
|
32
|
+
description: 'QA/test identifier',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const defaultDecorators = [
|
|
37
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
|
|
38
|
+
];
|
|
39
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(Loader, Object.assign({}, args)) }));
|
|
40
|
+
Playground.args = { view: 'streaming', size: 's' };
|
|
41
|
+
export const Loading = (args) => (_jsx(ContentWrapper, { children: _jsx(Loader, Object.assign({}, args, { view: "loading" })) }));
|
|
42
|
+
export const Streaming = (args) => (_jsx(ContentWrapper, { children: _jsx(Loader, Object.assign({}, args, { view: "streaming" })) }));
|
|
43
|
+
export const Size = {
|
|
44
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Size xs", children: _jsx(Loader, Object.assign({}, args, { size: "xs" })) }), _jsx(ShowcaseItem, { title: "Size s", children: _jsx(Loader, Object.assign({}, args, { size: "s" })) }), _jsx(ShowcaseItem, { title: "Size m", children: _jsx(Loader, Object.assign({}, args, { size: "m" })) })] })),
|
|
45
|
+
decorators: defaultDecorators,
|
|
46
|
+
args: { view: 'streaming' },
|
|
47
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { MarkdownRendererProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<MarkdownRendererProps>;
|
|
6
|
+
export declare const WithTransformOptions: StoryFn<MarkdownRendererProps>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MarkdownRenderer } from '..';
|
|
3
|
+
import MDXDocs from './Docs.mdx';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'atoms/MarkdownRenderer',
|
|
6
|
+
component: MarkdownRenderer,
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
page: MDXDocs,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
content: {
|
|
14
|
+
control: 'text',
|
|
15
|
+
description: 'YFM markdown content to render',
|
|
16
|
+
},
|
|
17
|
+
className: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'Additional CSS class',
|
|
20
|
+
},
|
|
21
|
+
qa: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'QA/test identifier',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export const Playground = (args) => _jsx(MarkdownRenderer, Object.assign({}, args));
|
|
28
|
+
Playground.args = {
|
|
29
|
+
content: '# Hello World\n\nThis is **bold** text and this is *italic* text.',
|
|
30
|
+
};
|
|
31
|
+
export const WithTransformOptions = () => {
|
|
32
|
+
const customPlugin = ((md) => {
|
|
33
|
+
const defaultRender = md.renderer.rules.strong_open ||
|
|
34
|
+
function (tokens, idx, options, _env, self) {
|
|
35
|
+
return self.renderToken(tokens, idx, options);
|
|
36
|
+
};
|
|
37
|
+
// eslint-disable-next-line no-param-reassign
|
|
38
|
+
md.renderer.rules.strong_open = function (tokens, idx, options, _env, self) {
|
|
39
|
+
const token = tokens[idx];
|
|
40
|
+
token.attrSet('style', 'color: #ff6b6b; background-color: #fff5f5; padding: 2px 4px; border-radius: 3px;');
|
|
41
|
+
return defaultRender(tokens, idx, options, _env, self);
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
const transformOptions = {
|
|
45
|
+
plugins: [customPlugin],
|
|
46
|
+
};
|
|
47
|
+
const content = `# Custom Plugin Example\n\nThis is **bold text** with custom styling applied via plugin.`;
|
|
48
|
+
return _jsx(MarkdownRenderer, { content: content, transformOptions: transformOptions });
|
|
49
|
+
};
|