@anker-in/headless-ui 0.0.27-alpha.0 → 0.0.27-alpha.2

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 (172) hide show
  1. package/dist/cjs/biz-components/BrandEquity/BrandEquity.js +1 -1
  2. package/dist/cjs/biz-components/BrandEquity/BrandEquity.js.map +2 -2
  3. package/dist/cjs/biz-components/Category/index.js +1 -1
  4. package/dist/cjs/biz-components/Category/index.js.map +2 -2
  5. package/dist/cjs/biz-components/Evaluate/index.d.ts +1 -0
  6. package/dist/cjs/biz-components/Evaluate/index.js +1 -1
  7. package/dist/cjs/biz-components/Evaluate/index.js.map +3 -3
  8. package/dist/cjs/biz-components/Marquee/index.js +1 -1
  9. package/dist/cjs/biz-components/Marquee/index.js.map +2 -2
  10. package/dist/cjs/biz-components/MemberEquity/index.js +30 -30
  11. package/dist/cjs/biz-components/MemberEquity/index.js.map +2 -2
  12. package/dist/cjs/biz-components/ShelfDisplay/index.js +9 -9
  13. package/dist/cjs/biz-components/ShelfDisplay/index.js.map +2 -2
  14. package/dist/cjs/biz-components/Slogan/index.js +1 -1
  15. package/dist/cjs/biz-components/Slogan/index.js.map +2 -2
  16. package/dist/cjs/components/button.js +1 -1
  17. package/dist/cjs/components/button.js.map +2 -2
  18. package/dist/cjs/components/card.js +1 -1
  19. package/dist/cjs/components/card.js.map +2 -2
  20. package/dist/cjs/components/carousel.js +1 -1
  21. package/dist/cjs/components/carousel.js.map +2 -2
  22. package/dist/cjs/components/container.js +1 -1
  23. package/dist/cjs/components/container.js.map +2 -2
  24. package/dist/cjs/components/dialog.js +1 -1
  25. package/dist/cjs/components/dialog.js.map +2 -2
  26. package/dist/cjs/components/gird.js +1 -1
  27. package/dist/cjs/components/gird.js.map +2 -2
  28. package/dist/cjs/components/heading.d.ts +1 -1
  29. package/dist/cjs/components/heading.js +1 -1
  30. package/dist/cjs/components/heading.js.map +2 -2
  31. package/dist/cjs/components/text.js +1 -1
  32. package/dist/cjs/components/text.js.map +1 -1
  33. package/dist/cjs/stories/container.stories.js +6 -6
  34. package/dist/cjs/stories/container.stories.js.map +2 -2
  35. package/dist/cjs/stories/dialog.stories.js +1 -1
  36. package/dist/cjs/stories/dialog.stories.js.map +2 -2
  37. package/dist/cjs/stories/evaluate.stories.js +1 -1
  38. package/dist/cjs/stories/evaluate.stories.js.map +2 -2
  39. package/dist/cjs/stories/heading.stories.d.ts +3 -2
  40. package/dist/cjs/stories/heading.stories.js +1 -1
  41. package/dist/cjs/stories/heading.stories.js.map +2 -2
  42. package/dist/cjs/stories/text.stories.js +1 -1
  43. package/dist/cjs/stories/text.stories.js.map +2 -2
  44. package/dist/esm/biz-components/BrandEquity/BrandEquity.js +1 -1
  45. package/dist/esm/biz-components/BrandEquity/BrandEquity.js.map +2 -2
  46. package/dist/esm/biz-components/Category/index.js +1 -1
  47. package/dist/esm/biz-components/Category/index.js.map +2 -2
  48. package/dist/esm/biz-components/Evaluate/index.d.ts +1 -0
  49. package/dist/esm/biz-components/Evaluate/index.js +1 -1
  50. package/dist/esm/biz-components/Evaluate/index.js.map +3 -3
  51. package/dist/esm/biz-components/Marquee/index.js +1 -1
  52. package/dist/esm/biz-components/Marquee/index.js.map +2 -2
  53. package/dist/esm/biz-components/MemberEquity/index.js +29 -29
  54. package/dist/esm/biz-components/MemberEquity/index.js.map +2 -2
  55. package/dist/esm/biz-components/ShelfDisplay/index.js +9 -9
  56. package/dist/esm/biz-components/ShelfDisplay/index.js.map +2 -2
  57. package/dist/esm/biz-components/Slogan/index.js +1 -1
  58. package/dist/esm/biz-components/Slogan/index.js.map +2 -2
  59. package/dist/esm/components/button.js +1 -1
  60. package/dist/esm/components/button.js.map +2 -2
  61. package/dist/esm/components/card.js +1 -1
  62. package/dist/esm/components/card.js.map +2 -2
  63. package/dist/esm/components/carousel.js +1 -1
  64. package/dist/esm/components/carousel.js.map +2 -2
  65. package/dist/esm/components/container.js +1 -1
  66. package/dist/esm/components/container.js.map +2 -2
  67. package/dist/esm/components/dialog.js +1 -1
  68. package/dist/esm/components/dialog.js.map +2 -2
  69. package/dist/esm/components/gird.js +1 -1
  70. package/dist/esm/components/gird.js.map +2 -2
  71. package/dist/esm/components/heading.d.ts +1 -1
  72. package/dist/esm/components/heading.js +1 -1
  73. package/dist/esm/components/heading.js.map +2 -2
  74. package/dist/esm/components/text.js +1 -1
  75. package/dist/esm/components/text.js.map +1 -1
  76. package/dist/esm/stories/container.stories.js +6 -6
  77. package/dist/esm/stories/container.stories.js.map +2 -2
  78. package/dist/esm/stories/dialog.stories.js +1 -1
  79. package/dist/esm/stories/dialog.stories.js.map +2 -2
  80. package/dist/esm/stories/evaluate.stories.js +1 -1
  81. package/dist/esm/stories/evaluate.stories.js.map +2 -2
  82. package/dist/esm/stories/heading.stories.d.ts +3 -2
  83. package/dist/esm/stories/heading.stories.js +1 -1
  84. package/dist/esm/stories/heading.stories.js.map +2 -2
  85. package/dist/esm/stories/text.stories.js +2 -2
  86. package/dist/esm/stories/text.stories.js.map +2 -2
  87. package/package.json +2 -3
  88. package/style.css +69 -34
  89. package/src/biz-components/BrandEquity/BrandEquity.tsx +0 -77
  90. package/src/biz-components/BrandEquity/index.ts +0 -1
  91. package/src/biz-components/Category/index.tsx +0 -57
  92. package/src/biz-components/Evaluate/index.tsx +0 -85
  93. package/src/biz-components/HeroBanner/HeroBanner.tsx +0 -103
  94. package/src/biz-components/HeroBanner/index.tsx +0 -1
  95. package/src/biz-components/HeroBanner/types.ts +0 -28
  96. package/src/biz-components/Marquee/index.tsx +0 -79
  97. package/src/biz-components/MemberEquity/index.tsx +0 -114
  98. package/src/biz-components/MemberEquity/types.ts +0 -26
  99. package/src/biz-components/Shelf/Shelf.tsx +0 -22
  100. package/src/biz-components/Shelf/index.ts +0 -1
  101. package/src/biz-components/Shelf/types.ts +0 -6
  102. package/src/biz-components/ShelfDisplay/index.tsx +0 -142
  103. package/src/biz-components/Slogan/index.tsx +0 -53
  104. package/src/biz-components/Slogan/types.ts +0 -25
  105. package/src/biz-components/index.ts +0 -11
  106. package/src/components/alert.tsx +0 -124
  107. package/src/components/avatar.tsx +0 -126
  108. package/src/components/badge.tsx +0 -27
  109. package/src/components/button.tsx +0 -183
  110. package/src/components/card.tsx +0 -51
  111. package/src/components/carousel.tsx +0 -352
  112. package/src/components/checkbox.tsx +0 -42
  113. package/src/components/color.tsx +0 -77
  114. package/src/components/container.tsx +0 -28
  115. package/src/components/dialog.tsx +0 -98
  116. package/src/components/drawer.tsx +0 -115
  117. package/src/components/drop-down.tsx +0 -182
  118. package/src/components/gird.tsx +0 -90
  119. package/src/components/heading.tsx +0 -80
  120. package/src/components/index.ts +0 -26
  121. package/src/components/input-number.tsx +0 -216
  122. package/src/components/input.tsx +0 -79
  123. package/src/components/link.tsx +0 -99
  124. package/src/components/picture.tsx +0 -100
  125. package/src/components/popover.tsx +0 -31
  126. package/src/components/radio.tsx +0 -85
  127. package/src/components/skeleton.tsx +0 -41
  128. package/src/components/tabs.tsx +0 -78
  129. package/src/components/text.tsx +0 -99
  130. package/src/components/theme.tsx +0 -20
  131. package/src/helpers/component-props.ts +0 -17
  132. package/src/helpers/constants.ts +0 -0
  133. package/src/helpers/index.ts +0 -2
  134. package/src/helpers/utils.ts +0 -16
  135. package/src/icons/spinner.tsx +0 -26
  136. package/src/index.ts +0 -1
  137. package/src/shared/Styles.tsx +0 -94
  138. package/src/stories/HeroBanner.stories.tsx +0 -86
  139. package/src/stories/MemberEquity.stories.tsx +0 -107
  140. package/src/stories/alert.stories.tsx +0 -41
  141. package/src/stories/avatar.stories.tsx +0 -83
  142. package/src/stories/badge.stories.tsx +0 -40
  143. package/src/stories/brandEquity.stories.tsx +0 -73
  144. package/src/stories/button.stories.tsx +0 -145
  145. package/src/stories/card.stories.tsx +0 -97
  146. package/src/stories/carousel.stories.tsx +0 -161
  147. package/src/stories/category.stories.tsx +0 -52
  148. package/src/stories/checkbox.stories.tsx +0 -93
  149. package/src/stories/container.stories.tsx +0 -97
  150. package/src/stories/dialog.stories.tsx +0 -74
  151. package/src/stories/drawer.stories.tsx +0 -88
  152. package/src/stories/drop-down.stories.tsx +0 -83
  153. package/src/stories/evaluate.stories.tsx +0 -53
  154. package/src/stories/grid.stories.tsx +0 -190
  155. package/src/stories/heading.stories.tsx +0 -96
  156. package/src/stories/input-number.stories.tsx +0 -52
  157. package/src/stories/input.stories.tsx +0 -64
  158. package/src/stories/link.stories.tsx +0 -142
  159. package/src/stories/marquee.stories.tsx +0 -102
  160. package/src/stories/picture.stories.tsx +0 -51
  161. package/src/stories/popover.stories.tsx +0 -41
  162. package/src/stories/radio.stories.tsx +0 -55
  163. package/src/stories/shelf.stories.tsx +0 -35
  164. package/src/stories/shelfDisplay.stories.tsx +0 -69
  165. package/src/stories/skeleton.stories.tsx +0 -67
  166. package/src/stories/slogan.stories.tsx +0 -99
  167. package/src/stories/tabs.stories.tsx +0 -179
  168. package/src/stories/text.stories.tsx +0 -130
  169. package/src/styles/global.css +0 -4
  170. package/src/styles/index.css +0 -0
  171. package/src/types/index.ts +0 -0
  172. package/src/types/props.ts +0 -5
@@ -1,40 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import { Badge } from '../components/index.js'
4
- import React from 'react'
5
-
6
- const meta = {
7
- title: 'Components/Badge',
8
- component: Badge,
9
- parameters: {
10
- layout: 'centered',
11
- },
12
- tags: ['autodocs'],
13
- argTypes: {
14
-
15
- },
16
- args: {
17
-
18
- },
19
- } satisfies Meta<typeof Badge>
20
-
21
- export default meta
22
-
23
- type Story = StoryObj<typeof meta>
24
-
25
- export const Default: Story = {
26
- args: {
27
- children: 'Badge',
28
- }
29
- }
30
-
31
- export const Examples: Story = {
32
- render() {
33
- return (
34
- <div className="flex flex-col space-y-4">
35
- <Badge>Outline</Badge>
36
- <Badge>Fill</Badge>
37
- </div>
38
- )
39
- },
40
- }
@@ -1,73 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import BrandEquity from '../biz-components/BrandEquity/BrandEquity.js';
3
-
4
- const ShieldCheckIcon = (props: { className?: string }) => <svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
5
- <path fill-rule="evenodd" clip-rule="evenodd" d="M11.4653 6.25C11.9801 4.79351 13.3691 3.75 15.0019 3.75C16.6347 3.75 18.0237 4.79351 18.5385 6.25H11.4653ZM8.75192 8.75V13.75C8.75192 14.4404 9.31156 15 10.0019 15C10.6923 15 11.2519 14.4404 11.2519 13.75V8.75H18.7519V13.75C18.7519 14.4404 19.3116 15 20.0019 15C20.6923 15 21.2519 14.4404 21.2519 13.75V8.75H23.8452C24.5037 8.75 25.0493 9.26086 25.0925 9.91794L26.0793 24.9179C26.1268 25.639 25.5547 26.25 24.832 26.25H5.1718C4.44915 26.25 3.87705 25.639 3.92449 24.9179L4.91133 9.91794C4.95456 9.26086 5.50014 8.75 6.15864 8.75H8.75192ZM8.87694 6.25C9.45603 3.3972 11.9782 1.25 15.0019 1.25C18.0256 1.25 20.5478 3.3972 21.1269 6.25H23.8452C25.8207 6.25 27.4574 7.78258 27.5871 9.75382L28.5739 24.7538C28.7163 26.9171 27 28.75 24.832 28.75H5.1718C3.00385 28.75 1.28756 26.9171 1.42989 24.7538L2.41673 9.75382C2.54641 7.78259 4.18314 6.25 6.15864 6.25H8.87694ZM12.5019 16.25C12.5019 15.5596 13.0616 15 13.7519 15H16.2519C16.9423 15 17.5019 15.5596 17.5019 16.25C17.5019 16.9404 16.9423 17.5 16.2519 17.5H13.7519C13.0616 17.5 12.5019 16.9404 12.5019 16.25Z" fill="#1D1D1F" />
6
- </svg>
7
-
8
- const meta = {
9
- title: 'Biz-Components/BrandEquity',
10
- component: BrandEquity,
11
- parameters: {
12
- layout: 'fullscreen',
13
- },
14
- tags: ['autodocs'],
15
- } satisfies Meta<typeof BrandEquity>;
16
-
17
- export default meta;
18
- type Story = StoryObj<typeof meta>;
19
-
20
- const mockItems = [
21
- {
22
- icon: <ShieldCheckIcon className="w-6 h-6" />,
23
- title: 'Hassle-Free Warranty',
24
- description: 'Comprehensive warranty protection on all purchases.',
25
- },
26
- {
27
- icon: <ShieldCheckIcon className="w-6 h-6" />,
28
- title: 'Our Happy Customers',
29
- description: 'Join millions of satisfied Anker users worldwide.',
30
- },
31
- {
32
- icon: <ShieldCheckIcon className="w-6 h-6" />,
33
- title: 'Anker credits rewards',
34
- description: 'Buy more, save more, and earn more.',
35
- },
36
- {
37
- icon: <ShieldCheckIcon className="w-6 h-6" />,
38
- title: 'Pay with Ease',
39
- description: 'Pay immediately or in installments with Affirm.',
40
- },
41
- {
42
- icon: <ShieldCheckIcon className="w-6 h-6" />,
43
- title: '30-day money-back guarantee',
44
- description: 'Return within 30 days for a full refund.',
45
- },
46
- {
47
- avatarList: [
48
- 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/25954496272e3aad27d750494d4748ca_c591cb1a-5f47-42d9-b356-0acd9e87fed0.png?v=1744612103',
49
- 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/ee5edd6de20a7af2f30f2fa976d779c9_6ddc29a7-c287-4afc-909c-383fe1f1a74b.png?v=1744612102',
50
- 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/c3269421a5343c0e59065b53bd81c8f5_ba2fc271-206e-4480-b815-9eb76b45f691.png?v=1744612102',
51
- 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/b0b7c87fb0819b6cd109bf4b0d865006_e0f7c15a-7d1a-45e7-aee3-783e681a3864.png?v=1744612102',
52
- 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/85087c9c0ec8c86b481eaea247812c3e.png?v=1744612102'
53
- ],
54
- title: 'We are Here to Help',
55
- description: 'Contact our expert team via email or live chat for assistance.',
56
- },
57
- ];
58
-
59
- export const Default: Story = {
60
- args: {
61
- items: mockItems,
62
- className: "bg-[#eeeeee] p-4"
63
- },
64
- };
65
-
66
-
67
- export const CustomBackground: Story = {
68
- args: {
69
- items: mockItems,
70
- className: 'bg-gray-900 p-4',
71
- itemShape: 'round',
72
- },
73
- };
@@ -1,145 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
- import { SearchIcon } from '@storybook/icons'
3
-
4
- import { Button } from '../components/index.js'
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
- // 同时定义了页面左侧菜单
10
- title: 'Components/Button',
11
- component: Button,
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
- docs: {
16
- description: {
17
- component: `按钮组件, 分为多种变体和大小, 支持 loading 状态和图标`
18
- }
19
- }
20
- },
21
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
22
- tags: ['autodocs'],
23
- // More on argTypes: https://storybook.js.org/docs/api/argtypes
24
- argTypes: {
25
- theme: {
26
- control: {
27
- type: 'select',
28
- },
29
- options: ['dark', 'light'],
30
- description: '主题, 默认是 light',
31
- },
32
- variant: {
33
- control: {
34
- type: 'select',
35
- },
36
- options: ['nature', 'primary', 'secondary', 'link', 'ghost'],
37
- },
38
- size: {
39
- control: {
40
- type: 'select',
41
- },
42
- options: ['sm', 'base', 'lg', 'icon'],
43
- },
44
- hoverEffect: {
45
- description: 'hover 状态下的动画效果,仅在variant是primary 和 secondary 时生效',
46
- control: {
47
- type: 'select',
48
- },
49
- options: ['none', 'slide'],
50
- },
51
- },
52
- args: {
53
- theme: 'light',
54
- variant: 'primary',
55
- size: 'base',
56
- children: 'Button',
57
- asChild: false,
58
- disabled: false,
59
- loading: false,
60
- hoverEffect: 'none',
61
- },
62
- } satisfies Meta<typeof Button>
63
-
64
- export default meta
65
- type Story = StoryObj<typeof meta>
66
-
67
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
68
- // args 会作为 props 传递给组件
69
- // Story的名会作为菜单的名称 自动首字母大写并按照大写字母拆分 UseAsButton => Use As Button
70
-
71
- export const Nature: Story = {
72
- args: {
73
- size: 'lg',
74
- variant: 'nature',
75
- children: 'Default',
76
- },
77
- }
78
-
79
- export const Primary: Story = {
80
- args: {
81
- size: 'lg',
82
- children: 'Primary',
83
- },
84
- }
85
-
86
- export const Secondary: Story = {
87
- args: {
88
- size: 'lg',
89
- variant: 'secondary',
90
- children: 'Secondary',
91
- },
92
- }
93
-
94
- export const Link: Story = {
95
- args: {
96
- size: 'lg',
97
- variant: 'link',
98
- children: 'Link',
99
- },
100
- }
101
-
102
- export const WithIcon: Story = {
103
- args: {
104
- size: 'lg',
105
- children: (
106
- <>
107
- WithIcon <SearchIcon className="ml-2" />
108
- </>
109
- ),
110
- },
111
- }
112
-
113
- export const Aschild: Story = {
114
- args: {
115
- size: 'lg',
116
- asChild: true,
117
- children: <a href="http://example.com">as a a tag</a>,
118
- },
119
- }
120
-
121
- export const Spinner: Story = {
122
- args: {
123
- size: 'lg',
124
- loading: true,
125
- spinner: (
126
- <div className="flex animate-pulse flex-row font-bold text-neutral-900">
127
- <svg
128
- viewBox="0 0 1024 1024"
129
- version="1.1"
130
- xmlns="http://www.w3.org/2000/svg"
131
- p-id="2625"
132
- width="1rem"
133
- className="align-middle"
134
- >
135
- <path
136
- d="M511.882596 287.998081h-0.361244a31.998984 31.998984 0 0 1-31.659415-31.977309v-0.361244c0-0.104761 0.115598-11.722364 0.115598-63.658399V96.000564a31.998984 31.998984 0 1 1 64.001581 0V192.001129c0 52.586273-0.111986 63.88237-0.119211 64.337537a32.002596 32.002596 0 0 1-31.977309 31.659415zM511.998194 959.99842a31.998984 31.998984 0 0 1-31.998984-31.998984v-96.379871c0-51.610915-0.111986-63.174332-0.115598-63.286318s0-0.242033 0-0.361243a31.998984 31.998984 0 0 1 63.997968-0.314283c0 0.455167 0.11921 11.711527 0.11921 64.034093v96.307622a31.998984 31.998984 0 0 1-32.002596 31.998984zM330.899406 363.021212a31.897836 31.897836 0 0 1-22.866739-9.612699c-0.075861-0.075861-8.207461-8.370021-44.931515-45.094076L195.198137 240.429485a31.998984 31.998984 0 0 1 45.256635-45.253022L308.336112 263.057803c37.182834 37.182834 45.090463 45.253022 45.41197 45.578141A31.998984 31.998984 0 0 1 330.899406 363.021212zM806.137421 838.11473a31.901448 31.901448 0 0 1-22.628318-9.374279L715.624151 760.859111c-36.724054-36.724054-45.018214-44.859267-45.097687-44.93874a31.998984 31.998984 0 0 1 44.77618-45.729864c0.32512 0.317895 8.395308 8.229136 45.578142 45.411969l67.88134 67.88134a31.998984 31.998984 0 0 1-22.624705 54.630914zM224.000113 838.11473a31.901448 31.901448 0 0 0 22.628317-9.374279l67.88134-67.88134c36.724054-36.724054 45.021826-44.859267 45.097688-44.93874a31.998984 31.998984 0 0 0-44.776181-45.729864c-0.32512 0.317895-8.395308 8.229136-45.578142 45.411969l-67.88134 67.884953a31.998984 31.998984 0 0 0 22.628318 54.627301zM255.948523 544.058589h-0.361244c-0.104761 0-11.722364-0.115598-63.658399-0.115598H95.942765a31.998984 31.998984 0 1 1 0-64.00158h95.996952c52.586273 0 63.88237 0.111986 64.337538 0.11921a31.998984 31.998984 0 0 1 31.659414 31.97731v0.361244a32.002596 32.002596 0 0 1-31.988146 31.659414zM767.939492 544.058589a32.002596 32.002596 0 0 1-31.995372-31.666639v-0.361244a31.998984 31.998984 0 0 1 31.659415-31.970085c0.455167 0 11.754876-0.11921 64.34115-0.11921h96.000564a31.998984 31.998984 0 0 1 0 64.00158H831.944685c-51.936034 0-63.553638 0.111986-63.665624 0.115598h-0.335957zM692.999446 363.0176a31.998984 31.998984 0 0 1-22.863126-54.381656c0.317895-0.32512 8.229136-8.395308 45.41197-45.578141l67.88134-67.884953A31.998984 31.998984 0 1 1 828.693489 240.429485l-67.892177 67.88134c-31.020013 31.023625-41.644196 41.759794-44.241539 44.393262l-0.697201 0.722488a31.908673 31.908673 0 0 1-22.863126 9.591025z"
137
- fill=""
138
- p-id="2626"
139
- ></path>
140
- </svg>
141
- &nbsp;loading...
142
- </div>
143
- ),
144
- },
145
- }
@@ -1,97 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import {
4
- Card,
5
- CardContent,
6
- CardFooter,
7
- CardDescription,
8
- CardHeader,
9
- CardTitle,
10
- Button,
11
- Picture,
12
- } from '../components/index.js'
13
- import React from 'react'
14
-
15
- const meta = {
16
- title: 'Components/Card',
17
- component: Card,
18
- subcomponents: {
19
- CardHeader,
20
- CardContent,
21
- CardDescription,
22
- CardFooter,
23
- CardTitle,
24
- },
25
- parameters: {
26
- layout: 'centered',
27
- docs: {
28
- description: {
29
- component:
30
- '卡片组件,内部可以嵌套CardHeader, CardContent, CardFooter等组件, CardHeader 内可以嵌套CardTitle, CardDescription',
31
- },
32
- },
33
- },
34
- tags: ['autodocs'],
35
- } satisfies Meta<typeof Card>
36
-
37
- export default meta
38
-
39
- type Story = StoryObj<typeof meta>
40
-
41
- export const Default: Story = {
42
- render() {
43
- return (
44
- <Card className="">
45
- <CardHeader></CardHeader>
46
- <CardContent>
47
- <p>Charge Easily On the Go</p>
48
- <p>charge Everything Everywhere Faster All at Once</p>
49
- </CardContent>
50
- <CardFooter className="flex justify-between">
51
- <Button>Learn More</Button>
52
- </CardFooter>
53
- </Card>
54
- )
55
- },
56
- }
57
-
58
- export const WithHeader: Story = {
59
- render() {
60
- return (
61
- <Card className="">
62
- <CardHeader>
63
- <CardTitle>Card title</CardTitle>
64
- <CardDescription>Card description</CardDescription>
65
- </CardHeader>
66
- <CardContent>
67
- <p>Charge Easily On the Go</p>
68
- <p>charge Everything Everywhere Faster All at Once</p>
69
- </CardContent>
70
- <CardFooter className="flex justify-between">
71
- <Button>Learn More</Button>
72
- </CardFooter>
73
- </Card>
74
- )
75
- },
76
- }
77
-
78
- export const WithImage: Story = {
79
- render() {
80
- return (
81
- <Card className="w-[400px]">
82
- <CardContent className="p-0">
83
- <Picture
84
- source="https://cdn.shopify.com/s/files/1/0521/9411/5753/files/e5e7c8b6a240bb042c57529a3299c255.png?v=1741664601"
85
- alt="A random image"
86
- />
87
- <p className="p-2">
88
- click learn more to see how we can help you charge everything everywhere faster all at once
89
- </p>
90
- </CardContent>
91
- <CardFooter className="flex justify-between pt-[8px]">
92
- <Button>Learn More</Button>
93
- </CardFooter>
94
- </Card>
95
- )
96
- },
97
- }
@@ -1,161 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
- import {
3
- Carousel,
4
- CarouselContent,
5
- CarouselItem,
6
- CarouselNext,
7
- CarouselPrevious,
8
- Card,
9
- CardContent,
10
- } from '../components/index.js'
11
-
12
- import React from 'react'
13
-
14
- const meta = {
15
- title: 'Components/Carousel',
16
- component: Carousel,
17
- subcomponents: {
18
- CarouselContent,
19
- CarouselItem,
20
- },
21
- parameters: {
22
- layout: 'centered',
23
- docs: {
24
- description: {
25
- component: '轮播组件, 基于轻量级组件embla-carousel-react, https://www.embla-carousel.com/get-started/react/',
26
- },
27
- },
28
- },
29
- tags: ['autodocs'],
30
- argTypes: {
31
- opts: {
32
- description:
33
- 'embla-carousel-react 的配置参数, 可以配置loop: true 开启循环,align: center | start | end 对齐方式, 查看 https://www.embla-carousel.com/api/options/',
34
- control: {
35
- type: 'object',
36
- },
37
- },
38
- showNavigation: {
39
- description: '是否显示导航点',
40
- control: {
41
- type: 'boolean',
42
- },
43
- },
44
- orientation: {
45
- description: '轮播方向',
46
- control: {
47
- type: 'select',
48
- },
49
- options: ['horizontal', 'vertical'],
50
- },
51
- setApi: {
52
- description: '设置api, 可以通过这个函数获取carousel API 实例,拿到api 实例后,可以调用api 实例的方法或者属性',
53
- },
54
- plugins: {
55
- description:
56
- 'embla-carousel-react 的插件,embla-carousel 的 Autoplay, Wheel Gesture 等高级功能 通过插件支持 https://www.embla-carousel.com/plugins/',
57
- },
58
- },
59
- args: {
60
- opts: {},
61
- orientation: 'horizontal',
62
- },
63
- } satisfies Meta<typeof Carousel>
64
-
65
- export default meta
66
- type Story = StoryObj<typeof meta>
67
-
68
- export const Default: Story = {
69
- args: {
70
- opts: {
71
- align: 'start',
72
- },
73
- children: (
74
- <>
75
- <CarouselContent>
76
- {Array.from({ length: 5 }).map((_, index) => (
77
- <CarouselItem key={index} className="basis-1/3">
78
- <div className="p-1">
79
- <Card>
80
- <CardContent className="flex aspect-square items-center justify-center p-6">
81
- <span className="text-3xl font-semibold">{index + 1}</span>
82
- </CardContent>
83
- </Card>
84
- </div>
85
- </CarouselItem>
86
- ))}
87
- </CarouselContent>
88
- <CarouselPrevious />
89
- <CarouselNext />
90
- </>
91
- ),
92
- },
93
- }
94
-
95
- export const Vertical: Story = {
96
- render() {
97
- return (
98
- <Carousel
99
- opts={{
100
- align: 'start',
101
- }}
102
- orientation="vertical"
103
- className="w-full max-w-xs"
104
- >
105
- <CarouselContent className="-mt-1 h-[200px]">
106
- {Array.from({ length: 5 }).map((_, index) => (
107
- <CarouselItem key={index} className="basis-1/2 pt-1">
108
- <div className="p-1">
109
- <Card>
110
- <CardContent className="flex aspect-square items-center justify-center p-6">
111
- <span className="text-3xl font-semibold">{index + 1}</span>
112
- </CardContent>
113
- </Card>
114
- </div>
115
- </CarouselItem>
116
- ))}
117
- </CarouselContent>
118
- <CarouselPrevious />
119
- <CarouselNext />
120
- </Carousel>
121
- )
122
- },
123
- }
124
-
125
- const images = [
126
- 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/Frame_1312320388_mo_path_1.png?v=1741689169',
127
- 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/Frame_1312320388.png?v=1741689169',
128
- 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/Frame_1312320388_1_mo_never_missing.png?v=1741689169',
129
- 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/Frame_1312320388_mo_path_1.png?v=1741689169',
130
- 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/Frame_1312320388.png?v=1741689169',
131
- ]
132
- export const OverrideClassName: Story = {
133
- render() {
134
- return (
135
- <Carousel
136
- opts={{
137
- loop: true,
138
- align: 'center',
139
- }}
140
- showNavigation={true}
141
- navigationPosition="outter"
142
- className="w-full max-w-xl"
143
- >
144
- <CarouselContent className="">
145
- {Array.from({ length: 5 }).map((_, index) => (
146
- <CarouselItem key={index} className="basis-1/2">
147
- <div className="p-1">
148
- <img src={images[index]} alt="" />
149
- </div>
150
- </CarouselItem>
151
- ))}
152
- </CarouselContent>
153
- <CarouselPrevious className="left-4" />
154
- <CarouselNext className="right-4" />
155
- </Carousel>
156
- )
157
- },
158
- }
159
- OverrideClassName.parameters = {
160
- layout: 'padded',
161
- }
@@ -1,52 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
- import Category from '../biz-components/Category'
3
-
4
- const meta = {
5
- title: 'Biz-Components/Category',
6
- component: Category,
7
- parameters: {
8
- layout: 'fullscreen',
9
- },
10
- tags: ['autodocs'],
11
- } satisfies Meta<typeof Category>
12
-
13
- export default meta
14
- type Story = StoryObj<typeof meta>
15
-
16
- const mockItems = [
17
- {
18
- title: 'Anker Prime 27',
19
- img: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',
20
- },
21
- {
22
- title: 'Anker Prime',
23
- img: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',
24
- },
25
- {
26
- title: 'Anker Prime',
27
- img: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',
28
- },
29
- {
30
- title: 'Anker Prime',
31
- img: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',
32
- },
33
- {
34
- title: 'Anker Prime',
35
- img: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',
36
- },
37
- ]
38
-
39
- export const Default: Story = {
40
- args: {
41
- products: mockItems,
42
- className: 'p-4',
43
- },
44
- }
45
-
46
- export const Round: Story = {
47
- args: {
48
- products: mockItems,
49
- className: 'p-4',
50
- shape: 'round',
51
- },
52
- }
@@ -1,93 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react/*'
2
- import { Checkbox } from '../components/index.js'
3
- import React from 'react'
4
-
5
- const meta = {
6
- title: 'Components/Checkbox',
7
- component: Checkbox,
8
- parameters: {
9
- layout: 'centered',
10
- docs: {
11
- description: {
12
- component: '复选框, 基于@radix-ui/react-checkbox https://www.radix-ui.com/primitives/docs/components/checkbox',
13
- },
14
- },
15
- },
16
- tags: ['autodocs'],
17
- argTypes: {
18
- size: {
19
- control: {
20
- type: 'select',
21
- },
22
- options: ['sm', 'base', 'lg'],
23
- description: '尺寸',
24
- table: {
25
- defaultValue: { summary: 'base' },
26
- },
27
- },
28
- },
29
- args: {
30
- size: 'base',
31
- },
32
- } satisfies Meta<typeof Checkbox>
33
-
34
- export default meta
35
-
36
- type Story = StoryObj<typeof meta>
37
-
38
- export const Default: Story = {
39
- args: {
40
- size: 'base',
41
- },
42
- }
43
-
44
- export const Sizes = () => (
45
- <div className="flex flex-col gap-2">
46
- <div className="flex items-center space-x-2">
47
- <Checkbox id="terms" size="sm" />
48
- <label
49
- htmlFor="terms"
50
- className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
51
- >
52
- Accept terms and conditions
53
- </label>
54
- </div>
55
- <div className="flex items-center space-x-2">
56
- <Checkbox id="terms1" size="base" />
57
- <label
58
- htmlFor="terms1"
59
- className="text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
60
- >
61
- Accept terms and conditions
62
- </label>
63
- </div>
64
- <div className="flex items-center space-x-2">
65
- <Checkbox id="terms2" size="lg" />
66
- <label
67
- htmlFor="terms2"
68
- className="text-lg font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
69
- >
70
- Accept terms and conditions
71
- </label>
72
- </div>
73
- </div>
74
- )
75
- Sizes.parameters = {
76
- docs: {
77
- description: {
78
- story: '不同的尺寸',
79
- },
80
- },
81
- }
82
-
83
- export const Disabled = () => (
84
- <div className="flex items-center space-x-2">
85
- <Checkbox id="terms" disabled />
86
- <label
87
- htmlFor="terms"
88
- className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
89
- >
90
- Accept terms and conditions
91
- </label>
92
- </div>
93
- )