@anker-in/headless-ui 0.0.10 → 0.0.12

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 (140) hide show
  1. package/CONTRIBUTING.md +6 -1
  2. package/dist/cjs/components/badge.js +1 -1
  3. package/dist/cjs/components/badge.js.map +2 -2
  4. package/dist/cjs/components/button.js +1 -1
  5. package/dist/cjs/components/button.js.map +2 -2
  6. package/dist/cjs/components/checkbox.d.ts +8 -1
  7. package/dist/cjs/components/checkbox.js +1 -1
  8. package/dist/cjs/components/checkbox.js.map +3 -3
  9. package/dist/cjs/components/dialog.js +1 -1
  10. package/dist/cjs/components/dialog.js.map +2 -2
  11. package/dist/cjs/components/heading.d.ts +9 -1
  12. package/dist/cjs/components/heading.js +1 -1
  13. package/dist/cjs/components/heading.js.map +3 -3
  14. package/dist/cjs/components/index.d.ts +1 -0
  15. package/dist/cjs/components/index.js +1 -1
  16. package/dist/cjs/components/index.js.map +2 -2
  17. package/dist/cjs/components/input.d.ts +1 -1
  18. package/dist/cjs/components/input.js +1 -1
  19. package/dist/cjs/components/input.js.map +2 -2
  20. package/dist/cjs/components/popover.js +1 -1
  21. package/dist/cjs/components/popover.js.map +2 -2
  22. package/dist/cjs/components/radio.d.ts +13 -2
  23. package/dist/cjs/components/radio.js +1 -1
  24. package/dist/cjs/components/radio.js.map +3 -3
  25. package/dist/cjs/components/skeleton.d.ts +6 -3
  26. package/dist/cjs/components/skeleton.js +4 -1
  27. package/dist/cjs/components/skeleton.js.map +3 -3
  28. package/dist/cjs/components/text.d.ts +8 -4
  29. package/dist/cjs/components/text.js +1 -1
  30. package/dist/cjs/components/text.js.map +3 -3
  31. package/dist/cjs/icons/spinner.js +1 -1
  32. package/dist/cjs/icons/spinner.js.map +2 -2
  33. package/dist/cjs/stories/badge.stories.js +1 -1
  34. package/dist/cjs/stories/badge.stories.js.map +2 -2
  35. package/dist/cjs/stories/button.stories.js +1 -1
  36. package/dist/cjs/stories/button.stories.js.map +2 -2
  37. package/dist/cjs/stories/checkbox.stories.d.ts +44 -3
  38. package/dist/cjs/stories/checkbox.stories.js +1 -1
  39. package/dist/cjs/stories/checkbox.stories.js.map +3 -3
  40. package/dist/cjs/stories/dialog.stories.js +1 -1
  41. package/dist/cjs/stories/dialog.stories.js.map +2 -2
  42. package/dist/cjs/stories/heading.stories.d.ts +68 -0
  43. package/dist/cjs/stories/heading.stories.js +2 -0
  44. package/dist/cjs/stories/heading.stories.js.map +7 -0
  45. package/dist/cjs/stories/input.stories.js +1 -1
  46. package/dist/cjs/stories/input.stories.js.map +2 -2
  47. package/dist/cjs/stories/popover.stories.js +1 -1
  48. package/dist/cjs/stories/popover.stories.js.map +2 -2
  49. package/dist/cjs/stories/radio.stories.d.ts +34 -3
  50. package/dist/cjs/stories/radio.stories.js +1 -1
  51. package/dist/cjs/stories/radio.stories.js.map +3 -3
  52. package/dist/cjs/stories/skeleton.stories.d.ts +9 -3
  53. package/dist/cjs/stories/skeleton.stories.js +1 -1
  54. package/dist/cjs/stories/skeleton.stories.js.map +3 -3
  55. package/dist/cjs/stories/text.stories.d.ts +57 -4
  56. package/dist/cjs/stories/text.stories.js +9 -1
  57. package/dist/cjs/stories/text.stories.js.map +3 -3
  58. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  59. package/dist/esm/components/badge.js +1 -1
  60. package/dist/esm/components/badge.js.map +2 -2
  61. package/dist/esm/components/button.js +1 -1
  62. package/dist/esm/components/button.js.map +2 -2
  63. package/dist/esm/components/checkbox.d.ts +8 -1
  64. package/dist/esm/components/checkbox.js +1 -1
  65. package/dist/esm/components/checkbox.js.map +3 -3
  66. package/dist/esm/components/dialog.js +1 -1
  67. package/dist/esm/components/dialog.js.map +2 -2
  68. package/dist/esm/components/heading.d.ts +9 -1
  69. package/dist/esm/components/heading.js +1 -1
  70. package/dist/esm/components/heading.js.map +3 -3
  71. package/dist/esm/components/index.d.ts +1 -0
  72. package/dist/esm/components/index.js +1 -1
  73. package/dist/esm/components/index.js.map +2 -2
  74. package/dist/esm/components/input.d.ts +1 -1
  75. package/dist/esm/components/input.js +1 -1
  76. package/dist/esm/components/input.js.map +2 -2
  77. package/dist/esm/components/popover.js +1 -1
  78. package/dist/esm/components/popover.js.map +2 -2
  79. package/dist/esm/components/radio.d.ts +13 -2
  80. package/dist/esm/components/radio.js +1 -1
  81. package/dist/esm/components/radio.js.map +3 -3
  82. package/dist/esm/components/skeleton.d.ts +6 -3
  83. package/dist/esm/components/skeleton.js +4 -1
  84. package/dist/esm/components/skeleton.js.map +3 -3
  85. package/dist/esm/components/text.d.ts +8 -4
  86. package/dist/esm/components/text.js +1 -1
  87. package/dist/esm/components/text.js.map +3 -3
  88. package/dist/esm/icons/spinner.js +1 -1
  89. package/dist/esm/icons/spinner.js.map +2 -2
  90. package/dist/esm/stories/badge.stories.js +1 -1
  91. package/dist/esm/stories/badge.stories.js.map +2 -2
  92. package/dist/esm/stories/button.stories.js +1 -1
  93. package/dist/esm/stories/button.stories.js.map +2 -2
  94. package/dist/esm/stories/checkbox.stories.d.ts +44 -3
  95. package/dist/esm/stories/checkbox.stories.js +1 -1
  96. package/dist/esm/stories/checkbox.stories.js.map +3 -3
  97. package/dist/esm/stories/dialog.stories.js +1 -1
  98. package/dist/esm/stories/dialog.stories.js.map +2 -2
  99. package/dist/esm/stories/heading.stories.d.ts +68 -0
  100. package/dist/esm/stories/heading.stories.js +2 -0
  101. package/dist/esm/stories/heading.stories.js.map +7 -0
  102. package/dist/esm/stories/input.stories.js +1 -1
  103. package/dist/esm/stories/input.stories.js.map +2 -2
  104. package/dist/esm/stories/popover.stories.js +1 -1
  105. package/dist/esm/stories/popover.stories.js.map +2 -2
  106. package/dist/esm/stories/radio.stories.d.ts +34 -3
  107. package/dist/esm/stories/radio.stories.js +1 -1
  108. package/dist/esm/stories/radio.stories.js.map +3 -3
  109. package/dist/esm/stories/skeleton.stories.d.ts +9 -3
  110. package/dist/esm/stories/skeleton.stories.js +1 -1
  111. package/dist/esm/stories/skeleton.stories.js.map +3 -3
  112. package/dist/esm/stories/text.stories.d.ts +57 -4
  113. package/dist/esm/stories/text.stories.js +9 -1
  114. package/dist/esm/stories/text.stories.js.map +3 -3
  115. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  116. package/package.json +1 -1
  117. package/src/components/badge.tsx +5 -5
  118. package/src/components/button.tsx +14 -14
  119. package/src/components/checkbox.tsx +33 -17
  120. package/src/components/dialog.tsx +12 -9
  121. package/src/components/heading.tsx +59 -4
  122. package/src/components/index.ts +1 -0
  123. package/src/components/input.tsx +9 -9
  124. package/src/components/popover.tsx +1 -1
  125. package/src/components/radio.tsx +60 -25
  126. package/src/components/skeleton.tsx +33 -2
  127. package/src/components/text.tsx +45 -16
  128. package/src/icons/spinner.tsx +1 -1
  129. package/src/stories/badge.stories.tsx +1 -1
  130. package/src/stories/button.stories.tsx +1 -1
  131. package/src/stories/checkbox.stories.tsx +82 -5
  132. package/src/stories/dialog.stories.tsx +8 -8
  133. package/src/stories/heading.stories.tsx +88 -0
  134. package/src/stories/input.stories.tsx +2 -2
  135. package/src/stories/popover.stories.tsx +2 -2
  136. package/src/stories/radio.stories.tsx +51 -15
  137. package/src/stories/skeleton.stories.tsx +41 -7
  138. package/src/stories/text.stories.tsx +93 -10
  139. package/src/styles/global.css +5 -5
  140. package/style.css +246 -186
@@ -1,14 +1,91 @@
1
+ import type { Meta, StoryObj } from '@storybook/react/*'
1
2
  import { Checkbox } from '../components/index'
2
3
  import React from 'react'
3
4
 
4
- export default { title: 'Components/Checkbox' }
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>
5
33
 
6
- export const Default = () => (
7
- <div className="flex items-center space-x-2">
8
- <Checkbox id="terms" />
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="ai-flex ai-flex-col ai-gap-2">
46
+ <div className="ai-flex ai-items-center ai-space-x-2">
47
+ <Checkbox id="terms" size="sm" />
48
+ <label
49
+ htmlFor="terms"
50
+ className="ai-text-sm ai-font-medium ai-leading-none peer-disabled:ai-cursor-not-allowed peer-disabled:ai-opacity-70"
51
+ >
52
+ Accept terms and conditions
53
+ </label>
54
+ </div>
55
+ <div className="ai-flex ai-items-center ai-space-x-2">
56
+ <Checkbox id="terms1" size="base" />
57
+ <label
58
+ htmlFor="terms1"
59
+ className="ai-text-base ai-font-medium ai-leading-none peer-disabled:ai-cursor-not-allowed peer-disabled:ai-opacity-70"
60
+ >
61
+ Accept terms and conditions
62
+ </label>
63
+ </div>
64
+ <div className="ai-flex ai-items-center ai-space-x-2">
65
+ <Checkbox id="terms2" size="lg" />
66
+ <label
67
+ htmlFor="terms2"
68
+ className="ai-text-lg ai-font-medium ai-leading-none peer-disabled:ai-cursor-not-allowed peer-disabled:ai-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="ai-flex ai-items-center ai-space-x-2">
85
+ <Checkbox id="terms" disabled />
9
86
  <label
10
87
  htmlFor="terms"
11
- className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
88
+ className="ai-text-sm ai-font-medium ai-leading-none peer-disabled:ai-cursor-not-allowed peer-disabled:ai-opacity-70"
12
89
  >
13
90
  Accept terms and conditions
14
91
  </label>
@@ -18,23 +18,23 @@ export const Default = () => (
18
18
  <DialogTrigger asChild>
19
19
  <button>Edit Profile</button>
20
20
  </DialogTrigger>
21
- <DialogContent className="sm:max-w-[425px]">
21
+ <DialogContent className="sm:ai-max-w-[425px]">
22
22
  <DialogHeader>
23
23
  <DialogTitle>Edit profile</DialogTitle>
24
24
  <DialogDescription>Make changes to your profile here. Click save when you're done.</DialogDescription>
25
25
  </DialogHeader>
26
- <div className="grid gap-4 py-4">
27
- <div className="grid grid-cols-4 items-center gap-4">
28
- <label htmlFor="name" className="text-right">
26
+ <div className="ai-grid ai-gap-4 ai-py-4">
27
+ <div className="ai-grid ai-grid-cols-4 ai-items-center ai-gap-4">
28
+ <label htmlFor="name" className="ai-text-right">
29
29
  Name
30
30
  </label>
31
- <Input id="name" defaultValue="Pedro Duarte" className="col-span-3" />
31
+ <Input id="name" defaultValue="Pedro Duarte" className="ai-col-span-3" />
32
32
  </div>
33
- <div className="grid grid-cols-4 items-center gap-4">
34
- <label htmlFor="username" className="text-right">
33
+ <div className="ai-grid ai-grid-cols-4 ai-items-center ai-gap-4">
34
+ <label htmlFor="username" className="ai-text-right">
35
35
  Username
36
36
  </label>
37
- <Input id="username" defaultValue="@peduarte" className="col-span-3" />
37
+ <Input id="username" defaultValue="@peduarte" className="ai-col-span-3" />
38
38
  </div>
39
39
  </div>
40
40
  <DialogFooter>
@@ -0,0 +1,88 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import { Heading } from '../components/index'
4
+ import React from 'react'
5
+
6
+ const meta = {
7
+ title: 'Typography/Heading',
8
+ component: Heading,
9
+ parameters: {
10
+ layout: 'centered',
11
+ docs: {
12
+ description: {
13
+ component: 'Heading 组件, 基本和text 组件一样,只是默认的标签类型不一样',
14
+ },
15
+ },
16
+ },
17
+ tags: ['autodocs'],
18
+ argTypes: {
19
+ size: {
20
+ control: {
21
+ type: 'select',
22
+ },
23
+ options: [1, 2, 3, 4, 5, 6, 7, 8, 9],
24
+ description: '1~9',
25
+ table: {
26
+ defaultValue: { summary: '3' },
27
+ },
28
+ },
29
+ weights: {
30
+ control: {
31
+ type: 'select',
32
+ },
33
+ options: ['light', 'normal', 'medium', 'bold'],
34
+ table: {
35
+ defaultValue: { summary: 'normal' },
36
+ },
37
+ },
38
+ color: {
39
+ control: 'color',
40
+ },
41
+ as: {
42
+ control: {
43
+ type: 'select',
44
+ },
45
+ options: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
46
+ description: 'html 标签类型',
47
+ table: {
48
+ defaultValue: { summary: 'h1' },
49
+ },
50
+ },
51
+ html: {
52
+ type: 'string',
53
+ description: '相当于 dangerouslySetInnerHTML',
54
+ },
55
+ },
56
+ args: {
57
+ as: 'h1',
58
+ size: 3,
59
+ weights: 'normal',
60
+ },
61
+ } satisfies Meta<typeof Heading>
62
+
63
+ export default meta
64
+
65
+ type Story = StoryObj<typeof meta>
66
+
67
+ export const Default: Story = {
68
+ args: {
69
+ as: 'h1',
70
+ children: ' The quick brown fox jumps over the lazy dog.',
71
+ },
72
+ }
73
+
74
+ export const All: Story = {
75
+ render: () => (
76
+ <>
77
+ <Heading size={1}>The quick brown fox jumps over the lazy dog.</Heading>
78
+ <Heading size={2}>The quick brown fox jumps over the lazy dog.</Heading>
79
+ <Heading size={3}>The quick brown fox jumps over the lazy dog.</Heading>
80
+ <Heading size={4}>The quick brown fox jumps over the lazy dog.</Heading>
81
+ <Heading size={5}>The quick brown fox jumps over the lazy dog.</Heading>
82
+ <Heading size={6}>The quick brown fox jumps over the lazy dog.</Heading>
83
+ <Heading size={7}>The quick brown fox jumps over the lazy dog.</Heading>
84
+ <Heading size={8}>The quick brown fox jumps over the lazy dog.</Heading>
85
+ <Heading size={9}>The quick brown fox jumps over the lazy dog.</Heading>
86
+ </>
87
+ ),
88
+ }
@@ -36,9 +36,9 @@ export const Default: Story = {
36
36
  export const WithButton: Story = {
37
37
  render() {
38
38
  return (
39
- <Input className="rounded-3xl pr-0" placeholder="Enter your email" type="text">
39
+ <Input className="ai-rounded-3xl ai-pr-0" placeholder="Enter your email" type="text">
40
40
  <InputSlot side="right">
41
- <Button className="h-full rounded-none" size="sm">
41
+ <Button className="ai-h-full ai-rounded-none" size="sm">
42
42
  subscribe
43
43
  </Button>
44
44
  </InputSlot>
@@ -8,8 +8,8 @@ export const Default = () => (
8
8
  <PopoverTrigger asChild>
9
9
  <button>Open popover</button>
10
10
  </PopoverTrigger>
11
- <PopoverContent className="w-80">
12
- <div className="grid gap-4">
11
+ <PopoverContent className="ai-w-80">
12
+ <div className="ai-grid ai-gap-4">
13
13
  <p>
14
14
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
15
15
  standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to
@@ -1,19 +1,55 @@
1
+ import type { Meta, StoryObj } from '@storybook/react/*'
1
2
  import { RadioGroup, RadioGroupItem } from '../components/index'
2
3
  import React from 'react'
3
4
 
4
- export default { title: 'Components/Radio' }
5
+ const meta = {
6
+ title: 'Components/Radio',
7
+ component: RadioGroup,
8
+ // subcomponents: { RadioGroupItem },
9
+ parameters: {
10
+ layout: 'centered',
11
+ docs: {
12
+ description: {
13
+ component:
14
+ '单选框, 基于@radix-ui/react-radio-group https://www.radix-ui.com/primitives/docs/components/radio-group',
15
+ },
16
+ },
17
+ },
18
+ tags: ['autodocs'],
19
+ argTypes: {
20
+ size: {
21
+ control: {
22
+ type: 'select',
23
+ },
24
+ options: ['sm', 'base', 'lg'],
25
+ description: '尺寸',
26
+ table: {
27
+ defaultValue: { summary: 'base' },
28
+ },
29
+ },
30
+ },
31
+ args: {
32
+ size: 'base',
33
+ },
34
+ } satisfies Meta<typeof RadioGroup>
5
35
 
6
- export const Default = () => (
7
- <div className="flex h-40 w-48 items-center justify-center">
8
- <RadioGroup defaultValue="option-one">
9
- <div className="flex items-center space-x-2">
10
- <RadioGroupItem value="option-one" id="option-one" />
11
- <label htmlFor="option-one">Option One</label>
12
- </div>
13
- <div className="flex items-center space-x-2">
14
- <RadioGroupItem value="option-two" id="option-two" />
15
- <label htmlFor="option-two">Option Two</label>
16
- </div>
17
- </RadioGroup>
18
- </div>
19
- )
36
+ export default meta
37
+
38
+ type Story = StoryObj<typeof RadioGroup>
39
+ export const Default: Story = {
40
+ args: {
41
+ size: 'base',
42
+ children: (
43
+ <>
44
+ <div className="ai-flex ai-items-center ai-space-x-2">
45
+ <RadioGroupItem value="option-one" id="option-one" />
46
+ <label htmlFor="option-one">Option One</label>
47
+ </div>
48
+ <div className="ai-flex ai-items-center ai-space-x-2">
49
+ <RadioGroupItem value="option-two" id="option-two" />
50
+ <label htmlFor="option-two">Option Two</label>
51
+ </div>
52
+ </>
53
+ ),
54
+ },
55
+ }
@@ -8,6 +8,12 @@ const meta = {
8
8
  component: Skeleton,
9
9
  parameters: {
10
10
  layout: 'centered',
11
+ docs: {
12
+ description: {
13
+ component:
14
+ '骨架屏组件,用来在数据加载时展示一个占位图, 可以包在dom 外使用,通过loading 控制显示隐藏, 也可以单独使用,通过自定义class控制样式, 组合成想要的形状',
15
+ },
16
+ },
11
17
  },
12
18
  tags: ['autodocs'],
13
19
  } satisfies Meta<typeof Skeleton>
@@ -16,18 +22,46 @@ export default meta
16
22
 
17
23
  type Story = StoryObj<typeof meta>
18
24
 
19
- export const Default: Story = {}
25
+ export const Default: Story = {
26
+ args: {
27
+ loading: true,
28
+ children: (
29
+ <div className="ai-h-14 ai-rounded-3xl ai-overflow-hidden ai-px-4 ai-py-4 w-full">
30
+ Fog creeps across moors, hills, and rivers. It adds an eerie charm to the landscape, but also complicates
31
+ driving.
32
+ </div>
33
+ ),
34
+ },
35
+ }
20
36
 
21
- export const Example: Story = {
37
+ export const Multiple: Story = {
22
38
  render() {
23
39
  return (
24
- <div className="flex flex-col items-center justify-center">
25
- <div className="flex w-full justify-between">
26
- <Skeleton className="size-12 rounded-full" />
27
- <Skeleton className="h-12 w-[70%] " />
40
+ <div className="ai-flex ai-flex-col ai-items-center ai-justify-center">
41
+ <div className="ai-flex ai-w-full ai-justify-between">
42
+ <Skeleton className="ai-size-12 ai-rounded-full" />
43
+ <Skeleton className="ai-h-12 ai-w-[70%] " />
28
44
  </div>
29
- <Skeleton className="mt-2 h-40 w-[200px]" />
45
+ <Skeleton className="ai-mt-2 ai-h-40 ai-w-[200px]" />
30
46
  </div>
31
47
  )
32
48
  },
33
49
  }
50
+
51
+ export const WithText: Story = {
52
+ render() {
53
+ return (
54
+ <>
55
+ <Skeleton loading={true}>
56
+ Rainfall is a constant companion. Umbrellas are practically a national accessory. Expect drizzles, showers,
57
+ and downpours, often accompanied by gray skies.
58
+ </Skeleton>
59
+ <hr />
60
+ <Skeleton loading={false}>
61
+ Rainfall is a constant companion. Umbrellas are practically a national accessory. Expect drizzles, showers,
62
+ and downpours, often accompanied by gray skies.
63
+ </Skeleton>
64
+ </>
65
+ )
66
+ },
67
+ }
@@ -4,12 +4,59 @@ import { Text } from '../components/index'
4
4
  import React from 'react'
5
5
 
6
6
  const meta = {
7
- title: 'Components/Text',
7
+ title: 'Typography/Text',
8
8
  component: Text,
9
9
  parameters: {
10
10
  layout: 'centered',
11
+ docs: {
12
+ description: {
13
+ component: '文本组件, 简单封装了常用的样式字段,用于展示文本内容.',
14
+ },
15
+ },
11
16
  },
12
17
  tags: ['autodocs'],
18
+ argTypes: {
19
+ size: {
20
+ control: {
21
+ type: 'select',
22
+ },
23
+ options: [1, 2, 3, 4, 5, 6, 7, 8, 9],
24
+ table: {
25
+ defaultValue: { summary: '3' },
26
+ },
27
+ },
28
+ weights: {
29
+ control: {
30
+ type: 'select',
31
+ },
32
+ options: ['light', 'normal', 'medium', 'bold'],
33
+ table: {
34
+ defaultValue: { summary: 'normal' },
35
+ },
36
+ },
37
+ color: {
38
+ control: 'color',
39
+ },
40
+ as: {
41
+ control: {
42
+ type: 'select',
43
+ },
44
+ description: 'html 标签类型',
45
+ options: ['div', 'label', 'p', 'span'],
46
+ table: {
47
+ defaultValue: { summary: 'span' },
48
+ },
49
+ },
50
+ html: {
51
+ type: 'string',
52
+ description: '相当于 dangerouslySetInnerHTML',
53
+ },
54
+ },
55
+ args: {
56
+ size: 3,
57
+ weights: 'normal',
58
+ html: '',
59
+ },
13
60
  } satisfies Meta<typeof Text>
14
61
 
15
62
  export default meta
@@ -18,20 +65,56 @@ type Story = StoryObj<typeof meta>
18
65
  export const Default: Story = {
19
66
  args: {
20
67
  children: ' The quick brown fox jumps over the lazy dog.',
68
+ size: 3,
69
+ weights: 'normal',
70
+ },
71
+ }
72
+
73
+ export const Sizes: Story = {
74
+ render() {
75
+ return (
76
+ <div className="ai-flex ai-flex-col">
77
+ <Text size={1}>The quick brown fox jumps over the lazy dog.</Text>
78
+ <Text size={2}>The quick brown fox jumps over the lazy dog.</Text>
79
+ <Text size={3}>The quick brown fox jumps over the lazy dog.</Text>
80
+ <Text size={4}>The quick brown fox jumps over the lazy dog.</Text>
81
+ <Text size={5}>The quick brown fox jumps over the lazy dog.</Text>
82
+ <Text size={6}>The quick brown fox jumps over the lazy dog.</Text>
83
+ <Text size={7}>The quick brown fox jumps over the lazy dog.</Text>
84
+ <Text size={8}>The quick brown fox jumps over the lazy dog.</Text>
85
+ <Text size={9}>The quick brown fox jumps over the lazy dog.</Text>
86
+ </div>
87
+ )
88
+ },
89
+ }
90
+
91
+ export const Weights: Story = {
92
+ render() {
93
+ return (
94
+ <div className="ai-flex ai-flex-col">
95
+ <Text weights="light">The quick brown fox jumps over the lazy dog.</Text>
96
+ <Text weights="normal">The quick brown fox jumps over the lazy dog.</Text>
97
+ <Text weights="medium">The quick brown fox jumps over the lazy dog.</Text>
98
+ <Text weights="bold">The quick brown fox jumps over the lazy dog.</Text>
99
+ </div>
100
+ )
21
101
  },
22
102
  }
23
103
 
24
- const sizes = new Array(10).fill(0).map((_, i) => i + 1)
25
- export const All: Story = {
104
+ export const Html: Story = {
26
105
  render() {
27
106
  return (
28
- <>
29
- {sizes.map(size => (
30
- <Text as="p" key={size} size={size as any}>
31
- The quick brown fox jumps over the lazy dog.
32
- </Text>
33
- ))}
34
- </>
107
+ <Text
108
+ html={`The <span style='font-size:20px;font:bold; -webkit-background-clip: text; background: linear-gradient(
109
+ to right,
110
+ #00ff00, /* 绿色 */
111
+ #00ff99, /* 浅绿色 */
112
+ #00ffff, /* 青色 */
113
+ #0099ff, /* 浅蓝色 */
114
+ #8000ff, /* 紫色 */
115
+ #ff00ff /* 粉色 */
116
+ );color: transparent;background-clip: text;'>quick brown fox</span> <br/> jumps over the lazy dog.`}
117
+ />
35
118
  )
36
119
  },
37
120
  }
@@ -154,17 +154,17 @@
154
154
  --brand-color-1: #e42d46;
155
155
  }
156
156
 
157
- /* TODO: */
157
+
158
158
  :root[data-brand-theme='soundcore'] {
159
- --btn-bg-color: #17bbef;
159
+ --btn-bg-color: #17BBEF;
160
160
  --btn-text-color: #ffffff;
161
161
  --btn-bg-color-active: #48cffa;
162
162
  --btn-bg-disabled-color: #ccdfe8;
163
163
 
164
164
  --btn-bg-secondary-color: #ffffff;
165
- --btn-text-secondary-color: #333333;
166
- --btn-bg-secondary-active-color: #555555;
167
- --btn-bg-secondary-disabled-color: #f5f5f5;
165
+ --btn-text-secondary-color: #17BBEF;
166
+ --btn-bg-secondary-active-color: #17BBEF;
167
+ --btn-bg-secondary-disabled-color: #17BBEF;
168
168
 
169
169
  --btn-radius: 30px;
170
170