@catalystsoftware/ui 1.0.5 → 1.0.7

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 (155) hide show
  1. package/dist/data/data.tsx +29 -29
  2. package/dist/data/tailwind.config.js +3821 -261
  3. package/dist/data.tsx +29 -29
  4. package/package.json +4 -3
  5. package/components/catalyst-ui/buttons/burger.tsx +0 -207
  6. package/components/catalyst-ui/core/data-display/timeline.tsx +0 -210
  7. package/components/catalyst-ui/core/feedback/alert.tsx +0 -491
  8. package/components/catalyst-ui/core/feedback/spinner-1.tsx +0 -65
  9. package/components/catalyst-ui/core/feedback/toast.tsx +0 -1857
  10. package/components/catalyst-ui/core/navigation/menu.tsx +0 -164
  11. package/components/catalyst-ui/forms/toggle-class.tsx +0 -176
  12. package/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +0 -419
  13. package/components/catalyst-ui/hooks/use-counter.tsx +0 -13
  14. package/components/catalyst-ui/hooks/use-event-listener.tsx +0 -23
  15. package/components/catalyst-ui/hooks/use-export-markdown.tsx +0 -47
  16. package/components/catalyst-ui/hooks/use-focus.tsx +0 -17
  17. package/components/catalyst-ui/hooks/use-interval.tsx +0 -23
  18. package/components/catalyst-ui/hooks/use-is-client.tsx +0 -16
  19. package/components/catalyst-ui/hooks/use-media-query.tsx +0 -19
  20. package/components/catalyst-ui/hooks/use-mobile.tsx +0 -19
  21. package/components/catalyst-ui/hooks/use-resize-observer.tsx +0 -81
  22. package/components/catalyst-ui/hooks/use-timeout.tsx +0 -21
  23. package/components/catalyst-ui/hooks/use-timer.tsx +0 -209
  24. package/components/catalyst-ui/hooks/use-toggle.tsx +0 -12
  25. package/components/catalyst-ui/media/image.tsx +0 -13
  26. package/components/catalyst-ui/overlays/dual-sidebar.tsx +0 -4142
  27. package/components/catalyst-ui/overlays/sidebar-original.tsx +0 -726
  28. package/components/catalyst-ui/primitives/accordion.tsx +0 -250
  29. package/components/catalyst-ui/primitives/alert-dialog.tsx +0 -126
  30. package/components/catalyst-ui/primitives/aspect-ratio.tsx +0 -9
  31. package/components/catalyst-ui/primitives/avatar.tsx +0 -296
  32. package/components/catalyst-ui/primitives/badge.tsx +0 -57
  33. package/components/catalyst-ui/primitives/breadcrumb.tsx +0 -101
  34. package/components/catalyst-ui/primitives/button.tsx +0 -265
  35. package/components/catalyst-ui/primitives/calendar-v4.tsx +0 -208
  36. package/components/catalyst-ui/primitives/calendar.tsx +0 -295
  37. package/components/catalyst-ui/primitives/card.tsx +0 -618
  38. package/components/catalyst-ui/primitives/carousel.tsx +0 -238
  39. package/components/catalyst-ui/primitives/chart.tsx +0 -347
  40. package/components/catalyst-ui/primitives/checkbox.tsx +0 -225
  41. package/components/catalyst-ui/primitives/collapsible.tsx +0 -212
  42. package/components/catalyst-ui/primitives/command.tsx +0 -393
  43. package/components/catalyst-ui/primitives/context-menu.tsx +0 -236
  44. package/components/catalyst-ui/primitives/dialog.tsx +0 -471
  45. package/components/catalyst-ui/primitives/drawer.tsx +0 -761
  46. package/components/catalyst-ui/primitives/dropdown-menu.tsx +0 -290
  47. package/components/catalyst-ui/primitives/empty.tsx +0 -104
  48. package/components/catalyst-ui/primitives/field.tsx +0 -244
  49. package/components/catalyst-ui/primitives/hover-card.tsx +0 -124
  50. package/components/catalyst-ui/primitives/input-otp.tsx +0 -76
  51. package/components/catalyst-ui/primitives/input.tsx +0 -64
  52. package/components/catalyst-ui/primitives/item.tsx +0 -196
  53. package/components/catalyst-ui/primitives/kbd.tsx +0 -75
  54. package/components/catalyst-ui/primitives/label.tsx +0 -24
  55. package/components/catalyst-ui/primitives/navigation-menu.tsx +0 -150
  56. package/components/catalyst-ui/primitives/pagination.tsx +0 -198
  57. package/components/catalyst-ui/primitives/popover.tsx +0 -232
  58. package/components/catalyst-ui/primitives/progress.tsx +0 -34
  59. package/components/catalyst-ui/primitives/radio-group.tsx +0 -43
  60. package/components/catalyst-ui/primitives/resizable.tsx +0 -56
  61. package/components/catalyst-ui/primitives/select.tsx +0 -155
  62. package/components/catalyst-ui/primitives/separator.tsx +0 -74
  63. package/components/catalyst-ui/primitives/sheet.tsx +0 -126
  64. package/components/catalyst-ui/primitives/skeleton.tsx +0 -15
  65. package/components/catalyst-ui/primitives/slider.tsx +0 -27
  66. package/components/catalyst-ui/primitives/switch.tsx +0 -187
  67. package/components/catalyst-ui/primitives/tabs.tsx +0 -335
  68. package/components/catalyst-ui/primitives/textarea.tsx +0 -24
  69. package/components/catalyst-ui/primitives/toggle-group.tsx +0 -55
  70. package/components/catalyst-ui/primitives/toggle.tsx +0 -42
  71. package/components/catalyst-ui/primitives/tooltip.tsx +0 -116
  72. package/components/catalyst-ui/utils/basic-auth.tsx +0 -40
  73. package/components/catalyst-ui/utils/context-storage.tsx +0 -19
  74. package/components/catalyst-ui/utils/cors-middleware.tsx +0 -71
  75. package/components/catalyst-ui/utils/deferred-content.tsx +0 -595
  76. package/components/catalyst-ui/utils/honeypot-middleware.tsx +0 -38
  77. package/components/catalyst-ui/utils/incId.tsx +0 -75
  78. package/components/catalyst-ui/utils/jwk-auth.tsx +0 -36
  79. package/components/catalyst-ui/utils/request-id.tsx +0 -14
  80. package/components/catalyst-ui/utils/secure-headers.tsx +0 -37
  81. package/components/catalyst-ui/utils/server-timing.tsx +0 -23
  82. package/components/catalyst-ui/utils/utils.ts +0 -43
  83. package/components/catalyst-ui/utils/with-cookie.tsx +0 -43
  84. package/components/catalyst-ui/x/accordian-x.tsx +0 -428
  85. package/components/catalyst-ui/x/alert-x.tsx +0 -413
  86. package/components/catalyst-ui/x/animated-text-x.tsx +0 -2242
  87. package/components/catalyst-ui/x/avatar-x.tsx +0 -515
  88. package/components/catalyst-ui/x/badge-x.tsx +0 -670
  89. package/components/catalyst-ui/x/button-X.tsx +0 -2857
  90. package/components/catalyst-ui/x/button-group-x.tsx +0 -847
  91. package/components/catalyst-ui/x/calendar-x.tsx +0 -1910
  92. package/components/catalyst-ui/x/card-x.tsx +0 -2597
  93. package/components/catalyst-ui/x/checkbox-x.tsx +0 -656
  94. package/components/catalyst-ui/x/collapsible-x.tsx +0 -1360
  95. package/components/catalyst-ui/x/combobox-x.tsx +0 -911
  96. package/components/catalyst-ui/x/data-table-x.tsx +0 -1753
  97. package/components/catalyst-ui/x/date-picker-x.tsx +0 -648
  98. package/components/catalyst-ui/x/dialog-x.tsx +0 -659
  99. package/components/catalyst-ui/x/dropdown-menu-x.tsx +0 -612
  100. package/components/catalyst-ui/x/hover-card-x.tsx +0 -375
  101. package/components/catalyst-ui/x/icon-x.tsx +0 -840
  102. package/components/catalyst-ui/x/input-mask-x.tsx +0 -981
  103. package/components/catalyst-ui/x/input-otp-x.tsx +0 -659
  104. package/components/catalyst-ui/x/loader-x.tsx +0 -1757
  105. package/components/catalyst-ui/x/pagination-x.tsx +0 -622
  106. package/components/catalyst-ui/x/popover-x.tsx +0 -744
  107. package/components/catalyst-ui/x/radio-group-x.tsx +0 -499
  108. package/components/catalyst-ui/x/select-x.tsx +0 -1127
  109. package/components/catalyst-ui/x/sheet-x.tsx +0 -668
  110. package/components/catalyst-ui/x/switch-x.tsx +0 -681
  111. package/components/catalyst-ui/x/table-x.tsx +0 -574
  112. package/components/catalyst-ui/x/tabs-x.tsx +0 -839
  113. package/components/catalyst-ui/x/textarea-x.tsx +0 -1263
  114. package/components/catalyst-ui/x/tooltip-x.tsx +0 -396
  115. package/components/catalyst-ui/x/tracker-x.tsx +0 -560
  116. package/data/bg-data.tsx +0 -901
  117. package/data/buttons-data.tsx +0 -2327
  118. package/data/charts-data.tsx +0 -102
  119. package/data/chat-data.tsx +0 -83
  120. package/data/code-data.tsx +0 -1040
  121. package/data/comboboxes-data.tsx +0 -1843
  122. package/data/command-data.tsx +0 -1381
  123. package/data/core-data.tsx +0 -15953
  124. package/data/crm-data.tsx +0 -47
  125. package/data/data.tsx +0 -159
  126. package/data/date-and-time-data.tsx +0 -554
  127. package/data/dependencies.tsx +0 -7
  128. package/data/ecommerce-data.tsx +0 -1387
  129. package/data/forms-data.tsx +0 -7890
  130. package/data/hooks-data.tsx +0 -5487
  131. package/data/index.ts +0 -34
  132. package/data/inputs-data.tsx +0 -557
  133. package/data/interactive-data.tsx +0 -5394
  134. package/data/lofi-data.tsx +0 -18295
  135. package/data/marketing-data.tsx +0 -2546
  136. package/data/media-data.tsx +0 -1510
  137. package/data/motion-data.tsx +0 -5801
  138. package/data/overlay-data.tsx +0 -4136
  139. package/data/pdf-data.tsx +0 -124
  140. package/data/pos-data.tsx +0 -213
  141. package/data/postcss.config.js +0 -6
  142. package/data/primitive-data.tsx +0 -5170
  143. package/data/prompt-data.tsx +0 -1226
  144. package/data/requiredLibs.ts +0 -4
  145. package/data/sandbox-data.tsx +0 -1
  146. package/data/sidebars-data.tsx +0 -5421
  147. package/data/stacks-data.tsx +0 -32
  148. package/data/table-data.tsx +0 -706
  149. package/data/tailwind.config.js +0 -270
  150. package/data/tailwind.config.ngin.js +0 -3830
  151. package/data/tailwind.css +0 -431
  152. package/data/tools-data.tsx +0 -6910
  153. package/data/typography-data.tsx +0 -2050
  154. package/data/utils-data.tsx +0 -6500
  155. package/data/x-data.tsx +0 -1171
@@ -1,428 +0,0 @@
1
- import React from 'react'
2
- import * as AccordionPrimitive from "@radix-ui/react-accordion"
3
- import { ChevronDown, Plus } from "lucide-react"
4
- import { cn } from "~/components/catalyst-ui"
5
- import { Accordion, AccordionItem, accordionTriggerVariants, TsxSection } from "~/components/catalyst-ui"
6
- import { Avatar, AvatarImage, AvatarFallback } from "~/components/catalyst-ui"
7
-
8
- /**
9
- * ★ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ AccordionX ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ★
10
- * ★ ━━━━ ☆ ━━━━ ━━━━ ☆ ━━━━ ★
11
- * type AccordionXType = 'default' | 'plusMinus' | 'avatar' | 'iconSubtitle' | 'media'
12
- *
13
- * ★ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━ Default ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ★
14
- * ```jsx
15
- * <AccordionX type="single" collapsible defaultValue="item-1">
16
- * {items.map((item, index) => (
17
- * <AccordionXItem key={index} value={`item-${index + 1}`}>
18
- * <AccordionXTrigger>{item.title}</AccordionXTrigger>
19
- * <AccordionXContent>{item.content}</AccordionXContent>
20
- * </AccordionXItem>
21
- * ))}
22
- * </AccordionX>
23
- * ```
24
- *
25
- * ★ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━ Plus/Minus Icon ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ★
26
- * ```jsx
27
- * <AccordionX accordionType="plusMinus" type="single" collapsible defaultValue="item-1">
28
- * {items.map((item, index) => (
29
- * <AccordionXItem key={index} value={`item-${index + 1}`}>
30
- * <AccordionXTrigger>{item.title}</AccordionXTrigger>
31
- * <AccordionXContent>{item.content}</AccordionXContent>
32
- * </AccordionXItem>
33
- * ))}
34
- * </AccordionX>
35
- * ```
36
- *
37
- * ★ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━ Avatar ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ★
38
- * ```jsx
39
- * <AccordionX accordionType="avatar" type="single" collapsible defaultValue="item-1">
40
- * {items.map((item, index) => (
41
- * <AccordionXItem key={index} value={`item-${index + 1}`}>
42
- * <AccordionXTrigger
43
- * name={item.name}
44
- * email={item.email}
45
- * avatarImage={item.avatarImage}
46
- * />
47
- * <AccordionXContent>{item.content}</AccordionXContent>
48
- * </AccordionXItem>
49
- * ))}
50
- * </AccordionX>
51
- * ```
52
- *
53
- * ★ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━ Icon with Subtitle ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ★
54
- * ```jsx
55
- * <AccordionX accordionType="iconSubtitle" type="single" collapsible defaultValue="item-1">
56
- * {items.map((item, index) => (
57
- * <AccordionXItem key={index} value={`item-${index + 1}`}>
58
- * <AccordionXTrigger subtitle={item.subtitle}>
59
- * {item.title}
60
- * </AccordionXTrigger>
61
- * <AccordionXContent>{item.content}</AccordionXContent>
62
- * </AccordionXItem>
63
- * ))}
64
- * </AccordionX>
65
- * ```
66
- *
67
- * ★ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━ Props ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ★
68
- * - AccordionX Props:
69
- * - `accordionType`: 'default' | 'plusMinus' | 'avatar' | 'iconSubtitle' | 'media'
70
- * - `type`: 'single' | 'multiple' - Accordion behavior
71
- * - `collapsible`: boolean - Allow all items to be closed
72
- * - `defaultValue`: string - Default open item(s)
73
- * - `value`: string - Controlled open item(s)
74
- * - `onValueChange`: (value: string) => void - Callback when value changes
75
- *
76
- * - AccordionXItem Props:
77
- * - `value`: string - Unique value for the item
78
- * - `disabled`: boolean - Whether the item is disabled
79
- *
80
- * - AccordionXTrigger Props:
81
- * - `children`: ReactNode - Trigger content
82
- * - `subtitle`: string - Subtitle text (for iconSubtitle type)
83
- * - `name`: string - User name (for avatar type)
84
- * - `email`: string - User email (for avatar type)
85
- * - `avatarImage`: string - Avatar image URL (for avatar type)
86
- *
87
- * - AccordionXContent Props:
88
- * - `children`: ReactNode - Content to display when expanded
89
- *
90
- * ★ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━ Data Structure ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ★
91
- * ```typescript
92
- * interface AccordionItem {
93
- * title: string;
94
- * content: string;
95
- * name?: string;
96
- * email?: string;
97
- * subtitle?: string;
98
- * avatarImage?: string;
99
- * media?: string;
100
- * }
101
- * ```
102
- *
103
- * ★ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━ Example Items Array ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ☆ ━━━━━━━━━━━━━━ ★
104
- * ```javascript
105
- * const items = [
106
- * {
107
- * title: 'How do I track my order?',
108
- * content: 'You can track your order by logging into your account.',
109
- * name: 'John Doe',
110
- * email: 'john@example.com',
111
- * subtitle: 'Basic Plan',
112
- * avatarImage: 'https://github.com/shadcn.png',
113
- * media: 'https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=800&auto=format&fit=crop'
114
- * },
115
- * // ... more items
116
- * ]
117
- * ```
118
- *
119
- */
120
-
121
- type AccordionContextType = {
122
- variant?: VariantProps<typeof accordionVariants>["variant"]
123
- }
124
-
125
- const AccordionContext = React.createContext<AccordionContextType>({
126
- variant: "default",
127
- })
128
-
129
- const useAccordionContext = () => {
130
- const context = React.useContext(AccordionContext)
131
- if (!context) {
132
- throw new Error("Accordion components must be used within Accordion")
133
- }
134
- return context
135
- }
136
-
137
- type AccordionType = 'default' | 'leftIcon' | 'plusMinus' | 'expandIcon' | 'avatar' | 'iconSubtitle'
138
-
139
- const AccordionXContext = React.createContext<AccordionType>('default')
140
-
141
- export function AccordionX({ accordion = 'default', variant, ...props }: any) {
142
- const contextValue: AlertContextValue = { variant, accordion }
143
- return (
144
- <AccordionXContext.Provider value={contextValue}>
145
- <Accordion {...props} />
146
- </AccordionXContext.Provider>
147
- )
148
- }
149
-
150
- export function AccordionXItem({ ...props }: any) {
151
- const { variant, accordion } = useAccordionContext()
152
- switch (accordion) {
153
- default:
154
- return <AccordionItem {...props} />
155
- }
156
- }
157
-
158
- export function AccordionXTrigger({children, ...props }: any) {
159
- const { variant, accordion } = useAccordionContext()
160
- const Icon = props.icon
161
- switch (accordion) {
162
- case 'leftIcon':
163
- return (
164
- <AccordionPrimitive.Header className="flex">
165
- <AccordionPrimitive.Trigger
166
- className={cn(accordionTriggerVariants({ variant }), "justify-start [&>svg]:order-first", props.className)}
167
- {...props}
168
- >
169
- <span className='flex items-center gap-4'>
170
- {Icon && <Icon className='text-muted-foreground size-4 shrink-0' />}
171
- <span>{children}</span>
172
- </span>
173
- <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
174
- </AccordionPrimitive.Trigger>
175
- </AccordionPrimitive.Header>
176
- )
177
-
178
- case 'plusMinus':
179
- return (
180
- <AccordionPrimitive.Header className="flex">
181
- <AccordionPrimitive.Trigger
182
- className={cn(
183
- accordionTriggerVariants({
184
-
185
- }),
186
- "focus-visible:border-ring focus-visible:ring-ring/50 rounded-md outline-none focus-visible:ring-[3px] [&>svg>path:last-child]:origin-center [&>svg>path:last-child]:transition-all [&>svg>path:last-child]:duration-200 [&[data-state=open]>svg]:rotate-180 [&[data-state=open]>svg>path:last-child]:rotate-90 [&[data-state=open]>svg>path:last-child]:opacity-0",
187
- props.className
188
- )}
189
- {...props}
190
- >
191
- {children}
192
- <Plus className="text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200" />
193
- </AccordionPrimitive.Trigger>
194
- </AccordionPrimitive.Header>
195
- )
196
-
197
- case 'expandIcon':
198
- return (
199
- <AccordionPrimitive.Header className="flex">
200
- <AccordionPrimitive.Trigger
201
- className={cn(
202
- accordionTriggerVariants({ variant }),
203
- "focus-visible:border-ring focus-visible:ring-ring/50 items-start rounded-md outline-none focus-visible:ring-[3px] [&[data-state=open]>svg]:rotate-45",
204
- props.className
205
- )}
206
- {...props}
207
- >
208
- <span className="flex items-center gap-4">
209
- {Icon && <Icon className="size-4 shrink-0" />}
210
- <span>{children}</span>
211
- </span>
212
- <Plus className="text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200" />
213
- </AccordionPrimitive.Trigger>
214
- </AccordionPrimitive.Header>
215
- )
216
-
217
- case 'avatar':
218
- return (
219
- <AccordionPrimitive.Header className="flex">
220
- <AccordionPrimitive.Trigger
221
- className={cn(accordionTriggerVariants({ variant }), "items-center hover:no-underline", props.className)}
222
- {...props}
223
- >
224
- <span className='flex items-center gap-4'>
225
- <Avatar className='size-10.5 rounded-sm'>
226
- <AvatarImage src={props.avatar} alt={props.name} className='rounded-sm' />
227
- <AvatarFallback className='rounded-sm text-xs'>
228
- {props.name?.split(/\s/).reduce((response: string, word: string) => (response += word.slice(0, 1)), '')}
229
- </AvatarFallback>
230
- </Avatar>
231
- <span className='flex flex-col space-y-0.5'>
232
- <span>{props.name}</span>
233
- <span className='text-muted-foreground font-normal'>{props.email}</span>
234
- </span>
235
- </span>
236
- <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
237
- </AccordionPrimitive.Trigger>
238
- </AccordionPrimitive.Header>
239
- )
240
-
241
- case 'iconSubtitle':
242
- return (
243
- <AccordionPrimitive.Header className="flex">
244
- <AccordionPrimitive.Trigger
245
- className={cn(
246
- accordionTriggerVariants({ variant }),
247
- "focus-visible:border-ring focus-visible:ring-ring/50 rounded-md outline-none focus-visible:ring-[3px] [&>svg>path:last-child]:origin-center [&>svg>path:last-child]:transition-all [&>svg>path:last-child]:duration-200 [&[data-state=open]>svg]:rotate-180 [&[data-state=open]>svg>path:last-child]:rotate-90 [&[data-state=open]>svg>path:last-child]:opacity-0",
248
- props.className
249
- )}
250
- {...props}
251
- >
252
- <span className='flex items-center gap-4'>
253
- <span
254
- className='flex size-10 shrink-0 items-center justify-center rounded-full border'
255
- aria-hidden='true'
256
- >
257
- {Icon && <Icon className='size-4' />}
258
- </span>
259
- <span className='flex flex-col space-y-0.5'>
260
- {children}
261
- <span className='text-muted-foreground font-normal'>{props.subtitle}</span>
262
- </span>
263
- </span>
264
- <Plus className='text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200' />
265
- </AccordionPrimitive.Trigger>
266
- </AccordionPrimitive.Header>
267
- )
268
-
269
- default:
270
- return (
271
- <AccordionPrimitive.Header className="flex">
272
- <AccordionPrimitive.Trigger
273
- className={cn(accordionTriggerVariants({ variant }), props.className)}
274
- {...props}
275
- >
276
- {children}
277
- <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
278
- </AccordionPrimitive.Trigger>
279
- </AccordionPrimitive.Header>
280
- )
281
- }
282
- }
283
-
284
- export function AccordionXContent({ ...props }: any) {
285
- const accordionType = React.useContext(AccordionXContext)
286
-
287
- switch (accordionType) {
288
- case 'media':
289
- return (
290
- <AccordionContent {...props}>
291
- <div className="space-y-4">
292
- <p className='text-muted-foreground'>{props.children}</p>
293
- <img src={media} alt="" className='w-full rounded-md' />
294
- </div>
295
- </AccordionContent>
296
- )
297
- default:
298
- return <AccordionContent {...props} />
299
- }
300
- }
301
-
302
- export function AccordionXDemo() {
303
- const items = [
304
- {
305
- title: 'How do I track my order?',
306
- content: 'You can track your order by logging into your account.',
307
- name: 'John Doe',
308
- email: 'john@example.com',
309
- subtitle: 'Basic Plan',
310
- avatarImage: 'https://github.com/shadcn.png',
311
- media: 'https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=800&auto=format&fit=crop'
312
- },
313
- {
314
- title: 'What is your return policy?',
315
- content: 'We offer a 30-day return policy for most items.',
316
- name: 'Jane Smith',
317
- email: 'jane@example.com',
318
- subtitle: 'Pro Plan',
319
- avatarImage: 'https://github.com/vercel.png',
320
- media: 'https://images.unsplash.com/photo-1618556450994-a6a128ef0d9d?w=800&auto=format&fit=crop'
321
- },
322
- {
323
- title: 'How can I contact customer support?',
324
- content: 'Our customer support team is available 24/7.',
325
- name: 'Bob Johnson',
326
- email: 'bob@example.com',
327
- subtitle: 'Enterprise Plan',
328
- avatarImage: 'https://github.com/nextjs.png',
329
- media: 'https://images.unsplash.com/photo-1618005198919-d3d4b5a92ead?w=800&auto=format&fit=crop'
330
- }
331
- ]
332
-
333
- return (
334
- <div className="space-y-12 p-6 max-w-3xl mx-auto">
335
- <div>
336
- <h3 className="text-lg font-semibold mb-4">Default</h3>
337
- <AccordionX type="single" collapsible defaultValue="item-1">
338
- {items.map((item, index) => (
339
- <AccordionXItem key={index} value={`item-${index + 1}`}>
340
- <AccordionXTrigger>{item.title}</AccordionXTrigger>
341
- <AccordionXContent>{item.content}</AccordionXContent>
342
- </AccordionXItem>
343
- ))}
344
- </AccordionX>
345
- <TsxSection
346
- title="AccordionX"
347
- code={`<AccordionX type="single" collapsible defaultValue="item-1">
348
- {items.map((item, index) => (
349
- <AccordionXItem key={index} value={\`item-\${index + 1}\`}>
350
- <AccordionXTrigger>{item.title}</AccordionXTrigger>
351
- <AccordionXContent>{item.content}</AccordionXContent>
352
- </AccordionXItem>
353
- ))}
354
- </AccordionX>`}
355
- />
356
- </div>
357
-
358
- <div>
359
- <h3 className="text-lg font-semibold mb-4">Plus/Minus Icon</h3>
360
- <AccordionX accordionType="plusMinus" type="single" collapsible defaultValue="item-1">
361
- {items.map((item, index) => (
362
- <AccordionXItem key={index} value={`item-${index + 1}`}>
363
- <AccordionXTrigger>{item.title}</AccordionXTrigger>
364
- <AccordionXContent>{item.content}</AccordionXContent>
365
- </AccordionXItem>
366
- ))}
367
- </AccordionX>
368
- <TsxSection
369
- title="AccordionX"
370
- code={` <AccordionX accordionType="plusMinus" type="single" collapsible defaultValue="item-1">
371
- {items.map((item, index) => (
372
- <AccordionXItem key={index} value={\`item-\${index + 1}\`}>
373
- <AccordionXTrigger>{item.title}</AccordionXTrigger>
374
- <AccordionXContent>{item.content}</AccordionXContent>
375
- </AccordionXItem>
376
- ))}
377
- </AccordionX>`}
378
- />
379
- </div>
380
-
381
- <div>
382
- <h3 className="text-lg font-semibold mb-4">Avatar</h3>
383
- <AccordionX accordionType="avatar" type="single" collapsible defaultValue="item-1">
384
- {items.map((item, index) => (
385
- <AccordionXItem key={index} value={`item-${index + 1}`}>
386
- <AccordionXTrigger name={item.name} email={item.email} avatarImage={item.avatarImage} />
387
- <AccordionXContent>{item.content}</AccordionXContent>
388
- </AccordionXItem>
389
- ))}
390
- </AccordionX>
391
- <TsxSection
392
- title="AccordionX"
393
- code={`<AccordionX accordionType="avatar" type="single" collapsible defaultValue="item-1">
394
- {items.map((item, index) => (
395
- <AccordionXItem key={index} value={\`item-\${index + 1}\`}>
396
- <AccordionXTrigger name={item.name} email={item.email} avatarImage={item.avatarImage} />
397
- <AccordionXContent>{item.content}</AccordionXContent>
398
- </AccordionXItem>
399
- ))}
400
- </AccordionX>`}
401
- />
402
- </div>
403
-
404
- <div>
405
- <h3 className="text-lg font-semibold mb-4">Icon with Subtitle</h3>
406
- <AccordionX accordionType="iconSubtitle" type="single" collapsible defaultValue="item-1">
407
- {items.map((item, index) => (
408
- <AccordionXItem key={index} value={`item-${index + 1}`}>
409
- <AccordionXTrigger subtitle={item.subtitle}>{item.title}</AccordionXTrigger>
410
- <AccordionXContent>{item.content}</AccordionXContent>
411
- </AccordionXItem>
412
- ))}
413
- </AccordionX>
414
- <TsxSection
415
- title="AccordionX"
416
- code={`<AccordionX accordionType="iconSubtitle" type="single" collapsible defaultValue="item-1">
417
- {items.map((item, index) => (
418
- <AccordionXItem key={index} value={\`item-\${index + 1}\`}>
419
- <AccordionXTrigger subtitle={item.subtitle}>{item.title}</AccordionXTrigger>
420
- <AccordionXContent>{item.content}</AccordionXContent>
421
- </AccordionXItem>
422
- ))}
423
- </AccordionX>`}
424
- />
425
- </div>
426
- </div>
427
- )
428
- }