@cryptlex/web-components 5.2.0 → 5.3.0-alpha01

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 (166) hide show
  1. package/dist/components/data-table/data-table-filter.d.ts +27 -0
  2. package/dist/components/data-table/data-table-filter.js +2 -0
  3. package/dist/components/data-table/data-table-filter.js.map +1 -0
  4. package/dist/components/data-table/data-table.d.ts +72 -0
  5. package/dist/components/data-table/data-table.js +2 -0
  6. package/dist/components/data-table/data-table.js.map +1 -0
  7. package/dist/components/data-table/table-commons.d.ts +56 -0
  8. package/dist/components/data-table/table-commons.js +2 -0
  9. package/dist/components/data-table/table-commons.js.map +1 -0
  10. package/dist/components/inputs/checkbox.d.ts +8 -0
  11. package/dist/components/inputs/checkbox.js +2 -0
  12. package/dist/components/inputs/checkbox.js.map +1 -0
  13. package/dist/components/inputs/date-picker.d.ts +11 -0
  14. package/dist/components/inputs/date-picker.js +2 -0
  15. package/dist/components/inputs/date-picker.js.map +1 -0
  16. package/dist/components/inputs/datefield.d.ts +14 -0
  17. package/dist/components/inputs/datefield.js +2 -0
  18. package/dist/components/inputs/datefield.js.map +1 -0
  19. package/dist/components/inputs/field.d.ts +20 -0
  20. package/dist/components/inputs/field.js +2 -0
  21. package/dist/components/inputs/field.js.map +1 -0
  22. package/dist/components/inputs/id-search.d.ts +20 -0
  23. package/dist/components/inputs/id-search.js +2 -0
  24. package/dist/components/inputs/id-search.js.map +1 -0
  25. package/dist/components/inputs/input-otp.d.ts +7 -0
  26. package/dist/components/inputs/input-otp.js +2 -0
  27. package/dist/components/inputs/input-otp.js.map +1 -0
  28. package/dist/components/inputs/multi-select.d.ts +16 -0
  29. package/dist/components/inputs/multi-select.js +2 -0
  30. package/dist/components/inputs/multi-select.js.map +1 -0
  31. package/dist/components/inputs/numberfield.d.ts +6 -0
  32. package/dist/components/inputs/numberfield.js +2 -0
  33. package/dist/components/inputs/numberfield.js.map +1 -0
  34. package/dist/components/inputs/searchfield.d.ts +5 -0
  35. package/dist/components/inputs/searchfield.js +2 -0
  36. package/dist/components/inputs/searchfield.js.map +1 -0
  37. package/dist/components/inputs/select-options.d.ts +8 -0
  38. package/dist/components/inputs/select-options.js +2 -0
  39. package/dist/components/inputs/select-options.js.map +1 -0
  40. package/dist/components/inputs/select.d.ts +17 -0
  41. package/dist/components/inputs/select.js +2 -0
  42. package/dist/components/inputs/select.js.map +1 -0
  43. package/dist/components/inputs/textfield.d.ts +7 -0
  44. package/dist/components/inputs/textfield.js +2 -0
  45. package/dist/components/inputs/textfield.js.map +1 -0
  46. package/dist/components/key-value-card/key-value-card.d.ts +17 -0
  47. package/dist/components/key-value-card/key-value-card.js +2 -0
  48. package/dist/components/key-value-card/key-value-card.js.map +1 -0
  49. package/dist/components/ui/alert.d.ts +8 -0
  50. package/dist/components/ui/alert.js +2 -0
  51. package/dist/components/ui/alert.js.map +1 -0
  52. package/dist/components/ui/avatar.d.ts +7 -0
  53. package/dist/components/ui/avatar.js +2 -0
  54. package/dist/components/ui/avatar.js.map +1 -0
  55. package/dist/components/ui/badge.d.ts +1 -0
  56. package/dist/components/ui/badge.js +2 -0
  57. package/dist/components/ui/badge.js.map +1 -0
  58. package/dist/components/ui/breadcrumbs.d.ts +10 -0
  59. package/dist/components/ui/breadcrumbs.js +2 -0
  60. package/dist/components/ui/breadcrumbs.js.map +1 -0
  61. package/dist/components/ui/button.d.ts +11 -0
  62. package/dist/components/ui/button.js +2 -0
  63. package/dist/components/ui/button.js.map +1 -0
  64. package/dist/components/ui/calendar.d.ts +16 -0
  65. package/dist/components/ui/calendar.js +2 -0
  66. package/dist/components/ui/calendar.js.map +1 -0
  67. package/dist/components/ui/card.d.ts +7 -0
  68. package/dist/components/ui/card.js +2 -0
  69. package/dist/components/ui/card.js.map +1 -0
  70. package/dist/components/ui/dialog.d.ts +18 -0
  71. package/dist/components/ui/dialog.js +2 -0
  72. package/dist/components/ui/dialog.js.map +1 -0
  73. package/dist/components/ui/disclosure.d.ts +18 -0
  74. package/dist/components/ui/disclosure.js +2 -0
  75. package/dist/components/ui/disclosure.js.map +1 -0
  76. package/dist/components/ui/list-box.d.ts +5 -0
  77. package/dist/components/ui/list-box.js +2 -0
  78. package/dist/components/ui/list-box.js.map +1 -0
  79. package/dist/components/ui/loader.d.ts +5 -0
  80. package/dist/components/ui/loader.js +2 -0
  81. package/dist/components/ui/loader.js.map +1 -0
  82. package/dist/components/ui/menu.d.ts +24 -0
  83. package/dist/components/ui/menu.js +2 -0
  84. package/dist/components/ui/menu.js.map +1 -0
  85. package/dist/components/ui/popover.d.ts +4 -0
  86. package/dist/components/ui/popover.js +2 -0
  87. package/dist/components/ui/popover.js.map +1 -0
  88. package/dist/components/ui/sidebar.d.ts +52 -0
  89. package/dist/components/ui/sidebar.js +2 -0
  90. package/dist/components/ui/sidebar.js.map +1 -0
  91. package/dist/components/ui/skeleton.d.ts +1 -0
  92. package/dist/components/ui/skeleton.js +2 -0
  93. package/dist/components/ui/skeleton.js.map +1 -0
  94. package/dist/components/ui/sonner.d.ts +4 -0
  95. package/dist/components/ui/sonner.js +2 -0
  96. package/dist/components/ui/sonner.js.map +1 -0
  97. package/dist/components/ui/table.d.ts +8 -0
  98. package/dist/components/ui/table.js +2 -0
  99. package/dist/components/ui/table.js.map +1 -0
  100. package/dist/components/ui/tabs.d.ts +5 -0
  101. package/dist/components/ui/tabs.js +2 -0
  102. package/dist/components/ui/tabs.js.map +1 -0
  103. package/dist/components/ui/timeline.d.ts +15 -0
  104. package/dist/components/ui/timeline.js +2 -0
  105. package/dist/components/ui/timeline.js.map +1 -0
  106. package/dist/components/ui/tooltip.d.ts +4 -0
  107. package/dist/components/ui/tooltip.js +2 -0
  108. package/dist/components/ui/tooltip.js.map +1 -0
  109. package/dist/utils/form-context.d.ts +4 -0
  110. package/dist/utils/form-context.js +2 -0
  111. package/dist/utils/form-context.js.map +1 -0
  112. package/dist/utils/form-hook.d.ts +23 -0
  113. package/dist/utils/form-hook.js +2 -0
  114. package/dist/utils/form-hook.js.map +1 -0
  115. package/dist/utils/primitives.d.ts +44 -0
  116. package/dist/utils/primitives.js +2 -0
  117. package/dist/utils/primitives.js.map +1 -0
  118. package/dist/utils/resource-names.d.ts +11 -0
  119. package/dist/utils/resource-names.js +2 -0
  120. package/dist/utils/resource-names.js.map +1 -0
  121. package/dist/utils/use-mobile.d.ts +1 -0
  122. package/dist/utils/use-mobile.js +2 -0
  123. package/dist/utils/use-mobile.js.map +1 -0
  124. package/package.json +16 -8
  125. package/lib/components/data-table/data-table-filter.tsx +0 -220
  126. package/lib/components/data-table/data-table.tsx +0 -593
  127. package/lib/components/data-table/table-commons.tsx +0 -233
  128. package/lib/components/inputs/checkbox.tsx +0 -72
  129. package/lib/components/inputs/date-picker.tsx +0 -130
  130. package/lib/components/inputs/datefield.tsx +0 -109
  131. package/lib/components/inputs/field.tsx +0 -106
  132. package/lib/components/inputs/id-search.tsx +0 -83
  133. package/lib/components/inputs/input-otp.tsx +0 -63
  134. package/lib/components/inputs/multi-select.tsx +0 -62
  135. package/lib/components/inputs/numberfield.tsx +0 -110
  136. package/lib/components/inputs/searchfield.tsx +0 -87
  137. package/lib/components/inputs/select-options.tsx +0 -303
  138. package/lib/components/inputs/select.tsx +0 -140
  139. package/lib/components/inputs/textfield.tsx +0 -96
  140. package/lib/components/key-value-card/key-value-card.tsx +0 -115
  141. package/lib/components/ui/alert.tsx +0 -32
  142. package/lib/components/ui/avatar.tsx +0 -22
  143. package/lib/components/ui/badge.tsx +0 -19
  144. package/lib/components/ui/breadcrumbs.tsx +0 -104
  145. package/lib/components/ui/button.tsx +0 -66
  146. package/lib/components/ui/calendar.tsx +0 -220
  147. package/lib/components/ui/card.tsx +0 -58
  148. package/lib/components/ui/dialog.tsx +0 -172
  149. package/lib/components/ui/disclosure.tsx +0 -113
  150. package/lib/components/ui/list-box.tsx +0 -86
  151. package/lib/components/ui/loader.tsx +0 -10
  152. package/lib/components/ui/menu.tsx +0 -168
  153. package/lib/components/ui/popover.tsx +0 -37
  154. package/lib/components/ui/sidebar.tsx +0 -552
  155. package/lib/components/ui/skeleton.tsx +0 -7
  156. package/lib/components/ui/sonner.tsx +0 -26
  157. package/lib/components/ui/table.tsx +0 -79
  158. package/lib/components/ui/tabs.tsx +0 -82
  159. package/lib/components/ui/timeline.tsx +0 -52
  160. package/lib/components/ui/tooltip.tsx +0 -30
  161. package/lib/tokens.scss +0 -89
  162. package/lib/utils/form-context.tsx +0 -7
  163. package/lib/utils/form-hook.tsx +0 -33
  164. package/lib/utils/primitives.ts +0 -68
  165. package/lib/utils/resource-names.tsx +0 -245
  166. package/lib/utils/use-mobile.tsx +0 -21
@@ -1,220 +0,0 @@
1
- import { getLocalTimeZone, today } from "@internationalized/date"
2
- import * as React from "react"
3
- import {
4
- Calendar as AriaCalendar,
5
- CalendarCell as AriaCalendarCell,
6
- CalendarCellProps as AriaCalendarCellProps,
7
- CalendarGrid as AriaCalendarGrid,
8
- CalendarGridBody as AriaCalendarGridBody,
9
- CalendarGridBodyProps as AriaCalendarGridBodyProps,
10
- CalendarGridHeader as AriaCalendarGridHeader,
11
- CalendarGridProps as AriaCalendarGridProps,
12
- CalendarHeaderCell as AriaCalendarHeaderCell,
13
- CalendarHeaderCellProps as AriaCalendarHeaderCellProps,
14
- CalendarProps as AriaCalendarProps,
15
- DateValue as AriaDateValue,
16
- Heading as AriaHeading,
17
- RangeCalendar as AriaRangeCalendar,
18
- RangeCalendarProps as AriaRangeCalendarProps,
19
- RangeCalendarStateContext as AriaRangeCalendarStateContext,
20
- composeRenderProps,
21
- Text,
22
- useLocale
23
- } from "react-aria-components"
24
-
25
- import { Button, buttonVariants } from "lib/components/ui/button"
26
- import { cn } from "lib/utils/primitives"
27
- import { ChevronLeft, ChevronRight } from "lucide-react"
28
-
29
- export function CalendarHeading(props: React.HTMLAttributes<HTMLElement>) {
30
- let { direction } = useLocale()
31
-
32
- return (
33
- <header className="flex w-full items-center gap-1 px-1 pb-4" {...props}>
34
- <Button
35
- slot="previous"
36
- size='none'
37
- className={cn(
38
- "size-7 bg-transparent p-0 opacity-50",
39
- /* Hover */
40
- "data-[hovered]:opacity-100"
41
- )}
42
- >
43
- {direction === "rtl" ? (
44
- <ChevronRight aria-hidden />
45
- ) : (
46
- <ChevronLeft aria-hidden />
47
- )}
48
- </Button>
49
- <AriaHeading className="grow text-center text-sm font-medium" />
50
- <Button
51
- slot="next"
52
- className={cn(
53
- "size-7 bg-transparent p-0 opacity-50",
54
- /* Hover */
55
- "data-[hovered]:opacity-100"
56
- )}
57
- >
58
- {direction === "rtl" ? (
59
- <ChevronLeft aria-hidden />
60
- ) : (
61
- <ChevronRight aria-hidden />
62
- )}
63
- </Button>
64
- </header>
65
- )
66
- }
67
-
68
- export function CalendarGrid({ className, ...props }: AriaCalendarGridProps) {
69
- return (
70
- <AriaCalendarGrid
71
- className={cn(
72
- " border-separate border-spacing-x-0 border-spacing-y-1 ",
73
- className
74
- )}
75
- {...props}
76
- />
77
- )
78
- }
79
-
80
- export const CalendarGridHeader = AriaCalendarGridHeader;
81
-
82
- export function CalendarHeaderCell({
83
- className,
84
- ...props
85
- }: AriaCalendarHeaderCellProps) {
86
- return (
87
- <AriaCalendarHeaderCell
88
- className={cn(
89
- "w-9 text-xs font-normal text-muted-foreground",
90
- className
91
- )}
92
- {...props}
93
- />
94
- )
95
- }
96
-
97
- export function CalendarGridBody({
98
- className,
99
- ...props
100
- }: AriaCalendarGridBodyProps) {
101
- return (
102
- <AriaCalendarGridBody className={cn("[&>tr>td]:p-0", className)} {...props} />
103
- )
104
- }
105
-
106
- export function CalendarCell({ className, ...props }: AriaCalendarCellProps) {
107
- const isRange = Boolean(React.useContext(AriaRangeCalendarStateContext))
108
- return (
109
- <AriaCalendarCell
110
- className={composeRenderProps(className, (className, renderProps) =>
111
- cn(
112
- buttonVariants({ variant: "ghost", size: 'none' }),
113
- "relative flex size-9 items-center justify-center p-0 text-sm font-normal",
114
- /* Disabled */
115
- renderProps.isDisabled && "text-muted-foreground opacity-50",
116
- /* Selected */
117
- renderProps.isSelected &&
118
- "bg-primary text-primary-foreground data-[focused]:bg-primary data-[focused]:text-primary-foreground",
119
- /* Hover */
120
- renderProps.isHovered &&
121
- renderProps.isSelected &&
122
- (renderProps.isSelectionStart ||
123
- renderProps.isSelectionEnd ||
124
- !isRange) &&
125
- "data-[hovered]:bg-primary data-[hovered]:text-primary-foreground",
126
- /* Selection Start/End */
127
- renderProps.isSelected &&
128
- isRange &&
129
- !renderProps.isSelectionStart &&
130
- !renderProps.isSelectionEnd &&
131
- "rounded-none bg-accent text-accent-foreground",
132
- /* Outside Month */
133
- renderProps.isOutsideMonth &&
134
- "text-muted-foreground opacity-50 data-[selected]:bg-accent/50 data-[selected]:text-muted-foreground data-[selected]:opacity-30",
135
- /* Current Date */
136
- renderProps.date.compare(today(getLocalTimeZone())) === 0 &&
137
- !renderProps.isSelected &&
138
- "bg-accent text-accent-foreground",
139
- /* Unavailable Date */
140
- renderProps.isUnavailable && "cursor-default text-destructive ",
141
- renderProps.isInvalid &&
142
- "bg-destructive text-destructive-foreground data-[focused]:bg-destructive data-[hovered]:bg-destructive data-[focused]:text-destructive-foreground data-[hovered]:text-destructive-foreground",
143
- className
144
- )
145
- )}
146
- {...props}
147
- />
148
- )
149
- }
150
-
151
- interface CalendarProps<T extends AriaDateValue>
152
- extends AriaCalendarProps<T> {
153
- errorMessage?: string
154
- }
155
-
156
- export function Calendar<T extends AriaDateValue>({
157
- errorMessage,
158
- className,
159
- ...props
160
- }: CalendarProps<T>) {
161
- return (
162
- <AriaCalendar
163
- className={composeRenderProps(className, (className) =>
164
- cn("w-fit", className)
165
- )}
166
- {...props}
167
- >
168
- <CalendarHeading />
169
- <CalendarGrid>
170
- <CalendarGridHeader>
171
- {(day) => <CalendarHeaderCell>{day}</CalendarHeaderCell>}
172
- </CalendarGridHeader>
173
- <CalendarGridBody>
174
- {(date) => <CalendarCell date={date} />}
175
- </CalendarGridBody>
176
- </CalendarGrid>
177
- {errorMessage && (
178
- <Text className="text-sm text-destructive" slot="errorMessage">
179
- {errorMessage}
180
- </Text>
181
- )}
182
- </AriaCalendar>
183
- )
184
- }
185
-
186
- interface RangeCalendarProps<T extends AriaDateValue>
187
- extends AriaRangeCalendarProps<T> {
188
- errorMessage?: string
189
- }
190
-
191
- export function RangeCalendar<T extends AriaDateValue>({
192
- errorMessage,
193
- className,
194
- ...props
195
- }: RangeCalendarProps<T>) {
196
- return (
197
- <AriaRangeCalendar
198
- className={composeRenderProps(className, (className) =>
199
- cn("w-fit", className)
200
- )}
201
- {...props}
202
- >
203
- <CalendarHeading />
204
- <CalendarGrid>
205
- <CalendarGridHeader>
206
- {(day) => <CalendarHeaderCell>{day}</CalendarHeaderCell>}
207
- </CalendarGridHeader>
208
- <CalendarGridBody>
209
- {(date) => <CalendarCell date={date} />}
210
- </CalendarGridBody>
211
- </CalendarGrid>
212
- {errorMessage && (
213
- <Text slot="errorMessage" className="text-sm text-destructive">
214
- {errorMessage}
215
- </Text>
216
- )}
217
- </AriaRangeCalendar>
218
- )
219
- }
220
-
@@ -1,58 +0,0 @@
1
- import { cn } from "lib/utils/primitives";
2
- import type * as React from "react";
3
-
4
- export function Card({ className, ...props }: React.ComponentProps<"div">) {
5
- return (
6
- <div
7
- className={cn(
8
- "flex flex-col p-icon border border-border bg-card text-card-foreground",
9
- className,
10
- )}
11
- {...props}
12
- />
13
- );
14
- }
15
-
16
- export function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
17
- return (
18
- <div
19
- className={cn("flex flex-col gap-y-1 pb-icon shrink-0", className)}
20
- {...props}
21
- />
22
- );
23
- }
24
-
25
-
26
- export function CardTitle({ className, ...props }: React.ComponentProps<"h3">) {
27
- return (
28
- <h3 className={cn("h4 leading-none", className)} {...props} />
29
- );
30
- }
31
-
32
-
33
- export function CardDescription({
34
- className,
35
- ...props
36
- }: React.ComponentProps<"p">) {
37
- return (
38
- <p className={cn("caption", className)} {...props} />
39
- );
40
- }
41
-
42
- export function CardContent({ className, ...props }: React.ComponentProps<"div">) {
43
- return (
44
- <div className={cn("grow body", className)} {...props} />
45
- );
46
- }
47
-
48
-
49
- export function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
50
- return (
51
- <div
52
- className={cn("flex items-center w-full pt-icon gap-2 justify-end", className)}
53
- {...props}
54
- />
55
- );
56
- }
57
-
58
-
@@ -1,172 +0,0 @@
1
- import { cva, type VariantProps } from "class-variance-authority"
2
- import * as React from "react"
3
- import {
4
- Dialog as AriaDialog,
5
- DialogProps as AriaDialogProps,
6
- DialogTrigger as AriaDialogTrigger,
7
- Heading as AriaHeading,
8
- HeadingProps as AriaHeadingProps,
9
- Modal as AriaModal,
10
- ModalOverlay as AriaModalOverlay,
11
- ModalOverlayProps as AriaModalOverlayProps,
12
- composeRenderProps
13
- } from "react-aria-components"
14
-
15
- import { Button } from "lib/components/ui/button"
16
- import { cn } from "lib/utils/primitives"
17
- import { X } from "lucide-react"
18
-
19
- const sheetVariants = cva(
20
- [
21
- "fixed z-50 gap-4 bg-popover transition ease-in-out",
22
- "data-[entering]:duration-200 data-[entering]:animate-in data-[entering]:fade-in-0 data-[exiting]:duration-200 data-[exiting]:animate-out data-[exiting]:fade-out-0",
23
- ],
24
- {
25
- variants: {
26
- side: {
27
- top: "inset-x-0 top-0 border-b data-[entering]:slide-in-from-top data-[exiting]:slide-out-to-top max-h-table",
28
- bottom:
29
- "inset-x-0 bottom-0 border-t data-[entering]:slide-in-from-bottom data-[exiting]:slide-out-to-bottom max-h-table",
30
- left: "inset-y-0 left-0 h-full w-3/4 border-r data-[entering]:slide-in-from-left data-[exiting]:slide-out-to-left sm:max-w-sm",
31
- right:
32
- "inset-y-0 right-0 h-full w-3/4 border-l data-[entering]:slide-in-from-right data-[exiting]:slide-out-to-right sm:max-w-sm",
33
- },
34
- },
35
- }
36
- )
37
-
38
- export const DialogTrigger = AriaDialogTrigger
39
-
40
- export const DialogOverlay = ({
41
- className,
42
- isDismissable = true,
43
- ...props
44
- }: AriaModalOverlayProps) => (
45
- <AriaModalOverlay
46
- isDismissable={isDismissable}
47
- className={composeRenderProps(className, (className) =>
48
- cn(
49
- "fixed inset-0 z-50 bg-card/20",
50
- /* Exiting */
51
- "data-[exiting]:duration-100 data-[exiting]:animate-out",
52
- /* Entering */
53
- "data-[entering]:animate-in",
54
- className
55
- )
56
- )}
57
- {...props}
58
- />
59
- )
60
-
61
- export interface DialogContentProps
62
- extends Omit<React.ComponentProps<typeof AriaModal>, "children">,
63
- VariantProps<typeof sheetVariants> {
64
- children?: AriaDialogProps["children"]
65
- role?: AriaDialogProps["role"]
66
- closeButton?: boolean
67
- }
68
-
69
- export function DialogContent({
70
- className,
71
- children,
72
- side,
73
- role,
74
- closeButton = true,
75
- ...props
76
- }: DialogContentProps) {
77
- return (
78
- <AriaModal
79
- className={composeRenderProps(className, (className) =>
80
- cn(
81
- side
82
- ? sheetVariants({ side, className: "h-full p-6" })
83
- : ["fixed left-[50vw] top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 border bg-popover p-icon duration-100 data-[exiting]:duration-100 data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:fade-in-0 data-[exiting]:fade-out-0 data-[entering]:zoom-in-95 data-[exiting]:zoom-out-95 md:w-full"],
84
- className
85
- )
86
- )}
87
- {...props}
88
- >
89
- <AriaDialog
90
- role={role}
91
- className={cn(!side && "grid h-full gap-4 relative", "h-full outline-none")}
92
- >
93
- {composeRenderProps(children, (children, renderProps) => (
94
- <>
95
- {children}
96
- {closeButton && (
97
- <div className="absolute right-1 top-1">
98
- <Button
99
- size={'icon'}
100
- variant={'destructive'}
101
- onPress={renderProps.close}
102
- className="opacity-70 transition-opacity data-[hovered]:opacity-100"
103
- >
104
- <X />
105
- <span className="sr-only">Close</span>
106
- </Button>
107
- </div>
108
- )}
109
- </>
110
- ))}
111
- </AriaDialog>
112
- </AriaModal>
113
- )
114
- }
115
-
116
- export function DialogHeader({
117
- className,
118
- ...props
119
- }: React.HTMLAttributes<HTMLDivElement>) {
120
- return (
121
- <div
122
- className={cn(
123
- "flex flex-col gap-y-2 text-center sm:text-left",
124
- className
125
- )}
126
- {...props}
127
- />
128
- )
129
- }
130
-
131
- export function DialogFooter({
132
- className,
133
- ...props
134
- }: React.HTMLAttributes<HTMLDivElement>) {
135
- return (
136
- <div
137
- className={cn(
138
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-x-2",
139
- className
140
- )}
141
- {...props}
142
- />
143
- )
144
- }
145
-
146
- export function DialogTitle({ className, ...props }: AriaHeadingProps) {
147
- return (
148
- <AriaHeading
149
- slot="title"
150
- className={cn(
151
- "text-lg font-semibold leading-none tracking-tight",
152
- className
153
- )}
154
- {...props}
155
- />
156
- )
157
- }
158
-
159
- export function DialogDescription({
160
- className,
161
- ...props
162
- }: React.HTMLAttributes<HTMLParagraphElement>) {
163
- return (
164
- <p
165
- className={cn(
166
- "flex flex-col gap-y-1 text-center sm:text-left",
167
- className
168
- )}
169
- {...props}
170
- />
171
- )
172
- }
@@ -1,113 +0,0 @@
1
- import { ChevronDownIcon } from "lucide-react"
2
- import React, { useContext } from "react"
3
- import {
4
- Disclosure as AriaDisclosure,
5
- DisclosureGroup as AriaDisclosureGroup,
6
- DisclosureGroupProps as AriaDisclosureGroupProps,
7
- DisclosurePanel as AriaDisclosurePanel,
8
- DisclosurePanelProps as AriaDisclosurePanelProps,
9
- DisclosureProps as AriaDisclosureProps,
10
- Button,
11
- ButtonProps,
12
- composeRenderProps,
13
- DisclosureGroupStateContext,
14
- Heading,
15
- } from "react-aria-components"
16
-
17
- import { cn } from "lib/utils/primitives"
18
-
19
- export interface DisclosureProps extends AriaDisclosureProps {
20
- children: React.ReactNode
21
- }
22
-
23
- export function Disclosure({ children, className, ...props }: DisclosureProps) {
24
- let isInGroup = useContext(DisclosureGroupStateContext) !== null
25
- return (
26
- <AriaDisclosure
27
- {...props}
28
- className={composeRenderProps(className, (className, _) =>
29
- cn(
30
- "group min-w-64",
31
- isInGroup && "border-0 border-b last:border-b-0",
32
- className
33
- )
34
- )}
35
- >
36
- {children}
37
- </AriaDisclosure>
38
- )
39
- }
40
-
41
- export interface DisclosureHeaderProps {
42
- children: React.ReactNode
43
- className?: ButtonProps["className"]
44
- }
45
-
46
- export function DisclosureHeader({ children, className }: DisclosureHeaderProps) {
47
- return (
48
- <Heading className="flex">
49
- <Button
50
- slot="trigger"
51
- className={composeRenderProps(className, (className) => {
52
- return cn(
53
- "group flex flex-1 items-center justify-between rounded-md py-4 font-medium ring-offset-background transition-all hover:underline",
54
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
55
- "data-[focus-visible]:outline-none data-[focus-visible]:ring-2 data-[focus-visible]:ring-ring data-[focus-visible]:ring-offset-2",
56
- "outline-none",
57
- className
58
- )
59
- })}
60
- >
61
- {children}
62
- <ChevronDownIcon
63
- aria-hidden
64
- className={cn(
65
- "size-4 shrink-0 transition-transform duration-200",
66
- "group-data-[expanded]:rotate-180",
67
- "group-data-[disabled]:opacity-50"
68
- )}
69
- />
70
- </Button>
71
- </Heading>
72
- )
73
- }
74
-
75
- export interface DisclosurePanelProps extends AriaDisclosurePanelProps {
76
- children: React.ReactNode
77
- }
78
-
79
- export function DisclosurePanel({
80
- children,
81
- className,
82
- ...props
83
- }: DisclosurePanelProps) {
84
- return (
85
- <AriaDisclosurePanel
86
- {...props}
87
- className={"overflow-hidden text-sm transition-all"}
88
- >
89
- <div className={cn("pb-4 pt-0", className)}>{children}</div>
90
- </AriaDisclosurePanel>
91
- )
92
- }
93
-
94
- export interface DisclosureGroupProps extends AriaDisclosureGroupProps {
95
- children: React.ReactNode
96
- }
97
-
98
- export function DisclosureGroup({
99
- children,
100
- className,
101
- ...props
102
- }: DisclosureGroupProps) {
103
- return (
104
- <AriaDisclosureGroup
105
- {...props}
106
- className={composeRenderProps(className, (className, _) =>
107
- cn("", className)
108
- )}
109
- >
110
- {children}
111
- </AriaDisclosureGroup>
112
- )
113
- }
@@ -1,86 +0,0 @@
1
- import {
2
- Collection as AriaCollection,
3
- Header as AriaHeader,
4
- ListBox as AriaListBox,
5
- ListBoxItem as AriaListBoxItem,
6
- ListBoxItemProps as AriaListBoxItemProps,
7
- ListBoxProps as AriaListBoxProps,
8
- composeRenderProps
9
- } from "react-aria-components"
10
-
11
- import { cn } from "lib/utils/primitives"
12
- import { Check } from "lucide-react"
13
-
14
-
15
- export const ListBoxCollection = AriaCollection
16
-
17
- export function ListBox<T extends object>({
18
- className,
19
- ...props
20
- }: AriaListBoxProps<T>) {
21
- return (
22
- <AriaListBox
23
- className={composeRenderProps(className, (className) =>
24
- cn(
25
- className,
26
- "group overflow-auto border bg-popover p-1 text-popover-foreground shadow-md outline-none",
27
- /* Empty */
28
- "data-[empty]:p-6 data-[empty]:text-center data-[empty]:text-sm"
29
- )
30
- )}
31
- {...props}
32
- />
33
- )
34
- }
35
-
36
- export function ListBoxItem<T extends object>({
37
- className,
38
- children,
39
- ...props
40
- }: AriaListBoxItemProps<T>) {
41
- return (
42
- <AriaListBoxItem
43
- textValue={
44
- props.textValue || (typeof children === "string" ? children : undefined)
45
- }
46
- className={composeRenderProps(className, (className) =>
47
- cn(
48
- "relative flex w-full cursor-default select-none items-center px-2 py-1.5 text-sm outline-none",
49
- /* Disabled */
50
- "disabled-muted",
51
- /* Focused */
52
- "data-[focused]:bg-accent data-[focused]:text-accent-foreground",
53
- /* Hovered */
54
- "data-[hovered]:bg-accent data-[hovered]:text-accent-foreground",
55
- /* Selection */
56
- "data-[selection-mode]:pl-input",
57
- className
58
- )
59
- )}
60
- {...props}
61
- >
62
- {composeRenderProps(children, (children, renderProps) => (
63
- <>
64
- {renderProps.isSelected && (
65
- <span className="absolute left-2 flex size-icon items-center justify-center">
66
- <Check className="size-icon" />
67
- </span>
68
- )}
69
- {children}
70
- </>
71
- ))}
72
- </AriaListBoxItem>
73
- )
74
- }
75
-
76
- export function ListBoxHeader({
77
- className,
78
- ...props
79
- }: React.ComponentProps<typeof AriaHeader>) {
80
- return (
81
- <AriaHeader
82
- className={cn("py-1.5 pl-input pr-2 text-sm font-semibold", className)}
83
- {...props}
84
- />
85
- )
86
- }
@@ -1,10 +0,0 @@
1
- import { cn } from "lib/utils/primitives";
2
- import { Loader2 } from "lucide-react";
3
-
4
- interface LoaderProps {
5
- className?: string; // Define props interface
6
- }
7
-
8
- export function Loader({ className }: LoaderProps) {
9
- return <Loader2 className={cn(`animate-spin size-icon`, className)} />;
10
- }