@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,78 +0,0 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import { cn } from '../helpers/index.js'
5
-
6
- import * as TabsPrimitive from '@radix-ui/react-tabs'
7
- import { cva, type VariantProps } from 'class-variance-authority'
8
-
9
- const TabListContext = React.createContext<{ algin?: 'left' | 'center' | 'right' }>({
10
- algin: 'left',
11
- })
12
-
13
- const Tabs = React.forwardRef<
14
- React.ElementRef<typeof TabsPrimitive.Root>,
15
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & { algin?: 'left' | 'center' | 'right' }
16
- >(({ children, algin = 'left', ...props }, ref) => (
17
- <TabsPrimitive.Root ref={ref} {...props}>
18
- <TabListContext.Provider value={{ algin }}>{children}</TabListContext.Provider>
19
- </TabsPrimitive.Root>
20
- ))
21
- Tabs.displayName = 'Tabs'
22
-
23
- const tabsListVariants = cva('', {
24
- variants: {
25
- algin: {
26
- left: 'justify-left',
27
- center: 'justify-center',
28
- right: 'justify-end',
29
- },
30
- },
31
- defaultVariants: {
32
- algin: 'left',
33
- },
34
- })
35
-
36
- const TabsList = React.forwardRef<
37
- React.ElementRef<typeof TabsPrimitive.List>,
38
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
39
- >(({ className, ...props }, ref) => {
40
- const { algin: alginFromParent } = React.useContext(TabListContext)
41
- return (
42
- <TabsPrimitive.List
43
- ref={ref}
44
- className={cn(
45
- 'border-b-lines flex gap-[24px] overflow-x-auto border-b',
46
- tabsListVariants({
47
- algin: alginFromParent,
48
- }),
49
- className
50
- )}
51
- {...props}
52
- />
53
- )
54
- })
55
- TabsList.displayName = TabsPrimitive.List.displayName
56
-
57
- const TabsTrigger = React.forwardRef<
58
- React.ElementRef<typeof TabsPrimitive.Trigger>,
59
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
60
- >(({ className, ...props }, ref) => (
61
- <TabsPrimitive.Trigger
62
- ref={ref}
63
- className={cn(
64
- 'border-b-brand-0 disabled:text-btn-secondary-disabled shrink-0 text-base font-bold data-[state=active]:border-b-[3px]',
65
- className
66
- )}
67
- {...props}
68
- />
69
- ))
70
- TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
71
-
72
- const TabsContent = React.forwardRef<
73
- React.ElementRef<typeof TabsPrimitive.Content>,
74
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
75
- >(({ className, ...props }, ref) => <TabsPrimitive.Content ref={ref} className={cn(className)} {...props} />)
76
- TabsContent.displayName = TabsPrimitive.Content.displayName
77
-
78
- export { Tabs, TabsList, TabsTrigger, TabsContent }
@@ -1,99 +0,0 @@
1
- import * as React from 'react'
2
- import { Slot } from '@radix-ui/react-slot'
3
- import { cn } from '../helpers/index.js'
4
- import { type VariantProps, cva } from 'class-variance-authority'
5
- import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js'
6
-
7
- const textVariants = cva('tracking font-body', {
8
- variants: {
9
- size: {
10
- 1: 'text-text-1 text-info-primary',
11
- 2: 'text-text-2 text-info-primary',
12
- 3: 'text-text-3 text-info-primary',
13
- },
14
- weight: {
15
- light: 'font-light',
16
- normal: 'font-normal',
17
- medium: 'font-medium',
18
- semibold: 'font-semibold',
19
- bold: 'font-bold',
20
- },
21
- align: {
22
- left: 'text-left',
23
- center: 'text-center',
24
- right: 'text-right',
25
- },
26
- },
27
- defaultVariants: {
28
- size: 3,
29
- weight: 'normal',
30
- },
31
- })
32
-
33
- type TextElement = React.ElementRef<'span'>
34
- type TextSpanProps = { as?: 'span' } & ComponentPropsWithout<'span', RemovedProps>
35
- type TextDivProps = { as: 'div' } & ComponentPropsWithout<'div', RemovedProps>
36
- type TextLabelProps = { as: 'label' } & ComponentPropsWithout<'label', RemovedProps>
37
- type TextPProps = { as: 'p' } & ComponentPropsWithout<'p', RemovedProps>
38
-
39
- interface CommonTextProps extends VariantProps<typeof textVariants> {
40
- as?: 'div' | 'label' | 'p' | 'span'
41
- asChild?: boolean
42
- color?: string
43
- /** 相当于 dangerouslySetInnerHTML */
44
- html?: string
45
- }
46
-
47
- type TextProps = CommonTextProps & (TextSpanProps | TextDivProps | TextLabelProps | TextPProps)
48
-
49
- const Text = React.forwardRef<TextElement, TextProps>((props, forwardedRef) => {
50
- const {
51
- children,
52
- size = 3,
53
- weight,
54
- align,
55
- className,
56
- asChild,
57
- as: Tag = 'span',
58
- color,
59
- html,
60
- ...textProps
61
- } = props
62
-
63
- const htmlContentProps = html
64
- ? {
65
- dangerouslySetInnerHTML: { __html: html },
66
- }
67
- : null
68
-
69
- const styleProps = color
70
- ? {
71
- style: {
72
- color,
73
- },
74
- }
75
- : null
76
-
77
- return (
78
- <Slot
79
- {...textProps}
80
- ref={forwardedRef}
81
- className={cn(
82
- textVariants({
83
- size,
84
- weight,
85
- align,
86
- }),
87
- className
88
- )}
89
- {...htmlContentProps}
90
- {...styleProps}
91
- >
92
- {asChild ? children : <Tag>{htmlContentProps ? null : children}</Tag>}
93
- </Slot>
94
- )
95
- })
96
- Text.displayName = 'Text'
97
-
98
- export { Text }
99
- export type { TextProps }
@@ -1,20 +0,0 @@
1
- 'use client'
2
- import * as React from 'react'
3
-
4
- interface ThemeProps {
5
- brand: string
6
- children: React.ReactNode
7
- }
8
- /**
9
- *
10
- * @param param
11
- * @returns
12
- */
13
- const Theme = ({ brand, children }: ThemeProps) => {
14
- React.useLayoutEffect(() => {
15
- document.querySelector('html')?.setAttribute('data-brand-theme', brand)
16
- }, [])
17
- return <>{children}</>
18
- }
19
-
20
- export default Theme
@@ -1,17 +0,0 @@
1
- import type React from 'react'
2
-
3
- type ComponentPropsAs<C extends React.ElementType<any>, T extends React.ComponentPropsWithoutRef<C>['as']> = Omit<
4
- Extract<React.ComponentPropsWithoutRef<C>, { as: T }>,
5
- 'as' | 'asChild'
6
- >
7
-
8
- // Omits the specified props from the component props. Autocomplete will suggest props
9
- // of the component, but won't restrict the omittable props to those that actually exist.
10
- type ComponentPropsWithout<
11
- T extends React.ElementType,
12
- O extends Omit<string, keyof React.ComponentPropsWithoutRef<T>> | keyof React.ComponentPropsWithoutRef<T>,
13
- > = Omit<React.ComponentPropsWithoutRef<T>, O & string>
14
-
15
- type RemovedProps = 'asChild' | 'defaultChecked' | 'defaultValue' | 'color'
16
-
17
- export type { ComponentPropsAs, ComponentPropsWithout, RemovedProps }
File without changes
@@ -1,2 +0,0 @@
1
- export { cn } from './utils.js'
2
- export { noop } from './utils.js'
@@ -1,16 +0,0 @@
1
- import { clsx, type ClassValue } from 'clsx'
2
- import { extendTailwindMerge } from 'tailwind-merge'
3
-
4
- const twMerge = extendTailwindMerge({
5
- extend: {
6
- theme: {
7
- borderRadius: ['btn'],
8
- },
9
- },
10
- })
11
-
12
- export function cn(...inputs: ClassValue[]) {
13
- return twMerge(clsx(inputs))
14
- }
15
-
16
- export function noop(): any {}
@@ -1,26 +0,0 @@
1
- import { cn } from '../helpers/index.js'
2
-
3
- export interface SpinnerProps {
4
- className?: string
5
- }
6
-
7
- // eslint-disable-next-line no-unused-vars
8
- const Spinner = (props: SpinnerProps) => {
9
- return (
10
- <svg
11
- fill="none"
12
- viewBox="0 0 20 20"
13
- xmlns="http://www.w3.org/2000/svg"
14
- width="1rem"
15
- className={cn('animate-spin', props.className)}
16
- >
17
- <path
18
- d="M1 10C1 14.9706 5.02944 19 10 19C14.9706 19 19 14.9706 19 10C19 5.02944 14.9706 1 10 1"
19
- strokeWidth="2"
20
- strokeLinecap="round"
21
- />
22
- </svg>
23
- )
24
- }
25
-
26
- export default Spinner
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components/index.js'
@@ -1,94 +0,0 @@
1
- import React, { useMemo } from 'react';
2
-
3
- export interface StylesProps {
4
- /** 自定义样式字符串 */
5
- style?: string;
6
- /** 唯一标识符 */
7
- uid?: string;
8
- /** 是否禁用 */
9
- disabled?: boolean;
10
- }
11
-
12
- /**
13
- * 生成唯一标识符
14
- */
15
- const generateUID = () => {
16
- return `style_${Math.random().toString(36).substring(2, 9)}_${Date.now().toString(36)}`;
17
- };
18
-
19
- /**
20
- * 从组件 props 中提取样式相关属性
21
- */
22
- export const getStylesProps = <T extends Record<string, unknown>>(props: T & StylesProps): StylesProps => {
23
- const { style, uid, disabled } = props;
24
- return { style, uid, disabled };
25
- };
26
-
27
- /**
28
- * 样式注入组件
29
- */
30
- const Styles: React.FC<StylesProps> = ({
31
- style,
32
- uid = generateUID(),
33
- disabled = false,
34
- }) => {
35
- if (!style || disabled) {
36
- return null;
37
- }
38
-
39
- return (
40
- <style data-style-id={uid}>
41
- {`.block-${uid} { ${style} }`}
42
- </style>
43
- );
44
- };
45
-
46
- /**
47
- * 样式 Hook,返回样式类名和样式组件
48
- * @param styleProps - 样式属性
49
- */
50
- export const useStyles = (styleProps?: Partial<StylesProps>) => {
51
- const uid = useMemo(() => styleProps?.uid || generateUID(), [styleProps?.uid]);
52
-
53
- const StyleComponent = useMemo(() => (
54
- <Styles {...styleProps} uid={uid} />
55
- ), [styleProps, uid]);
56
-
57
- return {
58
- className: `block-${uid}`,
59
- StyleComponent,
60
- uid
61
- } as const;
62
- };
63
-
64
- /**
65
- * 样式高阶组件, 用于给组件用style 标签的形式追加样式
66
- * @param WrappedComponent - 需要包装的组件
67
- * @param defaultStyleProps - 默认样式属性
68
- */
69
- export function withStyles<P extends object>(
70
- WrappedComponent: React.ComponentType<P>,
71
- defaultStyleProps?: Partial<StylesProps>
72
- ) {
73
- const WithStyles = function(props: Omit<P, keyof StylesProps> & Partial<StylesProps>) {
74
- const finalStyleProps = {
75
- ...defaultStyleProps,
76
- ...getStylesProps(props)
77
- };
78
-
79
- const { className, StyleComponent } = useStyles(finalStyleProps);
80
-
81
- return (
82
- <>
83
- {StyleComponent}
84
- <WrappedComponent {...(props as P)} className={className} />
85
- </>
86
- );
87
- };
88
-
89
- // 直接使用原始组件的名称
90
- WithStyles.displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
91
- return WithStyles;
92
- }
93
-
94
- export default React.memo(Styles);
@@ -1,86 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
- import HeroBanner from '../biz-components/HeroBanner/HeroBanner.js'
3
-
4
- const meta = {
5
- title: 'Biz-Components/HeroBanner',
6
- component: HeroBanner,
7
- parameters: {
8
- layout: 'fullscreen',
9
- docs: {
10
- description: {
11
- component: `
12
- HeroBanner 组件用于展示网站的主要内容区域,通常包含标题、副标题和行动按钮。
13
-
14
- ### 特点
15
- - 支持亮色和暗色主题
16
- - 使用 Mont For Anker 字体作为标题
17
- - 可配置主按钮和次要按钮
18
- - 支持底部产品列表
19
- `,
20
- },
21
- },
22
- },
23
- tags: ['autodocs'],
24
- } satisfies Meta<typeof HeroBanner>
25
-
26
- export default meta
27
- type Story = StoryObj<typeof HeroBanner>
28
-
29
- const defaultBackground = "https://cdn.shopify.com/s/files/1/0521/9411/5753/files/aee13b30b2c77fc8d0a46e4f19fa48cb_6a25debf-f95e-4ca6-990b-babcad65216c.png?v=1745468206"
30
-
31
- export const LightTheme: Story = {
32
- args: {
33
- title: "Anker Laptop Power",
34
- subtitle: "Anker Prime 240W GaN Desktop Charger (4 Ports)",
35
- background: defaultBackground,
36
- theme: "light",
37
- primaryButton: {
38
- text: "Shop Now",
39
- onClick: () => console.log("Primary button clicked")
40
- },
41
- secondaryButton: {
42
- text: "Learn More",
43
- onClick: () => console.log("Secondary button clicked")
44
- },
45
- products: [
46
- { title: "Anker Prime 240W GaN Desktop Charger (4 Ports)", active: true },
47
- { title: "Anker Prime 27,650mAh Power Bank (250W)" },
48
- { title: "Anker Prime 240W GaN Desktop Charger (4 Ports)" }
49
- ]
50
- }
51
- }
52
-
53
- export const DarkTheme: Story = {
54
- args: {
55
- title: "Power Your Life",
56
- subtitle: "Experience the next generation of charging technology with our innovative solutions designed for modern life.",
57
- background: defaultBackground,
58
- theme: "dark",
59
- primaryButton: {
60
- text: "Shop Now",
61
- onClick: () => console.log("Primary button clicked")
62
- },
63
- secondaryButton: {
64
- text: "Learn More",
65
- onClick: () => console.log("Secondary button clicked")
66
- }
67
- }
68
- }
69
-
70
- export const WithoutSecondaryButton: Story = {
71
- args: {
72
- title: "Future of Charging",
73
- subtitle: "Step into the future with our revolutionary charging solutions that redefine the way you power your devices.",
74
- background: defaultBackground,
75
- theme: "dark",
76
- primaryButton: {
77
- text: "Shop Now",
78
- onClick: () => console.log("Primary button clicked")
79
- },
80
- products: [
81
- { title: "Anker Prime 240W GaN Desktop Charger (4 Ports)" },
82
- { title: "Anker Prime 27,650mAh Power Bank (250W)" },
83
- { title: "Anker Prime 240W GaN Desktop Charger (4 Ports)" }
84
- ]
85
- }
86
- }
@@ -1,107 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import MemberEquity from '../biz-components/MemberEquity';
3
-
4
- const meta: Meta<typeof MemberEquity> = {
5
- title: 'Biz-Components/MemberEquity',
6
- component: MemberEquity,
7
- parameters: {
8
- layout: 'fullscreen',
9
- docs: {
10
- description: {
11
- component: `
12
- MemberEquity 组件是用于展示会员权益的组件。
13
-
14
-
15
- ### 自定义style 可用class
16
- .member-equity-title
17
- .member-equity-description
18
- .member-equity-button-primary
19
- .member-equity-button-secondary
20
- `,
21
- },
22
- },
23
- },
24
- tags: ['autodocs'],
25
- };
26
-
27
- export default meta;
28
- type Story = StoryObj<typeof MemberEquity>;
29
-
30
- // 默认样式 - 方形
31
- export const Default: Story = {
32
- args: {
33
- title: 'Become a Member Today',
34
- description: 'Gain early access to new products, exclusive deals, and opportunities to try our products for free.',
35
- backgroundImage: 'https://images.unsplash.com/photo-1484807352052-23338990c6c6',
36
- primaryButton: {
37
- text: 'Shop Now',
38
- href: '/shop',
39
- },
40
- secondaryButton: {
41
- text: 'Learn More',
42
- href: '/learn',
43
- },
44
- shape: 'square',
45
- },
46
- };
47
-
48
- // 圆角风格
49
- export const Round: Story = {
50
- args: {
51
- ...Default.args,
52
- title: 'Join Our Family',
53
- description: 'Get exclusive access to new products and special member-only discounts.',
54
- backgroundImage: 'https://images.unsplash.com/photo-1558002038-1055907df827',
55
- shape: 'round',
56
- },
57
- };
58
-
59
- // 自定义按钮
60
- export const CustomButtons: Story = {
61
- args: {
62
- ...Default.args,
63
- title: 'Premium Experience',
64
- description: 'Join our community to get early access to new products and exclusive member benefits.',
65
- backgroundImage: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e',
66
- primaryButton: {
67
- text: 'Join Now',
68
- href: '/join',
69
- },
70
- secondaryButton: {
71
- text: 'Explore Benefits',
72
- href: '/benefits',
73
- },
74
- },
75
- };
76
-
77
- // 自定义样式
78
- export const CustomStyles: Story = {
79
- args: {
80
- ...Default.args,
81
- title: 'Become a Member Today and opportunities',
82
- style: `
83
- .member-equity-title {
84
- background: linear-gradient(
85
- 90deg,
86
- #FFD700, /* 金色 (Gold) */
87
- #FFC000, /* 亮金色 (Light Gold) */
88
- #FFA500, /* 橙色 (Orange) */
89
- #FF8C00, /* 深橙色 (Dark Orange) */
90
- #FF6B00 /* 橙红色 (Red-Orange) */
91
- );
92
- -webkit-background-clip: text; /* 兼容 WebKit 浏览器 */
93
- background-clip: text;
94
- color: transparent; /* 隐藏原始文字颜色 */
95
- }
96
- .member-equity-description {
97
- color: blue;
98
- }
99
- .member-equity-button-primary {
100
- color: green;
101
- }
102
- `,
103
- event: {
104
-
105
- }
106
- },
107
- };
@@ -1,41 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import { Alert, AlertDescription, AlertTitle } from '../components/index.js'
4
- import React from 'react'
5
-
6
- const meta = {
7
- title: 'Components/Alert',
8
- component: Alert,
9
- subcomponents: {
10
- AlertTitle,
11
- AlertDescription,
12
- },
13
- parameters: {
14
- layout: 'centered',
15
- docs: {
16
- description: {
17
- component: 'Alert component',
18
- },
19
- },
20
- },
21
- tags: ['autodocs'],
22
- } satisfies Meta<typeof Alert>
23
-
24
- export default meta
25
-
26
- type Story = StoryObj<typeof meta>
27
-
28
- export const Default: Story = {
29
- args: {
30
- status: 'success',
31
- closable: true,
32
- children: (
33
- <>
34
- <AlertTitle>Success</AlertTitle>
35
- <AlertDescription>
36
- This is related to general message notifications with supporting text descriptions.
37
- </AlertDescription>
38
- </>
39
- ),
40
- },
41
- }
@@ -1,83 +0,0 @@
1
- import type { Meta } from '@storybook/react/*'
2
- import { UserIcon } from '@storybook/icons'
3
- import { Avatar, AvatarImage, AvatarFallback } from '../components/index.js'
4
-
5
- const meta = {
6
- title: 'Components/Avatar',
7
- component: Avatar,
8
- tags: ['autodocs'],
9
- subcomponents: { AvatarImage, AvatarFallback } as any,
10
- parameters: {
11
- layout: 'centered',
12
- docs: {
13
- description: {
14
- component: 'avatar组件,基于@radix-ui/react-avatar,https://www.radix-ui.com/primitives/docs/components/avatar',
15
- },
16
- },
17
- },
18
- argTypes: {
19
- size: {
20
- description: '尺寸',
21
- table: {
22
- defaultValue: { summary: 'small' },
23
- },
24
- },
25
- },
26
- } satisfies Meta<typeof Avatar>
27
-
28
- export default meta
29
-
30
- export const Default = () => (
31
- <Avatar>
32
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
33
- <AvatarFallback>CN</AvatarFallback>
34
- </Avatar>
35
- )
36
-
37
- export const AvatarType = () => (
38
- <div className="flex items-center gap-4">
39
- <Avatar>
40
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
41
- <AvatarFallback>CN</AvatarFallback>
42
- </Avatar>
43
- <Avatar>
44
- <AvatarFallback>
45
- <UserIcon />
46
- </AvatarFallback>
47
- </Avatar>
48
- <Avatar>
49
- <AvatarFallback>A</AvatarFallback>
50
- </Avatar>
51
- </div>
52
- )
53
-
54
- export const AvatarTextAdaptation = () => (
55
- <div className="flex items-center gap-4">
56
- <Avatar size="large" isAdaptation>
57
- Text
58
- </Avatar>
59
- <Avatar size="large" isAdaptation>
60
- TextTextText
61
- </Avatar>
62
- <Avatar size="large" isAdaptation>
63
- TextTextTextTextText
64
- </Avatar>
65
- </div>
66
- )
67
-
68
- export const AvatarSize = () => (
69
- <div className="flex items-center gap-4">
70
- <Avatar>
71
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
72
- <AvatarFallback>CN</AvatarFallback>
73
- </Avatar>
74
- <Avatar size="medium">
75
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
76
- <AvatarFallback>CN</AvatarFallback>
77
- </Avatar>
78
- <Avatar size="large">
79
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
80
- <AvatarFallback>CN</AvatarFallback>
81
- </Avatar>
82
- </div>
83
- )