@anker-in/headless-ui 0.0.21 → 0.0.23

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 (131) hide show
  1. package/CONTRIBUTING.md +16 -11
  2. package/dist/cjs/components/button.d.ts +1 -0
  3. package/dist/cjs/components/button.js +1 -1
  4. package/dist/cjs/components/button.js.map +3 -3
  5. package/dist/cjs/components/heading.js +1 -1
  6. package/dist/cjs/components/heading.js.map +2 -2
  7. package/dist/cjs/components/index.d.ts +1 -0
  8. package/dist/cjs/components/index.js +1 -1
  9. package/dist/cjs/components/index.js.map +3 -3
  10. package/dist/cjs/components/picture.d.ts +13 -0
  11. package/dist/cjs/components/picture.js +2 -0
  12. package/dist/cjs/components/picture.js.map +7 -0
  13. package/dist/cjs/components/text.js +1 -1
  14. package/dist/cjs/components/text.js.map +2 -2
  15. package/dist/cjs/helpers/index.d.ts +1 -0
  16. package/dist/cjs/helpers/index.js +1 -1
  17. package/dist/cjs/helpers/index.js.map +2 -2
  18. package/dist/cjs/helpers/utils.d.ts +1 -0
  19. package/dist/cjs/helpers/utils.js +1 -1
  20. package/dist/cjs/helpers/utils.js.map +3 -3
  21. package/dist/cjs/stories/badge.stories.d.ts +1 -1
  22. package/dist/cjs/stories/badge.stories.js +1 -1
  23. package/dist/cjs/stories/badge.stories.js.map +2 -2
  24. package/dist/cjs/stories/button.stories.d.ts +1 -1
  25. package/dist/cjs/stories/button.stories.js +1 -1
  26. package/dist/cjs/stories/button.stories.js.map +2 -2
  27. package/dist/cjs/stories/checkbox.stories.d.ts +3 -3
  28. package/dist/cjs/stories/checkbox.stories.js +1 -1
  29. package/dist/cjs/stories/checkbox.stories.js.map +2 -2
  30. package/dist/cjs/stories/dialog.stories.d.ts +1 -1
  31. package/dist/cjs/stories/dialog.stories.js +1 -1
  32. package/dist/cjs/stories/dialog.stories.js.map +2 -2
  33. package/dist/cjs/stories/heading.stories.d.ts +2 -2
  34. package/dist/cjs/stories/heading.stories.js +1 -1
  35. package/dist/cjs/stories/heading.stories.js.map +2 -2
  36. package/dist/cjs/stories/input.stories.d.ts +1 -1
  37. package/dist/cjs/stories/input.stories.js +1 -1
  38. package/dist/cjs/stories/input.stories.js.map +2 -2
  39. package/dist/cjs/stories/picture.stories.d.ts +18 -0
  40. package/dist/cjs/stories/picture.stories.js +4 -0
  41. package/dist/cjs/stories/picture.stories.js.map +7 -0
  42. package/dist/cjs/stories/popover.stories.d.ts +1 -1
  43. package/dist/cjs/stories/popover.stories.js +1 -1
  44. package/dist/cjs/stories/popover.stories.js.map +2 -2
  45. package/dist/cjs/stories/radio.stories.d.ts +4 -4
  46. package/dist/cjs/stories/radio.stories.js +1 -1
  47. package/dist/cjs/stories/radio.stories.js.map +2 -2
  48. package/dist/cjs/stories/skeleton.stories.d.ts +1 -1
  49. package/dist/cjs/stories/skeleton.stories.js +1 -1
  50. package/dist/cjs/stories/skeleton.stories.js.map +2 -2
  51. package/dist/cjs/stories/text.stories.d.ts +3 -2
  52. package/dist/cjs/stories/text.stories.js +1 -1
  53. package/dist/cjs/stories/text.stories.js.map +2 -2
  54. package/dist/cjs/tsconfig.tsbuildinfo +1 -0
  55. package/dist/esm/components/button.d.ts +1 -0
  56. package/dist/esm/components/button.js +1 -1
  57. package/dist/esm/components/button.js.map +3 -3
  58. package/dist/esm/components/heading.d.ts +1 -1
  59. package/dist/esm/components/heading.js +1 -1
  60. package/dist/esm/components/heading.js.map +2 -2
  61. package/dist/esm/components/index.d.ts +1 -0
  62. package/dist/esm/components/index.js +1 -1
  63. package/dist/esm/components/index.js.map +2 -2
  64. package/dist/esm/components/picture.d.ts +13 -0
  65. package/dist/esm/components/picture.js +2 -0
  66. package/dist/esm/components/picture.js.map +7 -0
  67. package/dist/esm/components/radio.d.ts +1 -1
  68. package/dist/esm/components/text.d.ts +1 -1
  69. package/dist/esm/components/text.js +1 -1
  70. package/dist/esm/components/text.js.map +2 -2
  71. package/dist/esm/helpers/index.d.ts +1 -0
  72. package/dist/esm/helpers/index.js +1 -1
  73. package/dist/esm/helpers/index.js.map +3 -3
  74. package/dist/esm/helpers/utils.d.ts +1 -0
  75. package/dist/esm/helpers/utils.js +1 -1
  76. package/dist/esm/helpers/utils.js.map +3 -3
  77. package/dist/esm/stories/badge.stories.d.ts +1 -1
  78. package/dist/esm/stories/badge.stories.js +1 -1
  79. package/dist/esm/stories/badge.stories.js.map +2 -2
  80. package/dist/esm/stories/button.stories.d.ts +1 -1
  81. package/dist/esm/stories/button.stories.js +1 -1
  82. package/dist/esm/stories/button.stories.js.map +2 -2
  83. package/dist/esm/stories/checkbox.stories.d.ts +3 -3
  84. package/dist/esm/stories/checkbox.stories.js +1 -1
  85. package/dist/esm/stories/checkbox.stories.js.map +2 -2
  86. package/dist/esm/stories/dialog.stories.d.ts +1 -1
  87. package/dist/esm/stories/dialog.stories.js +1 -1
  88. package/dist/esm/stories/dialog.stories.js.map +2 -2
  89. package/dist/esm/stories/heading.stories.d.ts +2 -2
  90. package/dist/esm/stories/heading.stories.js +1 -1
  91. package/dist/esm/stories/heading.stories.js.map +2 -2
  92. package/dist/esm/stories/input.stories.d.ts +1 -1
  93. package/dist/esm/stories/input.stories.js +1 -1
  94. package/dist/esm/stories/input.stories.js.map +2 -2
  95. package/dist/esm/stories/picture.stories.d.ts +18 -0
  96. package/dist/esm/stories/picture.stories.js +4 -0
  97. package/dist/esm/stories/picture.stories.js.map +7 -0
  98. package/dist/esm/stories/popover.stories.d.ts +1 -1
  99. package/dist/esm/stories/popover.stories.js +1 -1
  100. package/dist/esm/stories/popover.stories.js.map +2 -2
  101. package/dist/esm/stories/radio.stories.d.ts +4 -4
  102. package/dist/esm/stories/radio.stories.js +1 -1
  103. package/dist/esm/stories/radio.stories.js.map +2 -2
  104. package/dist/esm/stories/skeleton.stories.d.ts +1 -1
  105. package/dist/esm/stories/skeleton.stories.js +1 -1
  106. package/dist/esm/stories/skeleton.stories.js.map +2 -2
  107. package/dist/esm/stories/text.stories.d.ts +3 -2
  108. package/dist/esm/stories/text.stories.js +2 -2
  109. package/dist/esm/stories/text.stories.js.map +2 -2
  110. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  111. package/package.json +2 -1
  112. package/src/components/button.tsx +35 -11
  113. package/src/components/heading.tsx +1 -13
  114. package/src/components/index.ts +1 -0
  115. package/src/components/picture.tsx +99 -0
  116. package/src/components/text.tsx +1 -2
  117. package/src/helpers/index.ts +1 -0
  118. package/src/helpers/utils.ts +2 -0
  119. package/src/stories/badge.stories.tsx +1 -1
  120. package/src/stories/button.stories.tsx +1 -1
  121. package/src/stories/checkbox.stories.tsx +1 -1
  122. package/src/stories/dialog.stories.tsx +1 -1
  123. package/src/stories/heading.stories.tsx +3 -3
  124. package/src/stories/input.stories.tsx +1 -1
  125. package/src/stories/picture.stories.tsx +51 -0
  126. package/src/stories/popover.stories.tsx +1 -1
  127. package/src/stories/radio.stories.tsx +1 -1
  128. package/src/stories/skeleton.stories.tsx +1 -1
  129. package/src/stories/text.stories.tsx +5 -4
  130. package/src/styles/global.css +9 -9
  131. package/style.css +18 -17
@@ -11,14 +11,13 @@ import { cn } from '../helpers/index.js'
11
11
  * Button Variants
12
12
  */
13
13
  const buttonVariants = cva(
14
- 'ai-ring-offset-background focus-visible:ai-ring-ring ai-rounded-btn ai-inline-flex ai-items-center ai-justify-center ai-whitespace-nowrap ai-text-sm ai-font-medium ai-transition-colors focus-visible:ai-outline-none focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2 disabled:ai-pointer-events-none disabled:ai-opacity-50',
14
+ 'ai-ring-offset-background focus-visible:ai-ring-ring ai-rounded-btn ai-inline-flex ai-items-center ai-justify-center ai-whitespace-nowrap ai-text-sm ai-font-medium ai-transition-colors focus-visible:ai-outline-none focus-visible:ai-ring-2 focus-visible:ai-ring-offset-2 disabled:ai-pointer-events-none',
15
15
  {
16
16
  variants: {
17
17
  variant: {
18
- primary:
19
- 'ai-bg-btn-primary ai-text-btn-primary-foreground hover:ai-bg-btn-primary-active disabled:ai-bg-btn-primary-disabled disabled:ai-text-btn-primary-disabled-foreground',
18
+ primary: 'ai-bg-btn-primary ai-text-btn-primary-foreground hover:ai-bg-btn-primary-active ',
20
19
  secondary:
21
- 'ai-bg-btn-secondary ai-border-primary ai-text-btn-secondary-foreground hover:ai-bg-btn-secondary-active hover:ai-text-btn-secondary disabled:ai-bg-btn-secondary-disabled disabled:ai-text-btn-secondary-disabled-foreground ai-border ai-border-solid',
20
+ 'ai-bg-btn-secondary ai-border-primary ai-text-btn-secondary-foreground hover:ai-bg-btn-secondary-active hover:ai-text-btn-secondary ai-border ai-border-solid',
22
21
  link: 'ai-text-primary ai-underline-offset-4 hover:ai-underline',
23
22
  ghost: 'hover:ai-bg-btn-primary hover:ai-text-btn-primary-foreground',
24
23
  },
@@ -33,6 +32,11 @@ const buttonVariants = cva(
33
32
  none: '',
34
33
  slide: '',
35
34
  },
35
+ state: {
36
+ default: '',
37
+ disabled: '!ai-cursor-not-allowed !ai-pointer-events-auto',
38
+ loading: '',
39
+ },
36
40
  },
37
41
  compoundVariants: [
38
42
  {
@@ -47,11 +51,33 @@ const buttonVariants = cva(
47
51
  class:
48
52
  'ai-z-[1] before:-ai-z-[1] before:ai-rounded-btn hover:!ai-bg-btn-secondary before:ai-bg-btn-secondary-active ai-relative ai-overflow-hidden before:ai-absolute before:ai-inset-y-0 before:ai-w-full before:-ai-translate-x-full before:ai-transition-transform before:ai-duration-300 before:ai-ease-in-out before:ai-content-[""] hover:before:ai-translate-x-0',
49
53
  },
54
+ {
55
+ variant: 'primary',
56
+ state: 'loading',
57
+ class: 'ai-bg-btn-primary',
58
+ },
59
+ {
60
+ variant: 'secondary',
61
+ state: 'loading',
62
+ class:
63
+ 'ai-bg-btn-secondary disabled:ai-bg-btn-secondary-disabled disabled:ai-text-btn-secondary-disabled-foreground',
64
+ },
65
+ {
66
+ variant: 'primary',
67
+ state: 'disabled',
68
+ class: 'disabled:ai-bg-btn-primary-disabled disabled:ai-text-btn-primary-disabled-foreground',
69
+ },
70
+ {
71
+ variant: 'secondary',
72
+ state: 'disabled',
73
+ class: 'disabled:ai-bg-btn-secondary-disabled disabled:ai-text-btn-secondary-disabled-foreground',
74
+ },
50
75
  ],
51
76
  defaultVariants: {
52
77
  variant: 'primary',
53
78
  size: 'base',
54
79
  hoverEffect: 'none',
80
+ state: 'default',
55
81
  },
56
82
  }
57
83
  )
@@ -65,6 +91,9 @@ const loadingSvgVariants = cva('', {
65
91
  ghost: 'ai-stroke-primary',
66
92
  },
67
93
  },
94
+ defaultVariants: {
95
+ variant: 'primary',
96
+ },
68
97
  })
69
98
 
70
99
  export interface ButtonProps
@@ -98,17 +127,12 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
98
127
  ) => {
99
128
  const Comp = asChild ? Slot : 'button'
100
129
  const isInactive = disabled || loading
130
+ const state = loading ? 'loading' : disabled ? 'disabled' : 'default'
101
131
 
102
132
  return (
103
133
  <Comp
104
134
  disabled={isInactive}
105
- className={cn(
106
- buttonVariants({ variant, size, hoverEffect }),
107
- {
108
- 'ai-cursor-not-allowed': isInactive,
109
- },
110
- className
111
- )}
135
+ className={cn(buttonVariants({ variant, size, hoverEffect, state }), className)}
112
136
  ref={ref}
113
137
  {...props}
114
138
  >
@@ -32,7 +32,6 @@ const headingVariants = cva('', {
32
32
  defaultVariants: {
33
33
  size: 'none',
34
34
  weights: 'normal',
35
- align: 'left',
36
35
  },
37
36
  })
38
37
 
@@ -46,18 +45,7 @@ interface HeadingProps extends React.ComponentPropsWithoutRef<'h1'>, VariantProp
46
45
  }
47
46
 
48
47
  const Heading = React.forwardRef<HeadingElement, HeadingProps>((props, forwardedRef) => {
49
- const {
50
- children,
51
- className,
52
- size,
53
- align = 'left',
54
- weights,
55
- asChild,
56
- as: Tag = 'h1',
57
- color,
58
- html,
59
- ...headingProps
60
- } = props
48
+ const { children, className, size, align, weights, asChild, as: Tag = 'h1', color, html, ...headingProps } = props
61
49
  const htmlContentProps = html
62
50
  ? {
63
51
  dangerouslySetInnerHTML: { __html: html },
@@ -15,4 +15,5 @@ export * from './radio.js'
15
15
  export * from './dialog.js'
16
16
  export * from './text.js'
17
17
  export * from './heading.js'
18
+ export { default as Picture } from './picture.js'
18
19
  export { default as Theme } from './theme.js'
@@ -0,0 +1,99 @@
1
+ 'use client'
2
+ import React, { useCallback, useMemo } from 'react'
3
+
4
+ const APPEND_FILE_SUFFIX_MATCH_DOMAIN = ['cdn.shopify.com', 'cdn.shopifycdn.net', 'www.facebook.com']
5
+
6
+ const MAX_SIZE = 3960
7
+ const FIXED_MAX_SIZE = 3980
8
+
9
+ export interface PictureProps extends React.ImgHTMLAttributes<HTMLImageElement> {
10
+ /** picture 内部img 标签的类名 */
11
+ imgClassName?: string
12
+ /** 图片url , 支持传入不同分辨率下的图片,比如,格式 "url1 1920, url2 1080, url3 767" */
13
+ source?: string
14
+ /** 图片质量 */
15
+ quality?: number
16
+ /** 响应式图片,对应picture 下source 的max-width */
17
+ deviceSizes?: number[]
18
+ }
19
+
20
+ const isMatchDomain = (srcDomain: string) => {
21
+ return APPEND_FILE_SUFFIX_MATCH_DOMAIN.some(domain => srcDomain == domain)
22
+ }
23
+ const idMatchFileExtensions = (fileName: string = '') => /\.(png|apng|jpg|jpeg|gif|svg|webp|tif)/.test(fileName)
24
+
25
+ const Picture = ({
26
+ imgClassName = '',
27
+ source = '',
28
+ quality = 2,
29
+ deviceSizes = [375, 767, 1023, 1279, 1439, 1539, 1919],
30
+ ...rest
31
+ }: PictureProps) => {
32
+ const imgSrcSetsize = useCallback(({ src, width }: { src: string; width: number }) => {
33
+ const size = width
34
+ try {
35
+ const parsedUrl = new URL(src)
36
+ if (!isMatchDomain(parsedUrl.hostname)) {
37
+ return src
38
+ }
39
+ const fileName = parsedUrl.pathname.split('/').pop() || ''
40
+ if (idMatchFileExtensions(fileName) && !/_[0-9]{2,4}x/.test(src)) {
41
+ const [name, extension] = fileName.split('.')
42
+ return `${parsedUrl.origin}${parsedUrl.pathname.replace(
43
+ fileName,
44
+ `${name}_${size < MAX_SIZE ? size : FIXED_MAX_SIZE}x.${extension}`
45
+ )}`
46
+ }
47
+ } catch (error) {
48
+ return src
49
+ }
50
+ }, [])
51
+
52
+ const sourceSrcSet = useCallback(
53
+ ({ srcArr, width }: { srcArr: string[][]; width: number }) => {
54
+ const computedWidth = width * quality
55
+ const def = imgSrcSetsize({ src: srcArr[0][0], width: computedWidth })
56
+ let result
57
+ srcArr.forEach(ele => {
58
+ var img = ele[0]
59
+ if (ele.length > 1 && parseInt(ele[1], 10) >= width) {
60
+ result = imgSrcSetsize({ src: img, width: computedWidth })
61
+ }
62
+ })
63
+ const srcset = result || def
64
+ return <source key={width} srcSet={srcset} media={`(max-width: ${width}px)`} />
65
+ },
66
+ [imgSrcSetsize, quality]
67
+ )
68
+
69
+ const sourceList = useMemo(() => {
70
+ if (typeof source !== 'string' || !source) return []
71
+ let srcArr
72
+ try {
73
+ srcArr = source
74
+ .replace(/[\r\n]/g, '')
75
+ .replace(/\s\s+/g, ' ')
76
+ .split(',')
77
+ .map(item => item.split(' ').filter(Boolean))
78
+ } catch (error) {
79
+ console.log(error)
80
+ return []
81
+ }
82
+ const sourceList = deviceSizes.map(width => {
83
+ return sourceSrcSet({ srcArr, width })
84
+ })
85
+
86
+ const img = imgSrcSetsize({ src: srcArr[0][0], width: 1920 * quality })
87
+
88
+ sourceList.push(<img key="default" src={img} className={`ai-w-full ${imgClassName}`} {...rest} />)
89
+ return sourceList
90
+ }, [deviceSizes, imgClassName, imgSrcSetsize, quality, rest, source, sourceSrcSet])
91
+
92
+ return (
93
+ <picture className={`ai-block ai-overflow-hidden ${rest.className}`}>
94
+ {sourceList}
95
+ {rest.children}
96
+ </picture>
97
+ )
98
+ }
99
+ export default Picture
@@ -33,7 +33,6 @@ const textVariants = cva('', {
33
33
  defaultVariants: {
34
34
  size: 'none',
35
35
  weights: 'normal',
36
- align: 'left',
37
36
  },
38
37
  })
39
38
 
@@ -58,7 +57,7 @@ const Text = React.forwardRef<TextElement, TextProps>((props, forwardedRef) => {
58
57
  children,
59
58
  size = 'none',
60
59
  weights,
61
- align = 'left',
60
+ align,
62
61
  className,
63
62
  asChild,
64
63
  as: Tag = 'span',
@@ -1 +1,2 @@
1
1
  export { cn } from './utils.js'
2
+ export { noop } from './utils.js'
@@ -4,3 +4,5 @@ import { twMerge } from 'tailwind-merge'
4
4
  export function cn(...inputs: ClassValue[]) {
5
5
  return twMerge(clsx(inputs))
6
6
  }
7
+
8
+ export function noop(): any {}
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react'
2
2
 
3
- import { Badge } from '../components/index'
3
+ import { Badge } from '../components/index.js'
4
4
  import React from 'react'
5
5
 
6
6
  const meta = {
@@ -1,7 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react'
2
2
  import { SearchIcon } from '@storybook/icons'
3
3
 
4
- import { Button } from '../components/index'
4
+ import { Button } from '../components/index.js'
5
5
  import React from 'react'
6
6
 
7
7
  // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react/*'
2
- import { Checkbox } from '../components/index'
2
+ import { Checkbox } from '../components/index.js'
3
3
  import React from 'react'
4
4
 
5
5
  const meta = {
@@ -9,7 +9,7 @@ import {
9
9
  DialogTitle,
10
10
  DialogTrigger,
11
11
  Input,
12
- } from '../components/index'
12
+ } from '../components/index.js'
13
13
  import type { Meta, StoryObj } from '@storybook/react/*'
14
14
 
15
15
  const meta = {
@@ -1,13 +1,13 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react'
2
2
 
3
- import { Heading } from '../components/index'
3
+ import { Heading } from '../components/index.js'
4
4
  import React from 'react'
5
5
 
6
6
  const meta = {
7
7
  title: 'Typography/Heading',
8
8
  component: Heading,
9
9
  parameters: {
10
- layout: 'centered',
10
+ layout: 'padded',
11
11
  docs: {
12
12
  description: {
13
13
  component: 'Heading 组件, 基本和text 组件一样,只是默认的标签类型不一样',
@@ -41,7 +41,7 @@ const meta = {
41
41
  },
42
42
  options: ['left', 'center', 'right'],
43
43
  table: {
44
- defaultValue: { summary: 'left' },
44
+ defaultValue: { summary: undefined },
45
45
  },
46
46
  },
47
47
  color: {
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react'
2
2
  import type { ComponentType } from 'react'
3
- import { Button, Input, InputSlot } from '../components/index'
3
+ import { Button, Input, InputSlot } from '../components/index.js'
4
4
  import { SearchIcon } from '@storybook/icons'
5
5
  import React from 'react'
6
6
 
@@ -0,0 +1,51 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import { Picture } from '../components/index.js'
3
+ const imageUrl =
4
+ 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/Mask_group_3_f2d0041d-7b54-4d6a-a504-1dbe6c2de6ee.png?v=1718245219'
5
+
6
+ const mobImageUrl =
7
+ 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/1_c67da28a-50c5-4821-8712-330259ea6039.png?v=1718245627'
8
+
9
+ const imageUrl2 = 'https://http.cat/images/200.jpg'
10
+ const mobImageUrl2 = 'https://http.cat/images/102.jpg'
11
+
12
+ const meta = {
13
+ title: 'Components/Picture',
14
+ component: Picture,
15
+ parameters: {
16
+ layout: 'centerd',
17
+ docs: {
18
+ description: {
19
+ component: `响应式图片组件, 支持传入不同分辨率下的图片,比如,source="url1 1920, url2 1080, url3 767".
20
+ 当图片匹配域名('cdn.shopify.com', 'cdn.shopifycdn.net', 'www.facebook.com')的时候,会自动在图片url后面添加图片尺寸后缀
21
+ `,
22
+ },
23
+ },
24
+ },
25
+ tags: ['autodocs'],
26
+ } satisfies Meta<typeof Picture>
27
+
28
+ export default meta
29
+
30
+ type Story = StoryObj<typeof meta>
31
+
32
+ export const Default: Story = {
33
+ args: {
34
+ source: `${imageUrl}, ${mobImageUrl} 768`,
35
+ imgClassName: 'ai-rounded-[24px]',
36
+ },
37
+ }
38
+
39
+ export const NotMatchDomain: Story = {
40
+ args: {
41
+ source: `${imageUrl2}, ${mobImageUrl2} 768`,
42
+ className: 'ai-w-[300px]',
43
+ },
44
+ parameters: {
45
+ docs: {
46
+ description: {
47
+ story: '图片不匹配域名',
48
+ },
49
+ },
50
+ },
51
+ }
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { Popover, PopoverContent, PopoverTrigger } from '../components/index'
2
+ import { Popover, PopoverContent, PopoverTrigger } from '../components/index.js'
3
3
  import type { Meta } from '@storybook/react/*'
4
4
 
5
5
  const meta = {
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react/*'
2
- import { RadioGroup, RadioGroupItem } from '../components/index'
2
+ import { RadioGroup, RadioGroupItem } from '../components/index.js'
3
3
  import React, { type ComponentType } from 'react'
4
4
 
5
5
  const meta = {
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react'
2
2
 
3
- import { Skeleton } from '../components/index'
3
+ import { Skeleton } from '../components/index.js'
4
4
  import React from 'react'
5
5
 
6
6
  const meta = {
@@ -1,13 +1,13 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react'
2
2
 
3
- import { Text } from '../components/index'
3
+ import { Text } from '../components/index.js'
4
4
  import React from 'react'
5
5
 
6
6
  const meta = {
7
7
  title: 'Typography/Text',
8
8
  component: Text,
9
9
  parameters: {
10
- layout: 'centered',
10
+ layout: 'padded',
11
11
  docs: {
12
12
  description: {
13
13
  component: '文本组件, 简单封装了常用的样式字段,用于展示文本内容.',
@@ -41,7 +41,7 @@ const meta = {
41
41
  },
42
42
  options: ['left', 'center', 'right'],
43
43
  table: {
44
- defaultValue: { summary: 'left' },
44
+ defaultValue: { summary: undefined },
45
45
  },
46
46
  },
47
47
  color: {
@@ -53,7 +53,7 @@ const meta = {
53
53
  control: {
54
54
  type: 'select',
55
55
  },
56
- description: 'html 标签类型',
56
+ description: 'html 标签类型, div和p会默认占满整行',
57
57
  options: ['div', 'label', 'p', 'span'],
58
58
  table: {
59
59
  defaultValue: { summary: 'span' },
@@ -69,6 +69,7 @@ const meta = {
69
69
  weights: 'normal',
70
70
  align: 'left',
71
71
  html: '',
72
+ as: 'p',
72
73
  },
73
74
  } satisfies Meta<typeof Text>
74
75
 
@@ -6,12 +6,12 @@
6
6
  --btn-bg-color: #00a7e1;
7
7
  --btn-text-color: #ffffff;
8
8
  --btn-bg-active-color: #00a7e1;
9
- --btn-bg-disabled-color: #ccdfe8;
9
+ --btn-bg-disabled-color: #ccdfe850;
10
10
 
11
11
  --btn-bg-secondary-color: #ffffff;
12
12
  --btn-text-secondary-color: #333333;
13
13
  --btn-bg-secondary-active-color: #555555;
14
- --btn-bg-secondary-disabled-color: #f5f5f5;
14
+ --btn-bg-secondary-disabled-color: #f5f5f550;
15
15
 
16
16
  --btn-radius: 0;
17
17
 
@@ -68,12 +68,12 @@
68
68
  --btn-bg-color: #00a7e1;
69
69
  --btn-text-color: #ffffff;
70
70
  --btn-bg-active-color: #02b8f4;
71
- --btn-bg-disabled-color: #ccdfe8;
71
+ --btn-bg-disabled-color: #ccdfe850;
72
72
 
73
73
  --btn-bg-secondary-color: #ffffff;
74
74
  --btn-text-secondary-color: #333333;
75
75
  --btn-bg-secondary-active-color: #555555;
76
- --btn-bg-secondary-disabled-color: #f5f5f5;
76
+ --btn-bg-secondary-disabled-color: #f5f5f550;
77
77
 
78
78
  --btn-radius: 9999px;
79
79
 
@@ -84,12 +84,12 @@
84
84
  --btn-bg-color: #005d8e;
85
85
  --btn-text-color: #ffffff;
86
86
  --btn-bg-active-color: #669ebb;
87
- --btn-bg-disabled-color: #ccdfe8;
87
+ --btn-bg-disabled-color: #ccdfe850;
88
88
 
89
89
  --btn-bg-secondary-color: #ffffff;
90
90
  --btn-text-secondary-color: #333333;
91
91
  --btn-bg-secondary-active-color: #555555;
92
- --btn-bg-secondary-disabled-color: #f5f5f5;
92
+ --btn-bg-secondary-disabled-color: #f5f5f550;
93
93
 
94
94
  --btn-radius: 40px;
95
95
 
@@ -158,12 +158,12 @@
158
158
  --btn-bg-color: #17bbef;
159
159
  --btn-text-color: #ffffff;
160
160
  --btn-bg-color-active: #48cffa;
161
- --btn-bg-disabled-color: #ccdfe8;
161
+ --btn-bg-disabled-color: #ccdfe850;
162
162
 
163
163
  --btn-bg-secondary-color: #ffffff;
164
164
  --btn-text-secondary-color: #17bbef;
165
165
  --btn-bg-secondary-active-color: #17bbef;
166
- --btn-bg-secondary-disabled-color: #f5f5f5;
166
+ --btn-bg-secondary-disabled-color: #f5f5f550;
167
167
 
168
168
  --btn-radius: 30px;
169
169
 
@@ -174,7 +174,7 @@
174
174
 
175
175
  :root[data-brand-theme='ankerWork'] {
176
176
  --btn-bg-color: #00a7e1;
177
- --btn-text-color: ##fff;
177
+ --btn-text-color: #fff;
178
178
  --btn-bg-active-color: #606060;
179
179
 
180
180
  --btn-radius: 0px;
package/style.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- ! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com
2
+ ! tailwindcss v3.4.6 | MIT License | https://tailwindcss.com
3
3
  *//*
4
4
  1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
5
5
  2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
@@ -515,6 +515,9 @@ video {
515
515
  .\!ai-pointer-events-none {
516
516
  pointer-events: none !important;
517
517
  }
518
+ .\!ai-pointer-events-auto {
519
+ pointer-events: auto !important;
520
+ }
518
521
  .ai-fixed {
519
522
  position: fixed;
520
523
  }
@@ -551,6 +554,9 @@ video {
551
554
  .ai-order-2 {
552
555
  order: 2;
553
556
  }
557
+ .ai-block {
558
+ display: block;
559
+ }
554
560
  .ai-flex {
555
561
  display: flex;
556
562
  }
@@ -639,8 +645,8 @@ video {
639
645
  .\!ai-cursor-default {
640
646
  cursor: default !important;
641
647
  }
642
- .ai-cursor-not-allowed {
643
- cursor: not-allowed;
648
+ .\!ai-cursor-not-allowed {
649
+ cursor: not-allowed !important;
644
650
  }
645
651
  .\!ai-select-none {
646
652
  -webkit-user-select: none !important;
@@ -668,11 +674,6 @@ video {
668
674
  .ai-gap-4 {
669
675
  gap: 1rem;
670
676
  }
671
- .ai-space-y-1 > :not([hidden]) ~ :not([hidden]) {
672
- --tw-space-y-reverse: 0;
673
- margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse)));
674
- margin-bottom: calc(0.25rem * var(--tw-space-y-reverse));
675
- }
676
677
  .ai-space-y-1\.5 > :not([hidden]) ~ :not([hidden]) {
677
678
  --tw-space-y-reverse: 0;
678
679
  margin-top: calc(0.375rem * calc(1 - var(--tw-space-y-reverse)));
@@ -924,12 +925,12 @@ video {
924
925
  --btn-bg-color: #00a7e1;
925
926
  --btn-text-color: #ffffff;
926
927
  --btn-bg-active-color: #00a7e1;
927
- --btn-bg-disabled-color: #ccdfe8;
928
+ --btn-bg-disabled-color: #ccdfe850;
928
929
 
929
930
  --btn-bg-secondary-color: #ffffff;
930
931
  --btn-text-secondary-color: #333333;
931
932
  --btn-bg-secondary-active-color: #555555;
932
- --btn-bg-secondary-disabled-color: #f5f5f5;
933
+ --btn-bg-secondary-disabled-color: #f5f5f550;
933
934
 
934
935
  --btn-radius: 0;
935
936
 
@@ -986,12 +987,12 @@ video {
986
987
  --btn-bg-color: #00a7e1;
987
988
  --btn-text-color: #ffffff;
988
989
  --btn-bg-active-color: #02b8f4;
989
- --btn-bg-disabled-color: #ccdfe8;
990
+ --btn-bg-disabled-color: #ccdfe850;
990
991
 
991
992
  --btn-bg-secondary-color: #ffffff;
992
993
  --btn-text-secondary-color: #333333;
993
994
  --btn-bg-secondary-active-color: #555555;
994
- --btn-bg-secondary-disabled-color: #f5f5f5;
995
+ --btn-bg-secondary-disabled-color: #f5f5f550;
995
996
 
996
997
  --btn-radius: 9999px;
997
998
 
@@ -1002,12 +1003,12 @@ video {
1002
1003
  --btn-bg-color: #005d8e;
1003
1004
  --btn-text-color: #ffffff;
1004
1005
  --btn-bg-active-color: #669ebb;
1005
- --btn-bg-disabled-color: #ccdfe8;
1006
+ --btn-bg-disabled-color: #ccdfe850;
1006
1007
 
1007
1008
  --btn-bg-secondary-color: #ffffff;
1008
1009
  --btn-text-secondary-color: #333333;
1009
1010
  --btn-bg-secondary-active-color: #555555;
1010
- --btn-bg-secondary-disabled-color: #f5f5f5;
1011
+ --btn-bg-secondary-disabled-color: #f5f5f550;
1011
1012
 
1012
1013
  --btn-radius: 40px;
1013
1014
 
@@ -1076,12 +1077,12 @@ video {
1076
1077
  --btn-bg-color: #17bbef;
1077
1078
  --btn-text-color: #ffffff;
1078
1079
  --btn-bg-color-active: #48cffa;
1079
- --btn-bg-disabled-color: #ccdfe8;
1080
+ --btn-bg-disabled-color: #ccdfe850;
1080
1081
 
1081
1082
  --btn-bg-secondary-color: #ffffff;
1082
1083
  --btn-text-secondary-color: #17bbef;
1083
1084
  --btn-bg-secondary-active-color: #17bbef;
1084
- --btn-bg-secondary-disabled-color: #f5f5f5;
1085
+ --btn-bg-secondary-disabled-color: #f5f5f550;
1085
1086
 
1086
1087
  --btn-radius: 30px;
1087
1088
 
@@ -1092,7 +1093,7 @@ video {
1092
1093
 
1093
1094
  :root[data-brand-theme='ankerWork'] {
1094
1095
  --btn-bg-color: #00a7e1;
1095
- --btn-text-color: ##fff;
1096
+ --btn-text-color: #fff;
1096
1097
  --btn-bg-active-color: #606060;
1097
1098
 
1098
1099
  --btn-radius: 0px;