myshell-react-lib 0.1.4 → 0.1.6
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/index.cjs +52 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
- package/src/common/assets/audio-playing.json +0 -3657
- package/src/common/constants/constants.ts +0 -24
- package/src/common/constants/types/common.ts +0 -10
- package/src/common/hooks/useAudioPlayer.tsx +0 -198
- package/src/common/hooks/useDevice.ts +0 -26
- package/src/common/hooks/useNativeBridge.ts +0 -42
- package/src/common/hooks/useNotification.tsx +0 -179
- package/src/common/hooks/useWindowWidth.ts +0 -19
- package/src/common/utils/common-helper.ts +0 -81
- package/src/components/ItemDemo.tsx +0 -15
- package/src/components/accordion.tsx +0 -126
- package/src/components/alert-dialog.tsx +0 -148
- package/src/components/alert.tsx +0 -65
- package/src/components/aspect-ratio.tsx +0 -7
- package/src/components/audio-player.tsx +0 -60
- package/src/components/audio-playing.tsx +0 -33
- package/src/components/avatar.tsx +0 -133
- package/src/components/badge.tsx +0 -67
- package/src/components/button/button.styles.ts +0 -258
- package/src/components/button/button.tsx +0 -215
- package/src/components/button/icon-button.styles.ts +0 -101
- package/src/components/button/icon-button.tsx +0 -100
- package/src/components/button/index.tsx +0 -3
- package/src/components/button/link-button.tsx +0 -184
- package/src/components/cascader.tsx +0 -175
- package/src/components/checkbox.tsx +0 -135
- package/src/components/command.tsx +0 -155
- package/src/components/context-menu.tsx +0 -198
- package/src/components/count-down.tsx +0 -83
- package/src/components/custom-notification.tsx +0 -95
- package/src/components/dialog.tsx +0 -158
- package/src/components/drawer.tsx +0 -116
- package/src/components/dropdown-menu.tsx +0 -196
- package/src/components/energy-progress.tsx +0 -55
- package/src/components/form.tsx +0 -201
- package/src/components/group.tsx +0 -9
- package/src/components/guide.tsx +0 -243
- package/src/components/icon.tsx +0 -96
- package/src/components/icons/index.tsx +0 -13
- package/src/components/icons/outline/ArrowLeftIcon.tsx +0 -28
- package/src/components/icons/outline/ArrowUpTrayIcon.tsx +0 -28
- package/src/components/icons/outline/CheckCircleIcon.tsx +0 -27
- package/src/components/icons/outline/ConfigIcon.tsx +0 -42
- package/src/components/icons/outline/DownIcon.tsx +0 -18
- package/src/components/icons/outline/FilterIcon.tsx +0 -20
- package/src/components/icons/outline/PencilSquareIcon.tsx +0 -28
- package/src/components/icons/outline/WindowIcon.tsx +0 -26
- package/src/components/icons/solid/CaretDownIcon.tsx +0 -22
- package/src/components/icons/solid/CodeIcon.tsx +0 -25
- package/src/components/icons/solid/DragIcon.tsx +0 -24
- package/src/components/icons/solid/PhoneIcon.tsx +0 -29
- package/src/components/icons/solid/RectangleGroupIcon.tsx +0 -26
- package/src/components/image.tsx +0 -151
- package/src/components/input.tsx +0 -118
- package/src/components/label.tsx +0 -26
- package/src/components/link.tsx +0 -123
- package/src/components/marquee/index.css +0 -15
- package/src/components/marquee/marquee.tsx +0 -220
- package/src/components/masonry.tsx +0 -138
- package/src/components/menubar.tsx +0 -234
- package/src/components/mobile/m-tooltip.tsx +0 -34
- package/src/components/modal.tsx +0 -561
- package/src/components/navigation-bar.tsx +0 -100
- package/src/components/number-input.tsx +0 -143
- package/src/components/page-content.tsx +0 -16
- package/src/components/popover.tsx +0 -191
- package/src/components/progress.tsx +0 -80
- package/src/components/radio-group.tsx +0 -44
- package/src/components/scroll-area.tsx +0 -49
- package/src/components/search-bar.tsx +0 -140
- package/src/components/secondary-navigation-bar.tsx +0 -328
- package/src/components/select.tsx +0 -273
- package/src/components/separator.tsx +0 -31
- package/src/components/sheet.tsx +0 -143
- package/src/components/skeleton.tsx +0 -20
- package/src/components/slider.tsx +0 -160
- package/src/components/spinner.tsx +0 -50
- package/src/components/swiper/index.module.scss +0 -88
- package/src/components/swiper/index.tsx +0 -319
- package/src/components/switch.tsx +0 -67
- package/src/components/tabs.tsx +0 -325
- package/src/components/textarea.tsx +0 -71
- package/src/components/toast/toast.tsx +0 -182
- package/src/components/toast/toaster.tsx +0 -160
- package/src/components/toast/use-toast.tsx +0 -248
- package/src/components/toggle-group.tsx +0 -64
- package/src/components/toggle.tsx +0 -46
- package/src/components/tooltip.tsx +0 -283
- package/src/components/typography.tsx +0 -437
- package/src/index.ts +0 -70
- package/src/lib/utils.ts +0 -62
- package/src/stories/Accordion.stories.tsx +0 -64
- package/src/stories/AccordionItem.stories.tsx +0 -48
- package/src/stories/Avatar.stories.ts +0 -58
- package/src/stories/Badge.stories.tsx +0 -40
- package/src/stories/BannerSwiper.stories.tsx +0 -102
- package/src/stories/Button.stories.tsx +0 -543
- package/src/stories/Checkbox.stories.tsx +0 -161
- package/src/stories/Configure.mdx +0 -341
- package/src/stories/CssProperties.mdx +0 -30
- package/src/stories/Description.stories.ts +0 -70
- package/src/stories/Display.stories.ts +0 -64
- package/src/stories/FeaturedSwiper.stories.tsx +0 -6978
- package/src/stories/GridSwiper.stories.tsx +0 -1407
- package/src/stories/Guide.stories.tsx +0 -247
- package/src/stories/Heading.stories.ts +0 -89
- package/src/stories/Icon.stories.ts +0 -77
- package/src/stories/IconButton.stories.tsx +0 -301
- package/src/stories/IconTextButton.stories.ts +0 -59
- package/src/stories/Image.stories.ts +0 -55
- package/src/stories/Input.stories.tsx +0 -203
- package/src/stories/Modal.stories.tsx +0 -144
- package/src/stories/NavigationBar.stories.tsx +0 -81
- package/src/stories/Notification.stories.tsx +0 -276
- package/src/stories/Popover.stories.tsx +0 -100
- package/src/stories/SearchBar.stories.ts +0 -43
- package/src/stories/SecondaryNavigationBar.stories.tsx +0 -199
- package/src/stories/Select.stories.tsx +0 -107
- package/src/stories/Separator.stories.tsx +0 -49
- package/src/stories/Spinner.stories.tsx +0 -48
- package/src/stories/SubHeading.stories.ts +0 -64
- package/src/stories/Swich.stories.tsx +0 -69
- package/src/stories/Tabs.stories.tsx +0 -90
- package/src/stories/Text.stories.ts +0 -78
- package/src/stories/Textarea.stories.tsx +0 -155
- package/src/stories/Toast.stories.tsx +0 -424
- package/src/stories/Tooltip.stories.tsx +0 -244
- package/src/stories/ViewAutoSwiper.stories.tsx +0 -1408
- package/src/styles/components-dark.scss +0 -212
- package/src/styles/components-light.scss +0 -210
- package/src/styles/design-dark.scss +0 -330
- package/src/styles/design-light.scss +0 -345
- package/src/styles/design2-dark.scss +0 -319
- package/src/styles/design2-light.scss +0 -364
- package/src/styles/font.css +0 -19
- package/src/styles/global.scss +0 -251
- package/src/styles/md-viewer.scss +0 -155
- package/src/styles/new-tokens.scss +0 -255
- package/src/styles/tokens.scss +0 -401
- package/src/types/scss.d.ts +0 -24
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { ArrowUpOnSquareIcon } from '@heroicons/react/24/outline';
|
|
2
|
-
import EllipsisHorizontalIcon from '@heroicons/react/24/outline/esm/EllipsisHorizontalIcon';
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
-
import { headers } from 'next/headers';
|
|
5
|
-
import { SecondaryNavigationBar } from '../components/secondary-navigation-bar';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
9
|
-
const meta = {
|
|
10
|
-
title: 'Components/通用/SecondaryNavigationBar-二级页面导航栏',
|
|
11
|
-
component: SecondaryNavigationBar,
|
|
12
|
-
parameters: {
|
|
13
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
-
layout: 'centered',
|
|
15
|
-
nextjs: {
|
|
16
|
-
appDirectory: true, // 如果组件里有用到router next/navigation,则需要设置此配置
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
20
|
-
tags: ['autodocs'],
|
|
21
|
-
|
|
22
|
-
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
23
|
-
args: {
|
|
24
|
-
title: 'Title',
|
|
25
|
-
showClear: false,
|
|
26
|
-
showSearchBar: false,
|
|
27
|
-
searchValue: '',
|
|
28
|
-
backUrl: '/explore',
|
|
29
|
-
},
|
|
30
|
-
argTypes: {
|
|
31
|
-
title: {
|
|
32
|
-
control: 'text',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
} satisfies Meta<typeof SecondaryNavigationBar>;
|
|
36
|
-
|
|
37
|
-
export default meta;
|
|
38
|
-
// export const Default: StoryObj<typeof meta> = {
|
|
39
|
-
// // 这里不需要设置 args,因为它会继承 meta 中的 args
|
|
40
|
-
// };
|
|
41
|
-
type Story = StoryObj<typeof meta>;
|
|
42
|
-
|
|
43
|
-
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
44
|
-
export const SecondaryNavigationBarDemo: Story = {
|
|
45
|
-
args: {
|
|
46
|
-
...meta.args, // 继承默认参数
|
|
47
|
-
},
|
|
48
|
-
render: (args) => {
|
|
49
|
-
return (
|
|
50
|
-
<div className="min-w-[60vw] overflow-y-auto w-full p-6 rounded-md flex flex-col justify-center items-center bg-Colors-Background-Neutral-Primary-Default">
|
|
51
|
-
<div className="w-full">
|
|
52
|
-
<div className="w-full mt-6">Default</div>
|
|
53
|
-
<SecondaryNavigationBar
|
|
54
|
-
{...args}
|
|
55
|
-
backUrl=""
|
|
56
|
-
showClear={false}
|
|
57
|
-
showSearchBar={false}
|
|
58
|
-
/>
|
|
59
|
-
</div>
|
|
60
|
-
<div className="w-full">
|
|
61
|
-
<div className="w-full mt-6">Back url</div>
|
|
62
|
-
<SecondaryNavigationBar
|
|
63
|
-
{...args}
|
|
64
|
-
backUrl="/"
|
|
65
|
-
showClear={false}
|
|
66
|
-
showSearchBar={false}
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
<div className="w-full">
|
|
70
|
-
<div className="w-full mt-6">Search bar</div>
|
|
71
|
-
<SecondaryNavigationBar {...args} showSearchBar />
|
|
72
|
-
</div>
|
|
73
|
-
<div className="w-full">
|
|
74
|
-
<div className="w-full mt-6">Clear</div>
|
|
75
|
-
<SecondaryNavigationBar
|
|
76
|
-
{...args}
|
|
77
|
-
showClear
|
|
78
|
-
clearText="Clear Filters"
|
|
79
|
-
showSearchBar
|
|
80
|
-
/>
|
|
81
|
-
</div>
|
|
82
|
-
<div className="w-full">
|
|
83
|
-
<div className="w-full mt-6">icon buttons</div>
|
|
84
|
-
<SecondaryNavigationBar
|
|
85
|
-
{...args}
|
|
86
|
-
icons={[
|
|
87
|
-
{
|
|
88
|
-
icon: ArrowUpOnSquareIcon,
|
|
89
|
-
onClick: () => {
|
|
90
|
-
console.log('click');
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
icon: EllipsisHorizontalIcon,
|
|
95
|
-
onClick: () => {
|
|
96
|
-
console.log('click');
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
]}
|
|
100
|
-
/>
|
|
101
|
-
</div>
|
|
102
|
-
<div className="w-full">
|
|
103
|
-
<div className="w-full mt-6">action buttons</div>
|
|
104
|
-
<SecondaryNavigationBar
|
|
105
|
-
{...args}
|
|
106
|
-
actions={[
|
|
107
|
-
{
|
|
108
|
-
label: 'Cancel',
|
|
109
|
-
variant: 'tertiary',
|
|
110
|
-
color: 'default',
|
|
111
|
-
onClick: () => {
|
|
112
|
-
console.log('click');
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
label: 'Cancel',
|
|
117
|
-
variant: 'primary',
|
|
118
|
-
color: 'default',
|
|
119
|
-
onClick: () => {
|
|
120
|
-
console.log('click');
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
]}
|
|
124
|
-
/>
|
|
125
|
-
</div>
|
|
126
|
-
<div className="w-full">
|
|
127
|
-
<div className="w-full mt-6">text buttons</div>
|
|
128
|
-
<SecondaryNavigationBar
|
|
129
|
-
{...args}
|
|
130
|
-
actions={[
|
|
131
|
-
{
|
|
132
|
-
label: 'Label',
|
|
133
|
-
variant: 'plain',
|
|
134
|
-
color: 'default',
|
|
135
|
-
onClick: () => {
|
|
136
|
-
console.log('click');
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
]}
|
|
140
|
-
/>
|
|
141
|
-
</div>
|
|
142
|
-
<div className="w-full">
|
|
143
|
-
<div className="w-full mt-6">avatar</div>
|
|
144
|
-
<SecondaryNavigationBar
|
|
145
|
-
{...args}
|
|
146
|
-
showSearchBar={false}
|
|
147
|
-
avatar={{
|
|
148
|
-
logo: 'https://www.myshellstatic.com/cdn-cgi/image/quality=40,format=webp/image/bot/logo/15035350/202409121847/8-cropped-image.png',
|
|
149
|
-
name: 'Emma',
|
|
150
|
-
}}
|
|
151
|
-
icons={[
|
|
152
|
-
{
|
|
153
|
-
icon: ArrowUpOnSquareIcon,
|
|
154
|
-
onClick: () => {
|
|
155
|
-
console.log('click');
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
icon: EllipsisHorizontalIcon,
|
|
160
|
-
onClick: () => {
|
|
161
|
-
console.log('click');
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
]}
|
|
165
|
-
/>
|
|
166
|
-
</div>
|
|
167
|
-
<div className="w-full">
|
|
168
|
-
<div className="w-full mt-6">bar右侧内容自定义</div>
|
|
169
|
-
<SecondaryNavigationBar {...args} showSearchBar={false}>
|
|
170
|
-
children
|
|
171
|
-
</SecondaryNavigationBar>
|
|
172
|
-
</div>
|
|
173
|
-
<div className="w-full">
|
|
174
|
-
<div className="w-full mt-6">无背景</div>
|
|
175
|
-
<SecondaryNavigationBar
|
|
176
|
-
{...args}
|
|
177
|
-
showSearchBar={false}
|
|
178
|
-
hasBackground={false}
|
|
179
|
-
icons={[
|
|
180
|
-
{
|
|
181
|
-
icon: ArrowUpOnSquareIcon,
|
|
182
|
-
onClick: () => {
|
|
183
|
-
console.log('click');
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
icon: EllipsisHorizontalIcon,
|
|
188
|
-
onClick: () => {
|
|
189
|
-
console.log('click');
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
]}
|
|
193
|
-
/>
|
|
194
|
-
<div className="h-[800px]">test content</div>
|
|
195
|
-
</div>
|
|
196
|
-
</div>
|
|
197
|
-
);
|
|
198
|
-
},
|
|
199
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import { fn } from '@storybook/test';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
Select,
|
|
8
|
-
SelectContent,
|
|
9
|
-
SelectItem,
|
|
10
|
-
SelectTrigger,
|
|
11
|
-
SelectIcon,
|
|
12
|
-
SelectValue,
|
|
13
|
-
} from '../components/select';
|
|
14
|
-
import { CheckBadgeIcon, TrashIcon } from '@heroicons/react/24/outline';
|
|
15
|
-
|
|
16
|
-
const meta = {
|
|
17
|
-
title: 'Components/表单/Select-下拉框',
|
|
18
|
-
component: Select,
|
|
19
|
-
parameters: {
|
|
20
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
21
|
-
layout: 'centered',
|
|
22
|
-
},
|
|
23
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
24
|
-
tags: ['autodocs'],
|
|
25
|
-
args: {},
|
|
26
|
-
argTypes: {
|
|
27
|
-
options: {
|
|
28
|
-
control: 'object',
|
|
29
|
-
},
|
|
30
|
-
placeholder: {
|
|
31
|
-
control: 'text',
|
|
32
|
-
},
|
|
33
|
-
triggerClassName: {
|
|
34
|
-
control: 'text',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
} satisfies Meta<typeof Select>;
|
|
38
|
-
export default meta;
|
|
39
|
-
|
|
40
|
-
type Story = StoryObj<typeof meta>;
|
|
41
|
-
|
|
42
|
-
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
43
|
-
export const Demo: Story = {
|
|
44
|
-
args: {
|
|
45
|
-
...meta.args, // 继承默认参数
|
|
46
|
-
},
|
|
47
|
-
render: (args) => {
|
|
48
|
-
return (
|
|
49
|
-
<div className="w-[40vw] px-3 rounded-md flex gap-2">
|
|
50
|
-
<Select {...args}>
|
|
51
|
-
<SelectTrigger className="w-[180px]">
|
|
52
|
-
<div className="flex justify-between items-center grow">
|
|
53
|
-
<SelectValue placeholder="Theme" />
|
|
54
|
-
</div>
|
|
55
|
-
</SelectTrigger>
|
|
56
|
-
<SelectContent>
|
|
57
|
-
<SelectItem value="light">Light</SelectItem>
|
|
58
|
-
<SelectItem value="dark" icon={CheckBadgeIcon}>
|
|
59
|
-
Dark
|
|
60
|
-
</SelectItem>
|
|
61
|
-
<SelectItem value="system">System</SelectItem>
|
|
62
|
-
<SelectItem value="delete" critical icon={TrashIcon}>
|
|
63
|
-
Delete
|
|
64
|
-
</SelectItem>
|
|
65
|
-
<SelectItem value="disabled" disabled>
|
|
66
|
-
Disabled
|
|
67
|
-
</SelectItem>
|
|
68
|
-
</SelectContent>
|
|
69
|
-
</Select>
|
|
70
|
-
</div>
|
|
71
|
-
);
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const OptionsDemo: Story = {
|
|
76
|
-
render: () => {
|
|
77
|
-
const [value, setValue] = React.useState('');
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<div className="w-[40vw] px-3 rounded-md flex flex-col gap-4">
|
|
81
|
-
<h3 className="text-lg font-medium">当前选中值: {value}</h3>
|
|
82
|
-
<Select
|
|
83
|
-
value={value}
|
|
84
|
-
onValueChange={setValue}
|
|
85
|
-
triggerClassName="w-[180px]"
|
|
86
|
-
options={[
|
|
87
|
-
{ value: 'Options1', label: 'Options1' },
|
|
88
|
-
{ value: 'Options2', label: 'Options2' },
|
|
89
|
-
{ value: 'Options3', label: 'Options3', icon: <CheckBadgeIcon /> },
|
|
90
|
-
{
|
|
91
|
-
value: 'Options4',
|
|
92
|
-
label: 'Options4',
|
|
93
|
-
icon: <TrashIcon />,
|
|
94
|
-
critical: true,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
value: 'Options5',
|
|
98
|
-
label: 'Options5',
|
|
99
|
-
disabled: true,
|
|
100
|
-
},
|
|
101
|
-
]}
|
|
102
|
-
placeholder="请选择选项"
|
|
103
|
-
/>
|
|
104
|
-
</div>
|
|
105
|
-
);
|
|
106
|
-
},
|
|
107
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import { Separator } from '@/components/separator';
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
title: 'Components/通用/Separator-分割线',
|
|
9
|
-
component: Separator,
|
|
10
|
-
parameters: {
|
|
11
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
12
|
-
layout: 'centered',
|
|
13
|
-
},
|
|
14
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
15
|
-
tags: ['autodocs'],
|
|
16
|
-
args: {},
|
|
17
|
-
argTypes: {
|
|
18
|
-
orientation: {
|
|
19
|
-
description: '分割方向',
|
|
20
|
-
control: 'select',
|
|
21
|
-
options: ['horizontal', 'vertical'],
|
|
22
|
-
},
|
|
23
|
-
decorative: {
|
|
24
|
-
description: '是否是装饰性组件',
|
|
25
|
-
control: 'boolean',
|
|
26
|
-
},
|
|
27
|
-
className: {
|
|
28
|
-
control: 'text',
|
|
29
|
-
description: '样式覆盖',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
} satisfies Meta<typeof Separator>;
|
|
33
|
-
export default meta;
|
|
34
|
-
|
|
35
|
-
type Story = StoryObj<typeof meta>;
|
|
36
|
-
|
|
37
|
-
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
38
|
-
export const Demo: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
...meta.args, // 继承默认参数
|
|
41
|
-
},
|
|
42
|
-
render: (args) => {
|
|
43
|
-
return (
|
|
44
|
-
<div className="w-[40vw] h-[200px] px-3 rounded-md flex justify-center items-center">
|
|
45
|
-
<Separator {...args} />
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
},
|
|
49
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Spinner } from '@/components/spinner';
|
|
4
|
-
|
|
5
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
|
-
const meta = {
|
|
7
|
-
title: 'Components/通用/Spinner-加载Icon',
|
|
8
|
-
component: Spinner,
|
|
9
|
-
parameters: {
|
|
10
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
11
|
-
layout: 'centered',
|
|
12
|
-
},
|
|
13
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
14
|
-
tags: ['autodocs'],
|
|
15
|
-
|
|
16
|
-
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
17
|
-
args: {
|
|
18
|
-
size: 'lg',
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
// 定义size为select类型的控件
|
|
22
|
-
size: {
|
|
23
|
-
control: 'select',
|
|
24
|
-
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
25
|
-
},
|
|
26
|
-
color: {
|
|
27
|
-
control: 'select',
|
|
28
|
-
options: ['default', 'brand', 'static', 'warning', 'success'],
|
|
29
|
-
},
|
|
30
|
-
speed: {
|
|
31
|
-
control: 'select',
|
|
32
|
-
options: ['slow', 'default', 'fast'],
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
} satisfies Meta<typeof Spinner>;
|
|
36
|
-
|
|
37
|
-
export default meta;
|
|
38
|
-
// export const Default: StoryObj<typeof meta> = {
|
|
39
|
-
// // 这里不需要设置 args,因为它会继承 meta 中的 args
|
|
40
|
-
// };
|
|
41
|
-
type Story = StoryObj<typeof meta>;
|
|
42
|
-
|
|
43
|
-
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
44
|
-
export const Demo: Story = {
|
|
45
|
-
args: {
|
|
46
|
-
...meta.args, // 继承默认参数
|
|
47
|
-
},
|
|
48
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import { SubHeading } from '@/components/typography';
|
|
5
|
-
|
|
6
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
7
|
-
const meta = {
|
|
8
|
-
title: 'Components/文字排版/SubHeading-子标题',
|
|
9
|
-
component: SubHeading,
|
|
10
|
-
parameters: {
|
|
11
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
12
|
-
layout: 'centered',
|
|
13
|
-
},
|
|
14
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
15
|
-
tags: ['autodocs'],
|
|
16
|
-
|
|
17
|
-
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
18
|
-
args: {}, // 默认参数
|
|
19
|
-
argTypes: {
|
|
20
|
-
// 定义size为select类型的控件
|
|
21
|
-
size: {
|
|
22
|
-
control: 'select',
|
|
23
|
-
options: ['lg', 'sm'],
|
|
24
|
-
},
|
|
25
|
-
// 定义color为select类型的控件
|
|
26
|
-
color: {
|
|
27
|
-
control: 'select',
|
|
28
|
-
options: [
|
|
29
|
-
'default',
|
|
30
|
-
'subtle',
|
|
31
|
-
'subtler',
|
|
32
|
-
'subtlest',
|
|
33
|
-
'disabled',
|
|
34
|
-
'static',
|
|
35
|
-
'static-black',
|
|
36
|
-
'brand',
|
|
37
|
-
'critical',
|
|
38
|
-
'critical-bolder',
|
|
39
|
-
'warning',
|
|
40
|
-
'warning-bolder',
|
|
41
|
-
'success',
|
|
42
|
-
'success-bolder',
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
// 定义lineClamp为select类型的控件
|
|
47
|
-
lineClamp: {
|
|
48
|
-
control: 'select',
|
|
49
|
-
options: [1, 2, 3, 4, 5, 6],
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
} satisfies Meta<typeof SubHeading>;
|
|
53
|
-
|
|
54
|
-
export default meta;
|
|
55
|
-
|
|
56
|
-
type Story = StoryObj<typeof meta>;
|
|
57
|
-
|
|
58
|
-
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
59
|
-
export const Demo: Story = {
|
|
60
|
-
args: {
|
|
61
|
-
size: 'lg',
|
|
62
|
-
children: 'Subheading/lg',
|
|
63
|
-
},
|
|
64
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import ArrowsUpDownIcon from '@heroicons/react/24/outline/esm/ArrowsUpDownIcon';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import { Switch } from '@/components/switch';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Components/表单/Switch-开关',
|
|
10
|
-
component: Switch,
|
|
11
|
-
parameters: {
|
|
12
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
13
|
-
layout: 'centered',
|
|
14
|
-
},
|
|
15
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
16
|
-
tags: ['autodocs'],
|
|
17
|
-
|
|
18
|
-
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
19
|
-
args: {
|
|
20
|
-
size: 'lg',
|
|
21
|
-
},
|
|
22
|
-
argTypes: {
|
|
23
|
-
// 定义size为select类型的控件
|
|
24
|
-
size: {
|
|
25
|
-
control: 'select',
|
|
26
|
-
options: ['sm', 'md', 'lg'],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
} satisfies Meta<typeof Switch>;
|
|
30
|
-
|
|
31
|
-
export default meta;
|
|
32
|
-
// export const Default: StoryObj<typeof meta> = {
|
|
33
|
-
// // 这里不需要设置 args,因为它会继承 meta 中的 args
|
|
34
|
-
// };
|
|
35
|
-
type Story = StoryObj<typeof meta>;
|
|
36
|
-
|
|
37
|
-
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
38
|
-
export const IconButtonDemo: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
...meta.args, // 继承默认参数
|
|
41
|
-
},
|
|
42
|
-
render: (args) => {
|
|
43
|
-
return (
|
|
44
|
-
<div className="min-w-[60vw] w-full p-6 rounded-md flex flex-col justify-center items-center space-y-2">
|
|
45
|
-
<div className="w-full">示例:</div>
|
|
46
|
-
<div className="w-full flex flex-col justify-center items-center">
|
|
47
|
-
<div className="w-full flex justify-around mb-3">
|
|
48
|
-
<div className="font-bold w-10" />
|
|
49
|
-
<div className="flex justify-center">lg</div>
|
|
50
|
-
<div className="flex justify-center">md</div>
|
|
51
|
-
<div className="flex justify-center">sm</div>
|
|
52
|
-
</div>
|
|
53
|
-
<div className="w-full flex justify-around items-center mb-6">
|
|
54
|
-
<div className="font-semibold w-10">Default</div>
|
|
55
|
-
<Switch {...args} size="lg" />
|
|
56
|
-
<Switch {...args} size="md" />
|
|
57
|
-
<Switch {...args} size="sm" />
|
|
58
|
-
</div>
|
|
59
|
-
<div className="w-full flex justify-around items-center mb-6">
|
|
60
|
-
<div className="font-semibold w-10">With Label</div>
|
|
61
|
-
<Switch {...args} size="lg" label="Label" />
|
|
62
|
-
<Switch {...args} size="md" label="Label" />
|
|
63
|
-
<Switch {...args} size="sm" label="Label" />
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
);
|
|
68
|
-
},
|
|
69
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import { fn } from '@storybook/test';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import { Tabs } from '../components/tabs';
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Components/数据展示/Tabs-标签页',
|
|
10
|
-
component: Tabs,
|
|
11
|
-
// subcomponents: { AccordionItem: AccordionItem as AccordionItemType },
|
|
12
|
-
parameters: {
|
|
13
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
-
layout: 'centered',
|
|
15
|
-
nextjs: {
|
|
16
|
-
appDirectory: true, // 如果组件里有用到router next/navigation,则需要设置此配置
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
20
|
-
tags: ['autodocs'],
|
|
21
|
-
args: {
|
|
22
|
-
defaultValue: '1',
|
|
23
|
-
variant: 'underline',
|
|
24
|
-
size: 'lg',
|
|
25
|
-
isLink: false,
|
|
26
|
-
},
|
|
27
|
-
argTypes: {
|
|
28
|
-
defaultValue: {
|
|
29
|
-
control: 'text',
|
|
30
|
-
},
|
|
31
|
-
isLink: {
|
|
32
|
-
control: 'boolean',
|
|
33
|
-
description: '是否为链接',
|
|
34
|
-
},
|
|
35
|
-
listClassName: {
|
|
36
|
-
control: 'text',
|
|
37
|
-
},
|
|
38
|
-
variant: {
|
|
39
|
-
control: 'select',
|
|
40
|
-
options: ['button', 'underline'],
|
|
41
|
-
description: '选项卡风格',
|
|
42
|
-
},
|
|
43
|
-
size: {
|
|
44
|
-
control: 'select',
|
|
45
|
-
options: ['sm', 'md', 'lg'],
|
|
46
|
-
description: '选项卡大小',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
} satisfies Meta<typeof Tabs>;
|
|
50
|
-
export default meta;
|
|
51
|
-
|
|
52
|
-
type Story = StoryObj<typeof meta>;
|
|
53
|
-
|
|
54
|
-
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
55
|
-
export const Demo: Story = {
|
|
56
|
-
args: {
|
|
57
|
-
...meta.args, // 继承默认参数
|
|
58
|
-
},
|
|
59
|
-
render: (args) => {
|
|
60
|
-
return (
|
|
61
|
-
<div className="w-[70vw] px-3 rounded-md">
|
|
62
|
-
<Tabs
|
|
63
|
-
{...args}
|
|
64
|
-
items={[
|
|
65
|
-
{
|
|
66
|
-
label: 'Tab 1',
|
|
67
|
-
value: '1',
|
|
68
|
-
children: 'Tab 1',
|
|
69
|
-
link: '/1',
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: 'Tab 2',
|
|
73
|
-
value: '2',
|
|
74
|
-
children: 'Tab 2',
|
|
75
|
-
link: '/2',
|
|
76
|
-
count: 11,
|
|
77
|
-
disabled: true,
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
label: 'Tab 3',
|
|
81
|
-
value: '3',
|
|
82
|
-
children: 'Tab 3',
|
|
83
|
-
link: '/3',
|
|
84
|
-
},
|
|
85
|
-
]}
|
|
86
|
-
/>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
},
|
|
90
|
-
};
|