myshell-react-lib 0.1.0

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.
Files changed (151) hide show
  1. package/README.md +268 -0
  2. package/dist/assets/audio-playing.json +3657 -0
  3. package/dist/index.cjs +9654 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +1431 -0
  6. package/dist/index.d.ts +1431 -0
  7. package/dist/index.js +8788 -0
  8. package/dist/index.js.map +1 -0
  9. package/package.json +140 -0
  10. package/src/common/assets/audio-playing.json +3657 -0
  11. package/src/common/constants/constants.ts +24 -0
  12. package/src/common/constants/types/common.ts +10 -0
  13. package/src/common/hooks/useAudioPlayer.tsx +198 -0
  14. package/src/common/hooks/useDevice.ts +26 -0
  15. package/src/common/hooks/useNativeBridge.ts +42 -0
  16. package/src/common/hooks/useNotification.tsx +179 -0
  17. package/src/common/hooks/useWindowWidth.ts +19 -0
  18. package/src/common/utils/common-helper.ts +81 -0
  19. package/src/components/ItemDemo.tsx +15 -0
  20. package/src/components/accordion.tsx +126 -0
  21. package/src/components/alert-dialog.tsx +148 -0
  22. package/src/components/alert.tsx +65 -0
  23. package/src/components/aspect-ratio.tsx +7 -0
  24. package/src/components/audio-player.tsx +58 -0
  25. package/src/components/avatar.tsx +133 -0
  26. package/src/components/badge.tsx +65 -0
  27. package/src/components/button/button.styles.ts +258 -0
  28. package/src/components/button/button.tsx +215 -0
  29. package/src/components/button/icon-button.styles.ts +101 -0
  30. package/src/components/button/icon-button.tsx +100 -0
  31. package/src/components/button/index.tsx +3 -0
  32. package/src/components/button/link-button.tsx +184 -0
  33. package/src/components/cascader.tsx +175 -0
  34. package/src/components/checkbox.tsx +135 -0
  35. package/src/components/command.tsx +155 -0
  36. package/src/components/context-menu.tsx +198 -0
  37. package/src/components/count-down.tsx +83 -0
  38. package/src/components/custom-notification.tsx +95 -0
  39. package/src/components/dialog.tsx +158 -0
  40. package/src/components/drawer.tsx +116 -0
  41. package/src/components/dropdown-menu.tsx +196 -0
  42. package/src/components/energy-progress.tsx +55 -0
  43. package/src/components/form.tsx +201 -0
  44. package/src/components/group.tsx +9 -0
  45. package/src/components/guide.tsx +243 -0
  46. package/src/components/icon.tsx +89 -0
  47. package/src/components/icons/outline/DownIcon.tsx +18 -0
  48. package/src/components/icons/outline/FilterIcon.tsx +21 -0
  49. package/src/components/icons/outline/arrow-left.tsx +16 -0
  50. package/src/components/icons/outline/arrow-up-tray.tsx +16 -0
  51. package/src/components/icons/outline/check-circle.tsx +17 -0
  52. package/src/components/icons/outline/config.tsx +42 -0
  53. package/src/components/icons/outline/pencil-square.tsx +16 -0
  54. package/src/components/icons/outline/trash.tsx +17 -0
  55. package/src/components/icons/outline/window.tsx +16 -0
  56. package/src/components/icons/outline/x-circle.tsx +17 -0
  57. package/src/components/icons/outline/x-mark.tsx +16 -0
  58. package/src/components/icons/solid/audio-playing.tsx +31 -0
  59. package/src/components/icons/solid/caret-down.tsx +14 -0
  60. package/src/components/icons/solid/code.tsx +18 -0
  61. package/src/components/icons/solid/drag.tsx +14 -0
  62. package/src/components/icons/solid/phone.tsx +23 -0
  63. package/src/components/icons/solid/rectangle-group.tsx +14 -0
  64. package/src/components/image.tsx +151 -0
  65. package/src/components/input.tsx +118 -0
  66. package/src/components/label.tsx +26 -0
  67. package/src/components/link.tsx +123 -0
  68. package/src/components/marquee/index.css +15 -0
  69. package/src/components/marquee/marquee.tsx +220 -0
  70. package/src/components/masonry.tsx +138 -0
  71. package/src/components/menubar.tsx +234 -0
  72. package/src/components/mobile/m-tooltip.tsx +34 -0
  73. package/src/components/modal.tsx +561 -0
  74. package/src/components/navigation-bar.tsx +100 -0
  75. package/src/components/number-input.tsx +143 -0
  76. package/src/components/page-content.tsx +16 -0
  77. package/src/components/popover.tsx +191 -0
  78. package/src/components/progress.tsx +80 -0
  79. package/src/components/radio-group.tsx +44 -0
  80. package/src/components/scroll-area.tsx +49 -0
  81. package/src/components/search-bar.tsx +140 -0
  82. package/src/components/secondary-navigation-bar.tsx +307 -0
  83. package/src/components/select.tsx +273 -0
  84. package/src/components/separator.tsx +31 -0
  85. package/src/components/sheet.tsx +143 -0
  86. package/src/components/skeleton.tsx +20 -0
  87. package/src/components/slider.tsx +160 -0
  88. package/src/components/spinner.tsx +48 -0
  89. package/src/components/swiper/index.module.scss +88 -0
  90. package/src/components/swiper/index.tsx +319 -0
  91. package/src/components/switch.tsx +67 -0
  92. package/src/components/tabs.tsx +325 -0
  93. package/src/components/textarea.tsx +71 -0
  94. package/src/components/toast/toast.tsx +182 -0
  95. package/src/components/toast/toaster.tsx +160 -0
  96. package/src/components/toast/use-toast.tsx +248 -0
  97. package/src/components/toggle-group.tsx +64 -0
  98. package/src/components/toggle.tsx +46 -0
  99. package/src/components/tooltip.tsx +283 -0
  100. package/src/components/typography.tsx +437 -0
  101. package/src/index.ts +66 -0
  102. package/src/lib/utils.ts +62 -0
  103. package/src/stories/Accordion.stories.tsx +64 -0
  104. package/src/stories/AccordionItem.stories.tsx +48 -0
  105. package/src/stories/Avatar.stories.ts +58 -0
  106. package/src/stories/Badge.stories.tsx +40 -0
  107. package/src/stories/BannerSwiper.stories.tsx +102 -0
  108. package/src/stories/Button.stories.tsx +543 -0
  109. package/src/stories/Checkbox.stories.tsx +161 -0
  110. package/src/stories/Configure.mdx +341 -0
  111. package/src/stories/CssProperties.mdx +30 -0
  112. package/src/stories/Description.stories.ts +70 -0
  113. package/src/stories/Display.stories.ts +64 -0
  114. package/src/stories/FeaturedSwiper.stories.tsx +6978 -0
  115. package/src/stories/GridSwiper.stories.tsx +1407 -0
  116. package/src/stories/Guide.stories.tsx +247 -0
  117. package/src/stories/Heading.stories.ts +89 -0
  118. package/src/stories/Icon.stories.ts +77 -0
  119. package/src/stories/IconButton.stories.tsx +301 -0
  120. package/src/stories/IconTextButton.stories.ts +59 -0
  121. package/src/stories/Image.stories.ts +55 -0
  122. package/src/stories/Input.stories.tsx +203 -0
  123. package/src/stories/Modal.stories.tsx +144 -0
  124. package/src/stories/NavigationBar.stories.tsx +81 -0
  125. package/src/stories/Notification.stories.tsx +276 -0
  126. package/src/stories/Popover.stories.tsx +100 -0
  127. package/src/stories/SearchBar.stories.ts +43 -0
  128. package/src/stories/SecondaryNavigationBar.stories.tsx +199 -0
  129. package/src/stories/Select.stories.tsx +107 -0
  130. package/src/stories/Separator.stories.tsx +49 -0
  131. package/src/stories/Spinner.stories.tsx +48 -0
  132. package/src/stories/SubHeading.stories.ts +64 -0
  133. package/src/stories/Swich.stories.tsx +69 -0
  134. package/src/stories/Tabs.stories.tsx +90 -0
  135. package/src/stories/Text.stories.ts +78 -0
  136. package/src/stories/Textarea.stories.tsx +155 -0
  137. package/src/stories/Toast.stories.tsx +424 -0
  138. package/src/stories/Tooltip.stories.tsx +244 -0
  139. package/src/stories/ViewAutoSwiper.stories.tsx +1408 -0
  140. package/src/styles/components-dark.scss +212 -0
  141. package/src/styles/components-light.scss +210 -0
  142. package/src/styles/design-dark.scss +330 -0
  143. package/src/styles/design-light.scss +345 -0
  144. package/src/styles/design2-dark.scss +319 -0
  145. package/src/styles/design2-light.scss +364 -0
  146. package/src/styles/font.css +19 -0
  147. package/src/styles/global.scss +251 -0
  148. package/src/styles/md-viewer.scss +155 -0
  149. package/src/styles/new-tokens.scss +255 -0
  150. package/src/styles/tokens.scss +401 -0
  151. package/src/types/scss.d.ts +24 -0
@@ -0,0 +1,247 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import React from 'react';
3
+
4
+ import { Button } from '../components/button';
5
+ import { Guide } from '../components/guide';
6
+
7
+ const meta = {
8
+ title: 'Components/反馈/Guide-引导',
9
+ component: Guide,
10
+ parameters: {
11
+ layout: 'centered',
12
+ },
13
+ tags: ['autodocs'],
14
+ args: {
15
+ showProgress: true,
16
+ showOverlay: false,
17
+ hasCloseBtn: true,
18
+ hasSkip: true,
19
+ hasPrevBtn: false,
20
+ hasNextBtn: true,
21
+ allowClose: true,
22
+ skipText: '跳过',
23
+ prevBtnText: '上一步',
24
+ nextBtnText: '下一步',
25
+ doneBtnText: '完成',
26
+ steps: [
27
+ {
28
+ element: '#topStart',
29
+ popover: {
30
+ title: 'TopStart',
31
+ description: 'This is a top start positioned popover.',
32
+ side: 'top',
33
+ align: 'start',
34
+ },
35
+ },
36
+ // Add more steps as needed
37
+ ],
38
+ },
39
+ argTypes: {
40
+ showOverlay: {
41
+ description: '是否显示遮罩层',
42
+ control: 'boolean',
43
+ },
44
+ showProgress: {
45
+ description: '是否显示进度',
46
+ control: 'boolean',
47
+ },
48
+ allowClose: {
49
+ description: '是否允许点击背景蒙层关闭',
50
+ control: 'boolean',
51
+ },
52
+ hasCloseBtn: {
53
+ description: '是否显示关闭按钮',
54
+ control: 'boolean',
55
+ },
56
+ hasSkip: {
57
+ description: '是否有跳过按钮',
58
+ control: 'boolean',
59
+ },
60
+ skipText: {
61
+ description: '跳过按钮文字',
62
+ control: 'text',
63
+ },
64
+ hasPrevBtn: {
65
+ description: '是否有上一步按钮',
66
+ control: 'boolean',
67
+ },
68
+ hasNextBtn: {
69
+ description: '是否有下一步按钮',
70
+ control: 'boolean',
71
+ },
72
+ prevBtnText: {
73
+ description: '上一步按钮文字',
74
+ control: 'text',
75
+ },
76
+ nextBtnText: {
77
+ description: '下一步按钮文字',
78
+ control: 'text',
79
+ },
80
+ doneBtnText: {
81
+ description: '完成按钮文字',
82
+ control: 'text',
83
+ },
84
+ onComplete: {
85
+ description: '完成回调',
86
+ action: 'onComplete',
87
+ },
88
+ onSkip: {
89
+ description: '跳过回调',
90
+ action: 'onSkip',
91
+ },
92
+ },
93
+ } satisfies Meta<typeof Guide>;
94
+
95
+ export default meta;
96
+
97
+ type Story = StoryObj<typeof meta>;
98
+
99
+ // ... existing imports and meta ...
100
+ export const GuideDemo: Story = {
101
+ args: {
102
+ ...meta.args,
103
+ },
104
+ render: (args) => {
105
+ const [showGuide, setShowGuide] = React.useState(false);
106
+
107
+ const createStep = (
108
+ id: string,
109
+ side: 'top' | 'right' | 'bottom' | 'left',
110
+ align: 'start' | 'center' | 'end'
111
+ ) => ({
112
+ element: `#${id}`,
113
+ popover: {
114
+ title: `${side}${align.charAt(0).toUpperCase() + align.slice(1)}`,
115
+ description: `This is a ${side} ${align} positioned popover. you can use prompt to make the robot have a unique dialogue style or function!`,
116
+ side,
117
+ align,
118
+ },
119
+ });
120
+
121
+ const steps = [
122
+ createStep('leftStart', 'left', 'start'),
123
+ createStep('left', 'left', 'center'),
124
+ createStep('leftEnd', 'left', 'end'),
125
+ createStep('topStart', 'top', 'start'),
126
+ createStep('topCenter', 'top', 'center'),
127
+ createStep('topEnd', 'top', 'end'),
128
+ createStep('rightStart', 'right', 'start'),
129
+ createStep('right', 'right', 'center'),
130
+ createStep('rightEnd', 'right', 'end'),
131
+ createStep('bottomStart', 'bottom', 'start'),
132
+ createStep('bottomCenter', 'bottom', 'center'),
133
+ createStep('bottomEnd', 'bottom', 'end'),
134
+ ];
135
+
136
+ return (
137
+ <div className="w-[50vw] min-h-[200px] py-10 px-3 rounded-md space-y-3 flex flex-col justify-center">
138
+ <Button onClick={() => setShowGuide(true)} className="mb-5">
139
+ Show Guide
140
+ </Button>
141
+ <div className="grid grid-cols-5 gap-2">
142
+ <div />
143
+ <div
144
+ id="topStart"
145
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
146
+ >
147
+ topStart
148
+ </div>
149
+ <div
150
+ id="topCenter"
151
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
152
+ >
153
+ topCenter
154
+ </div>
155
+ <div
156
+ id="topEnd"
157
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
158
+ >
159
+ topEnd
160
+ </div>
161
+ <div />
162
+ </div>
163
+ <div className="grid grid-cols-5 gap-2">
164
+ <div
165
+ id="leftStart"
166
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
167
+ >
168
+ leftStart
169
+ </div>
170
+ <div />
171
+ <div />
172
+ <div />
173
+ <div
174
+ id="rightStart"
175
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
176
+ >
177
+ rightStart
178
+ </div>
179
+ </div>
180
+ <div className="grid grid-cols-5 gap-2">
181
+ <div
182
+ id="left"
183
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
184
+ >
185
+ left
186
+ </div>
187
+ <div />
188
+ <div />
189
+ <div />
190
+ <div
191
+ id="right"
192
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
193
+ >
194
+ right
195
+ </div>
196
+ </div>
197
+ <div className="grid grid-cols-5 gap-2">
198
+ <div
199
+ id="leftEnd"
200
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
201
+ >
202
+ leftEnd
203
+ </div>
204
+ <div />
205
+ <div />
206
+ <div />
207
+ <div
208
+ id="rightEnd"
209
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
210
+ >
211
+ rightEnd
212
+ </div>
213
+ </div>
214
+ <div className="grid grid-cols-5 gap-2">
215
+ <div />
216
+ <div
217
+ id="bottomStart"
218
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
219
+ >
220
+ bottomStart
221
+ </div>
222
+ <div
223
+ id="bottomCenter"
224
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
225
+ >
226
+ bottom
227
+ </div>
228
+ <div
229
+ id="bottomEnd"
230
+ className="bg-Colors-Background-Normal-Secondary-Default p-2 rounded text-center"
231
+ >
232
+ bottomEnd
233
+ </div>
234
+ <div />
235
+ </div>
236
+ {showGuide && (
237
+ <Guide
238
+ {...args}
239
+ steps={steps}
240
+ onComplete={() => setShowGuide(false)}
241
+ onSkip={() => setShowGuide(false)}
242
+ />
243
+ )}
244
+ </div>
245
+ );
246
+ },
247
+ };
@@ -0,0 +1,89 @@
1
+ /* eslint-disable import/no-unused-modules */
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { fn } from '@storybook/test';
4
+
5
+ import { Heading } from '@/components/typography';
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/文字排版/Heading-H标签',
10
+ component: Heading,
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
+ argTypes: {
21
+ // 定义size为select类型的控件
22
+ size: {
23
+ control: 'select',
24
+ options: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
25
+ },
26
+ // 定义color为select类型的控件
27
+ color: {
28
+ control: 'select',
29
+ options: [
30
+ 'default',
31
+ 'subtle',
32
+ 'subtler',
33
+ 'subtlest',
34
+ 'disabled',
35
+ 'static',
36
+ 'static-black',
37
+ 'brand',
38
+ 'critical',
39
+ 'critical-bolder',
40
+ 'warning',
41
+ 'warning-bolder',
42
+ 'success',
43
+ 'success-bolder',
44
+ ],
45
+ },
46
+
47
+ // 定义lineClamp为select类型的控件
48
+ lineClamp: {
49
+ control: 'select',
50
+ options: [1, 2, 3, 4, 5, 6],
51
+ },
52
+ },
53
+ } satisfies Meta<typeof Heading>;
54
+
55
+ export default meta;
56
+
57
+ type Story = StoryObj<typeof meta>;
58
+
59
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
60
+ export const H1: Story = {
61
+ args: {
62
+ size: 'h1',
63
+ children: 'Heading/h1',
64
+ },
65
+ };
66
+ export const H2: Story = {
67
+ args: {
68
+ size: 'h2',
69
+ children: 'Heading/h2',
70
+ },
71
+ };
72
+ export const H3: Story = {
73
+ args: {
74
+ size: 'h3',
75
+ children: 'Heading/h3',
76
+ },
77
+ };
78
+ export const H4: Story = {
79
+ args: {
80
+ size: 'h4',
81
+ children: 'Heading/h4',
82
+ },
83
+ };
84
+ export const H5: Story = {
85
+ args: {
86
+ size: 'h5',
87
+ children: 'Heading/h5',
88
+ },
89
+ };
@@ -0,0 +1,77 @@
1
+ import ArrowSmallRightIcon from '@heroicons/react/24/outline/esm/ArrowSmallRightIcon';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { fn } from '@storybook/test';
4
+
5
+ import { Icon } from '@/components/icon';
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/通用/Icon-图标',
10
+ component: Icon,
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: 'sm',
21
+ component: ArrowSmallRightIcon,
22
+ color: 'default',
23
+ },
24
+ argTypes: {
25
+ // 定义size为select类型的控件
26
+
27
+ size: {
28
+ control: 'select',
29
+ options: [
30
+ '2xs',
31
+ 'xs',
32
+ 'sm',
33
+ 'md',
34
+ 'lg',
35
+ 'xl',
36
+ '2xl',
37
+ '3xl',
38
+ '4xl',
39
+ '5xl',
40
+ '6xl',
41
+ '7xl',
42
+ ],
43
+ },
44
+ color: {
45
+ control: 'select',
46
+ options: [
47
+ 'default',
48
+ 'subtle',
49
+ 'subtlest',
50
+ 'disabled',
51
+ 'inverse',
52
+ 'static',
53
+ 'brand',
54
+ 'critical',
55
+ 'warning',
56
+ 'success',
57
+ ],
58
+ },
59
+ rotate: {
60
+ control: 'select',
61
+ options: ['0', '45', '90', '-45', '-90', '180'],
62
+ },
63
+ },
64
+ } satisfies Meta<typeof Icon>;
65
+
66
+ export default meta;
67
+ // export const Default: StoryObj<typeof meta> = {
68
+ // // 这里不需要设置 args,因为它会继承 meta 中的 args
69
+ // };
70
+ type Story = StoryObj<typeof meta>;
71
+
72
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
73
+ export const Demo: Story = {
74
+ args: {
75
+ ...meta.args, // 继承默认参数
76
+ },
77
+ };