@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,352 +0,0 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import type { EmblaCarouselType } from 'embla-carousel'
5
- import useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react'
6
-
7
- import { cn } from '../helpers/index.js'
8
- import Button from './button.js'
9
-
10
- type CarouselApi = UseEmblaCarouselType[1]
11
- type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
12
- type CarouselOptions = UseCarouselParameters[0]
13
- type CarouselPlugin = UseCarouselParameters[1]
14
-
15
- type CarouselProps = {
16
- /**
17
- * 是否显示导航点
18
- */
19
- showNavigation?: boolean
20
- /**
21
- * 导航点位置 default inner
22
- */
23
- navigationPosition?: 'inner' | 'outter'
24
- opts?: CarouselOptions
25
- plugins?: CarouselPlugin
26
- orientation?: 'horizontal' | 'vertical'
27
- setApi?: (api: CarouselApi) => void
28
- }
29
-
30
- type CarouselContextProps = {
31
- carouselRef: ReturnType<typeof useEmblaCarousel>[0]
32
- api: ReturnType<typeof useEmblaCarousel>[1]
33
- scrollPrev: () => void
34
- scrollNext: () => void
35
- canScrollPrev: boolean
36
- canScrollNext: boolean
37
- } & CarouselProps
38
-
39
- type UseDotButtonType = {
40
- selectedIndex: number
41
- scrollSnaps: number[]
42
- onDotButtonClick: (index: number) => void
43
- }
44
-
45
- const useDotButton = (
46
- emblaApi: EmblaCarouselType | undefined,
47
- onButtonClick?: (emblaApi: EmblaCarouselType) => void
48
- ): UseDotButtonType => {
49
- const [selectedIndex, setSelectedIndex] = React.useState(0)
50
- const [scrollSnaps, setScrollSnaps] = React.useState<number[]>([])
51
-
52
- const onDotButtonClick = React.useCallback(
53
- (index: number) => {
54
- if (!emblaApi) return
55
- emblaApi.scrollTo(index)
56
- if (onButtonClick) onButtonClick(emblaApi)
57
- },
58
- [emblaApi, onButtonClick]
59
- )
60
-
61
- const onInit = React.useCallback((emblaApi: EmblaCarouselType) => {
62
- setScrollSnaps(emblaApi.scrollSnapList())
63
- }, [])
64
-
65
- const onSelect = React.useCallback((emblaApi: EmblaCarouselType) => {
66
- setSelectedIndex(emblaApi.selectedScrollSnap())
67
- }, [])
68
-
69
- React.useEffect(() => {
70
- if (!emblaApi) return
71
-
72
- onInit(emblaApi)
73
- onSelect(emblaApi)
74
-
75
- emblaApi.on('reInit', onInit).on('reInit', onSelect).on('select', onSelect)
76
- }, [emblaApi, onInit, onSelect])
77
-
78
- return {
79
- selectedIndex,
80
- scrollSnaps,
81
- onDotButtonClick,
82
- }
83
- }
84
-
85
- type PropType = React.ComponentPropsWithRef<'button'>
86
-
87
- export const DotButton: React.FC<PropType> = props => {
88
- const { children, ...restProps } = props
89
-
90
- return (
91
- <button type="button" {...restProps}>
92
- {children}
93
- </button>
94
- )
95
- }
96
-
97
- const CarouselContext = React.createContext<CarouselContextProps | null>(null)
98
-
99
- function useCarousel() {
100
- const context = React.useContext(CarouselContext)
101
-
102
- if (!context) {
103
- throw new Error('useCarousel must be used within a <Carousel />')
104
- }
105
-
106
- return context
107
- }
108
-
109
- const Carousel = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselProps>(
110
- (
111
- {
112
- orientation = 'horizontal',
113
- showNavigation = false,
114
- navigationPosition = 'inner',
115
- opts,
116
- setApi,
117
- plugins,
118
- className,
119
- children,
120
- ...props
121
- },
122
- ref
123
- ) => {
124
- const [carouselRef, api] = useEmblaCarousel(
125
- {
126
- ...opts,
127
- axis: orientation === 'horizontal' ? 'x' : 'y',
128
- },
129
- plugins
130
- )
131
- const [canScrollPrev, setCanScrollPrev] = React.useState(false)
132
- const [canScrollNext, setCanScrollNext] = React.useState(false)
133
-
134
- const { selectedIndex, scrollSnaps, onDotButtonClick } = useDotButton(api)
135
-
136
- const onSelect = React.useCallback((api: CarouselApi) => {
137
- if (!api) {
138
- return
139
- }
140
-
141
- setCanScrollPrev(api.canScrollPrev())
142
- setCanScrollNext(api.canScrollNext())
143
- }, [])
144
-
145
- const scrollPrev = React.useCallback(() => {
146
- api?.scrollPrev()
147
- }, [api])
148
-
149
- const scrollNext = React.useCallback(() => {
150
- api?.scrollNext()
151
- }, [api])
152
-
153
- const handleKeyDown = React.useCallback(
154
- (event: React.KeyboardEvent<HTMLDivElement>) => {
155
- if (event.key === 'ArrowLeft') {
156
- event.preventDefault()
157
- scrollPrev()
158
- } else if (event.key === 'ArrowRight') {
159
- event.preventDefault()
160
- scrollNext()
161
- }
162
- },
163
- [scrollPrev, scrollNext]
164
- )
165
-
166
- React.useEffect(() => {
167
- if (!api || !setApi) {
168
- return
169
- }
170
-
171
- setApi(api)
172
- }, [api, setApi])
173
-
174
- React.useEffect(() => {
175
- if (!api) {
176
- return
177
- }
178
-
179
- onSelect(api)
180
- api.on('reInit', onSelect)
181
- api.on('select', onSelect)
182
-
183
- return () => {
184
- api?.off('select', onSelect)
185
- }
186
- }, [api, onSelect])
187
-
188
- return (
189
- <CarouselContext.Provider
190
- value={{
191
- carouselRef,
192
- api: api,
193
- opts,
194
- orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),
195
- scrollPrev,
196
- scrollNext,
197
- canScrollPrev,
198
- canScrollNext,
199
- }}
200
- >
201
- <div
202
- ref={ref}
203
- onKeyDownCapture={handleKeyDown}
204
- className={cn('relative', className)}
205
- role="region"
206
- aria-roledescription="carousel"
207
- {...props}
208
- >
209
- {children}
210
- {showNavigation && (
211
- <div
212
- className={cn('absolute left-1/2 mx-auto flex -translate-x-1/2 justify-center gap-[8px]', {
213
- 'min-md:bottom-[40px] bottom-[24px]': navigationPosition === 'inner',
214
- 'min-md:-bottom-[40px] -bottom-[24px]': navigationPosition === 'outter',
215
- })}
216
- >
217
- {scrollSnaps.map((_, index) => (
218
- <DotButton
219
- key={index}
220
- onClick={() => onDotButtonClick(index)}
221
- className={cn('min-md:w-[30px] h-[3px] w-[16px] bg-[#86868C]', {
222
- 'bg-[#1D1D1F]': index === selectedIndex,
223
- })}
224
- />
225
- ))}
226
- </div>
227
- )}
228
- </div>
229
- </CarouselContext.Provider>
230
- )
231
- }
232
- )
233
- Carousel.displayName = 'Carousel'
234
-
235
- const CarouselContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
236
- ({ className, ...props }, ref) => {
237
- const { carouselRef, orientation } = useCarousel()
238
-
239
- return (
240
- <div ref={carouselRef} className="overflow-hidden">
241
- <div
242
- ref={ref}
243
- className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)}
244
- {...props}
245
- />
246
- </div>
247
- )
248
- }
249
- )
250
- CarouselContent.displayName = 'CarouselContent'
251
-
252
- const CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
253
- ({ className, ...props }, ref) => {
254
- const { orientation } = useCarousel()
255
-
256
- return (
257
- <div
258
- ref={ref}
259
- role="group"
260
- aria-roledescription="slide"
261
- className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'pl-4' : 'pt-4', className)}
262
- {...props}
263
- />
264
- )
265
- }
266
- )
267
- CarouselItem.displayName = 'CarouselItem'
268
-
269
- const CarouselPrevious = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button>>(
270
- ({ className, variant = 'secondary', size = 'icon', children, ...props }, ref) => {
271
- const { orientation, scrollPrev, canScrollPrev } = useCarousel()
272
-
273
- return (
274
- <Button
275
- ref={ref}
276
- variant={variant}
277
- size={size}
278
- className={cn(
279
- 'absolute size-8 rounded-full',
280
- orientation === 'horizontal'
281
- ? '-left-12 top-1/2 -translate-y-1/2'
282
- : '-top-12 left-1/2 -translate-x-1/2 rotate-90',
283
- className
284
- )}
285
- disabled={!canScrollPrev}
286
- onClick={scrollPrev}
287
- {...props}
288
- >
289
- {children ? (
290
- children
291
- ) : (
292
- <svg width="58" height="58" viewBox="0 0 58 58" fill="none" xmlns="http://www.w3.org/2000/svg">
293
- <circle
294
- opacity="0.2"
295
- cx="29"
296
- cy="29"
297
- r="29"
298
- transform="matrix(1 -8.74228e-08 -8.74228e-08 -1 0 58)"
299
- fill="#1D1D1F"
300
- />
301
- <path
302
- d="M32.1583 36.8248C32.6139 36.3692 32.6139 35.6305 32.1583 35.1749L25.9832 28.9998L32.1583 22.8248C32.6139 22.3692 32.6139 21.6305 32.1583 21.1749C31.7027 20.7193 30.964 20.7193 30.5084 21.1749L23.5084 28.1749C23.0528 28.6305 23.0528 29.3692 23.5084 29.8248L30.5084 36.8248C30.964 37.2804 31.7027 37.2804 32.1583 36.8248Z"
303
- fill="white"
304
- />
305
- </svg>
306
- )}
307
- <span className="sr-only">Previous slide</span>
308
- </Button>
309
- )
310
- }
311
- )
312
- CarouselPrevious.displayName = 'CarouselPrevious'
313
-
314
- const CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button>>(
315
- ({ className, variant = 'secondary', size = 'icon', children, ...props }, ref) => {
316
- const { orientation, scrollNext, canScrollNext } = useCarousel()
317
-
318
- return (
319
- <Button
320
- ref={ref}
321
- variant={variant}
322
- size={size}
323
- className={cn(
324
- 'absolute size-8 rounded-full',
325
- orientation === 'horizontal'
326
- ? '-right-12 top-1/2 -translate-y-1/2'
327
- : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
328
- className
329
- )}
330
- disabled={!canScrollNext}
331
- onClick={scrollNext}
332
- {...props}
333
- >
334
- {children ? (
335
- children
336
- ) : (
337
- <svg width="58" height="58" viewBox="0 0 58 58" fill="none" xmlns="http://www.w3.org/2000/svg">
338
- <circle opacity="0.2" cx="29" cy="29" r="29" transform="rotate(-180 29 29)" fill="#1D1D1F" />
339
- <path
340
- d="M25.8417 36.8248C25.3861 36.3692 25.3861 35.6305 25.8417 35.1749L32.0168 28.9998L25.8417 22.8248C25.3861 22.3692 25.3861 21.6305 25.8417 21.1749C26.2973 20.7193 27.036 20.7193 27.4916 21.1749L34.4916 28.1749C34.9472 28.6305 34.9472 29.3692 34.4916 29.8248L27.4916 36.8248C27.036 37.2804 26.2973 37.2804 25.8417 36.8248Z"
341
- fill="white"
342
- />
343
- </svg>
344
- )}
345
- <span className="sr-only">Next slide</span>
346
- </Button>
347
- )
348
- }
349
- )
350
- CarouselNext.displayName = 'CarouselNext'
351
-
352
- export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext }
@@ -1,42 +0,0 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
5
- import { CheckIcon } from '@radix-ui/react-icons'
6
-
7
- import { cn } from '../helpers/index.js'
8
- import { cva, type VariantProps } from 'class-variance-authority'
9
-
10
- const checkboxVariants = cva(
11
- 'border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground peer shrink-0 rounded-sm border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-btn-primary-disabled',
12
- {
13
- variants: {
14
- size: {
15
- sm: 'size-[14px]',
16
- base: 'size-4',
17
- lg: 'size-5',
18
- },
19
- },
20
- defaultVariants: {
21
- size: 'base',
22
- },
23
- }
24
- )
25
-
26
- interface CheckboxProps
27
- extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>,
28
- VariantProps<typeof checkboxVariants> {}
29
-
30
- const Checkbox = React.forwardRef<React.ElementRef<typeof CheckboxPrimitive.Root>, CheckboxProps>(
31
- ({ className, size, ...props }, ref) => (
32
- <CheckboxPrimitive.Root ref={ref} className={cn(checkboxVariants({ size }), className)} {...props}>
33
- <CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current w-full h-full')}>
34
- <CheckIcon />
35
- </CheckboxPrimitive.Indicator>
36
- </CheckboxPrimitive.Root>
37
- )
38
- )
39
- Checkbox.displayName = 'Checkbox'
40
-
41
- export default Checkbox
42
- export type { CheckboxProps }
@@ -1,77 +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
- const colorVariants = cva('', {
7
- variants: {
8
- color: {
9
- brand0: 'bg-brand-0',
10
- brand1: 'bg-brand-1',
11
- success0: 'bg-success-0',
12
- success1: 'bg-success-1',
13
- success2: 'bg-success-2',
14
- success3: 'bg-success-3',
15
- success4: 'bg-success-4',
16
- warning0: 'bg-warning-0',
17
- warning1: 'bg-warning-1',
18
- warning2: 'bg-warning-2',
19
- warning3: 'bg-warning-3',
20
- warning4: 'bg-warning-4',
21
- error0: 'bg-error-0',
22
- error1: 'bg-error-1',
23
- error2: 'bg-error-2',
24
- error3: 'bg-error-3',
25
- error4: 'bg-error-4',
26
- infoPrimary: 'bg-info-primary',
27
- infoSecondary: 'bg-info-secondary',
28
- infoTertiary: 'bg-info-tertiary',
29
- infoQuaternary: 'bg-info-quaternary',
30
- infoWhite: 'bg-info-white',
31
- containerPrimary: 'bg-container-primary',
32
- containerSecondary0: 'bg-container-secondary-0',
33
- containerSecondary1: 'bg-container-secondary-1',
34
- bg0: 'bg-bg-0',
35
- bg1: 'bg-bg-1',
36
- lines: 'bg-lines',
37
- masks0: 'bg-masks-0',
38
- masks1: 'bg-masks-1',
39
- tabWord0: 'bg-tab-word-0',
40
- tabWord1: 'bg-tab-word-1',
41
- tabWord2: 'bg-tab-word-2',
42
- tabStroke0: 'bg-tab-stroke-0',
43
- tabStroke1: 'bg-tab-stroke-1',
44
- tabStroke2: 'bg-tab-stroke-2',
45
- tabFill0: 'bg-tab-fill-0',
46
- tabFill1: 'bg-tab-fill-1',
47
- tabFill2: 'bg-tab-fill-2',
48
- },
49
- },
50
- defaultVariants: {
51
- color: 'brand0',
52
- },
53
- })
54
- type ColorElement = React.ElementRef<'div'>
55
- type ColorDivProps = ComponentPropsWithout<'div', RemovedProps>
56
- interface CommonColorProps extends VariantProps<typeof colorVariants> {}
57
- type ColorProps = CommonColorProps & ColorDivProps
58
- const Color = React.forwardRef<ColorElement, ColorProps>((props, forwardedRef) => {
59
- const { children, color = 'brand0', className, ...colorProps } = props
60
- return (
61
- <Slot
62
- {...colorProps}
63
- ref={forwardedRef}
64
- className={cn(
65
- colorVariants({
66
- color,
67
- }),
68
- className
69
- )}
70
- >
71
- {children}
72
- </Slot>
73
- )
74
- })
75
- Color.displayName = 'Color'
76
- export { Color }
77
- export type { ColorProps }
@@ -1,28 +0,0 @@
1
- import React from 'react'
2
- import { cn } from '../helpers/utils.js'
3
- import { Slot } from '@radix-ui/react-slot'
4
-
5
- type ContainerElement = React.ElementRef<'div'>
6
- type ContainerProps = {
7
- asChild?: boolean
8
- children?: React.ReactNode
9
- className?: string
10
- } & React.ComponentPropsWithoutRef<'div'>
11
- const Container = React.forwardRef<ContainerElement, ContainerProps>(({ ...props }, forwardedRef) => {
12
- const { asChild, children, className, ...containerProps } = props
13
- const Comp = asChild ? Slot : 'div'
14
-
15
- return (
16
- <Comp
17
- {...containerProps}
18
- ref={forwardedRef}
19
- className={cn("box-border max-w-[1664px] mx-4 sm:mx-8 md:mx-16 lg:mx-16 xl:mx-auto ", className)}
20
- >
21
- {children}
22
- </Comp>
23
- )
24
- })
25
- Container.displayName = 'Container'
26
-
27
- export { Container }
28
- export type { ContainerProps }
@@ -1,98 +0,0 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import * as DialogPrimitive from '@radix-ui/react-dialog'
5
- import { Cross2Icon } from '@radix-ui/react-icons'
6
-
7
- import { cn } from '../helpers/index.js'
8
-
9
- const Dialog = DialogPrimitive.Root
10
- Dialog.displayName = 'Dialog'
11
-
12
- const DialogTrigger = DialogPrimitive.Trigger
13
-
14
- const DialogPortal = DialogPrimitive.Portal
15
-
16
- const DialogClose = DialogPrimitive.Close
17
-
18
- const DialogOverlay = React.forwardRef<
19
- React.ElementRef<typeof DialogPrimitive.Overlay>,
20
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
21
- >(({ className, ...props }, ref) => (
22
- <DialogPrimitive.Overlay
23
- ref={ref}
24
- className={cn(
25
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80',
26
- className
27
- )}
28
- {...props}
29
- />
30
- ))
31
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
32
-
33
- const DialogContent = React.forwardRef<
34
- React.ElementRef<typeof DialogPrimitive.Content>,
35
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
36
- >(({ className, children, ...props }, ref) => (
37
- <DialogPortal>
38
- <DialogOverlay />
39
- <DialogPrimitive.Content
40
- ref={ref}
41
- className={cn(
42
- 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg',
43
- className
44
- )}
45
- {...props}
46
- >
47
- {children}
48
- <DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none">
49
- <Cross2Icon className="size-4" />
50
- <span className="sr-only">Close</span>
51
- </DialogPrimitive.Close>
52
- </DialogPrimitive.Content>
53
- </DialogPortal>
54
- ))
55
- DialogContent.displayName = DialogPrimitive.Content.displayName
56
-
57
- const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
58
- <div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />
59
- )
60
- DialogHeader.displayName = 'DialogHeader'
61
-
62
- const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
63
- <div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props} />
64
- )
65
- DialogFooter.displayName = 'DialogFooter'
66
-
67
- const DialogTitle = React.forwardRef<
68
- React.ElementRef<typeof DialogPrimitive.Title>,
69
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
70
- >(({ className, ...props }, ref) => (
71
- <DialogPrimitive.Title
72
- ref={ref}
73
- className={cn('text-lg font-semibold leading-none tracking-tight', className)}
74
- {...props}
75
- />
76
- ))
77
- DialogTitle.displayName = DialogPrimitive.Title.displayName
78
-
79
- const DialogDescription = React.forwardRef<
80
- React.ElementRef<typeof DialogPrimitive.Description>,
81
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
82
- >(({ className, ...props }, ref) => (
83
- <DialogPrimitive.Description ref={ref} className={cn('text-muted-foreground text-sm', className)} {...props} />
84
- ))
85
- DialogDescription.displayName = DialogPrimitive.Description.displayName
86
-
87
- export {
88
- Dialog,
89
- DialogPortal,
90
- DialogOverlay,
91
- DialogClose,
92
- DialogTrigger,
93
- DialogContent,
94
- DialogHeader,
95
- DialogFooter,
96
- DialogTitle,
97
- DialogDescription,
98
- }