@sikka/hawa 0.1.14 → 0.1.16
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.
- package/dist/styles.css +103 -6
- package/es/elements/DropdownMenu.d.ts +26 -0
- package/es/elements/Select.d.ts +11 -0
- package/es/elements/Skeleton.d.ts +2 -2
- package/es/elements/Textarea.d.ts +5 -0
- package/es/elements/index.d.ts +1 -0
- package/es/index.es.js +2 -2
- package/es/layout/HawaAppLayoutSimplified.d.ts +15 -6
- package/lib/elements/DropdownMenu.d.ts +26 -0
- package/lib/elements/Select.d.ts +11 -0
- package/lib/elements/Skeleton.d.ts +2 -2
- package/lib/elements/Textarea.d.ts +5 -0
- package/lib/elements/index.d.ts +1 -0
- package/lib/index.js +3 -3
- package/lib/layout/HawaAppLayoutSimplified.d.ts +15 -6
- package/package.json +1 -1
- package/src/elements/DropdownMenu.tsx +325 -0
- package/src/elements/Select.tsx +146 -0
- package/src/elements/Skeleton.tsx +1 -0
- package/src/elements/Textarea.tsx +24 -0
- package/src/elements/index.ts +1 -0
- package/src/layout/HawaAppLayoutSimplified.tsx +70 -38
- package/src/styles.css +103 -6
- package/src/translations/ar.json +2 -1
- package/src/translations/en.json +2 -1
|
@@ -19,15 +19,24 @@ type HawaAppLayoutTypes = {
|
|
|
19
19
|
username?: string;
|
|
20
20
|
email?: string;
|
|
21
21
|
drawerSize?: "sm" | "md" | "large";
|
|
22
|
-
profileMenuItems?:
|
|
22
|
+
profileMenuItems?: Item[];
|
|
23
23
|
onSettingsClick?: () => void;
|
|
24
|
-
DrawerFooterActions
|
|
24
|
+
DrawerFooterActions?: any;
|
|
25
|
+
texts?: {
|
|
26
|
+
expandSidebar?: string;
|
|
27
|
+
collapseSidebar?: string;
|
|
28
|
+
};
|
|
25
29
|
};
|
|
26
|
-
type
|
|
27
|
-
icon?: JSX.Element;
|
|
30
|
+
type SubItem = {
|
|
28
31
|
label: string;
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
value: string;
|
|
33
|
+
highlighted?: boolean;
|
|
34
|
+
};
|
|
35
|
+
type Item = {
|
|
36
|
+
label: string;
|
|
37
|
+
value: string;
|
|
38
|
+
highlighted?: boolean;
|
|
39
|
+
subitems?: SubItem[];
|
|
31
40
|
};
|
|
32
41
|
export declare const HawaAppLayoutSimplified: React.FunctionComponent<HawaAppLayoutTypes>;
|
|
33
42
|
export {};
|
package/package.json
CHANGED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../util"
|
|
7
|
+
|
|
8
|
+
const DropdownMenuRoot = DropdownMenuPrimitive.Root
|
|
9
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
10
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
|
11
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
12
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
|
13
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
|
|
14
|
+
|
|
15
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
16
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
17
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
18
|
+
inset?: boolean
|
|
19
|
+
}
|
|
20
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
21
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
22
|
+
ref={ref}
|
|
23
|
+
className={cn(
|
|
24
|
+
"flex cursor-default select-none items-center justify-between rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
25
|
+
inset && "pl-8",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
{/* <ChevronRight className="ml-auto h-4 w-4" /> */}
|
|
32
|
+
<svg
|
|
33
|
+
aria-label="Chevron Right Icon"
|
|
34
|
+
stroke="currentColor"
|
|
35
|
+
fill="currentColor"
|
|
36
|
+
stroke-width="0"
|
|
37
|
+
viewBox="0 0 16 16"
|
|
38
|
+
height="1em"
|
|
39
|
+
width="1em"
|
|
40
|
+
className={cn(props.dir === "rtl" ? "rotate-180" : "")}
|
|
41
|
+
>
|
|
42
|
+
<path
|
|
43
|
+
fill-rule="evenodd"
|
|
44
|
+
d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
|
|
45
|
+
></path>
|
|
46
|
+
</svg>
|
|
47
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
48
|
+
))
|
|
49
|
+
DropdownMenuSubTrigger.displayName =
|
|
50
|
+
DropdownMenuPrimitive.SubTrigger.displayName
|
|
51
|
+
|
|
52
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
53
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
54
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
55
|
+
>(({ className, ...props }, ref) => (
|
|
56
|
+
<DropdownMenuPrimitive.SubContent
|
|
57
|
+
ref={ref}
|
|
58
|
+
className={cn(
|
|
59
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
60
|
+
className
|
|
61
|
+
)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
))
|
|
65
|
+
DropdownMenuSubContent.displayName =
|
|
66
|
+
DropdownMenuPrimitive.SubContent.displayName
|
|
67
|
+
|
|
68
|
+
const DropdownMenuContent = React.forwardRef<
|
|
69
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
70
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
71
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
72
|
+
<DropdownMenuPrimitive.Portal>
|
|
73
|
+
<DropdownMenuPrimitive.Content
|
|
74
|
+
ref={ref}
|
|
75
|
+
sideOffset={sideOffset}
|
|
76
|
+
className={cn(
|
|
77
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
</DropdownMenuPrimitive.Portal>
|
|
83
|
+
))
|
|
84
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
|
|
85
|
+
|
|
86
|
+
const DropdownMenuItem = React.forwardRef<
|
|
87
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
88
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
89
|
+
inset?: boolean
|
|
90
|
+
}
|
|
91
|
+
>(({ className, inset, ...props }, ref) => (
|
|
92
|
+
<DropdownMenuPrimitive.Item
|
|
93
|
+
ref={ref}
|
|
94
|
+
className={cn(
|
|
95
|
+
"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
96
|
+
inset && "pl-8",
|
|
97
|
+
className
|
|
98
|
+
)}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
))
|
|
102
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
|
103
|
+
|
|
104
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
105
|
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
106
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
107
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
108
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
109
|
+
ref={ref}
|
|
110
|
+
className={cn(
|
|
111
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
112
|
+
className
|
|
113
|
+
)}
|
|
114
|
+
checked={checked}
|
|
115
|
+
{...props}
|
|
116
|
+
>
|
|
117
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
118
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
119
|
+
{/* <Check className="h-4 w-4" /> */}
|
|
120
|
+
<svg
|
|
121
|
+
aria-label="Check Mark"
|
|
122
|
+
stroke="currentColor"
|
|
123
|
+
fill="currentColor"
|
|
124
|
+
stroke-width="0"
|
|
125
|
+
viewBox="0 0 512 512"
|
|
126
|
+
height="0.60em"
|
|
127
|
+
width="0.60em"
|
|
128
|
+
>
|
|
129
|
+
<path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"></path>
|
|
130
|
+
</svg>{" "}
|
|
131
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
132
|
+
</span>
|
|
133
|
+
{children}
|
|
134
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
135
|
+
))
|
|
136
|
+
DropdownMenuCheckboxItem.displayName =
|
|
137
|
+
DropdownMenuPrimitive.CheckboxItem.displayName
|
|
138
|
+
|
|
139
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
140
|
+
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
141
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
142
|
+
>(({ className, children, ...props }, ref) => (
|
|
143
|
+
<DropdownMenuPrimitive.RadioItem
|
|
144
|
+
ref={ref}
|
|
145
|
+
className={cn(
|
|
146
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
147
|
+
className
|
|
148
|
+
)}
|
|
149
|
+
{...props}
|
|
150
|
+
>
|
|
151
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
152
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
153
|
+
{/* <Circle className="h-2 w-2 fill-current" /> */}
|
|
154
|
+
<svg
|
|
155
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
156
|
+
width="24"
|
|
157
|
+
aria-label="Circle"
|
|
158
|
+
height="24"
|
|
159
|
+
viewBox="0 0 24 24"
|
|
160
|
+
fill="none"
|
|
161
|
+
stroke="currentColor"
|
|
162
|
+
stroke-width="2"
|
|
163
|
+
stroke-linecap="round"
|
|
164
|
+
stroke-linejoin="round"
|
|
165
|
+
className="h-2 w-2 fill-current"
|
|
166
|
+
>
|
|
167
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
168
|
+
</svg>
|
|
169
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
170
|
+
</span>
|
|
171
|
+
{children}
|
|
172
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
173
|
+
))
|
|
174
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
|
|
175
|
+
|
|
176
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
177
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
178
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
|
179
|
+
inset?: boolean
|
|
180
|
+
}
|
|
181
|
+
>(({ className, inset, ...props }, ref) => (
|
|
182
|
+
<DropdownMenuPrimitive.Label
|
|
183
|
+
ref={ref}
|
|
184
|
+
className={cn(
|
|
185
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
186
|
+
inset && "pl-8",
|
|
187
|
+
className
|
|
188
|
+
)}
|
|
189
|
+
{...props}
|
|
190
|
+
/>
|
|
191
|
+
))
|
|
192
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
|
|
193
|
+
|
|
194
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
195
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
196
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
197
|
+
>(({ className, ...props }, ref) => (
|
|
198
|
+
<DropdownMenuPrimitive.Separator
|
|
199
|
+
ref={ref}
|
|
200
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
201
|
+
{...props}
|
|
202
|
+
/>
|
|
203
|
+
))
|
|
204
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
|
|
205
|
+
|
|
206
|
+
const DropdownMenuShortcut = ({
|
|
207
|
+
className,
|
|
208
|
+
...props
|
|
209
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
210
|
+
return (
|
|
211
|
+
<span
|
|
212
|
+
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
|
|
213
|
+
{...props}
|
|
214
|
+
/>
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
|
|
218
|
+
|
|
219
|
+
type ExtendedDropdownMenuContentProps = Partial<
|
|
220
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
221
|
+
> & {
|
|
222
|
+
// Add any additional types or overrides here, for example:
|
|
223
|
+
// side?: "left" | "right" | "top" | "bottom"
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
type SubItem = {
|
|
227
|
+
label: string
|
|
228
|
+
value: string
|
|
229
|
+
highlighted?: boolean
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
type Item = {
|
|
233
|
+
label: string
|
|
234
|
+
value: string
|
|
235
|
+
highlighted?: boolean
|
|
236
|
+
subitems?: SubItem[] // Note the use of the optional modifier
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export const DropdownMenu = ({
|
|
240
|
+
trigger,
|
|
241
|
+
items,
|
|
242
|
+
direction,
|
|
243
|
+
onItemSelect,
|
|
244
|
+
sideOffset,
|
|
245
|
+
side,
|
|
246
|
+
className,
|
|
247
|
+
align,
|
|
248
|
+
alignOffset,
|
|
249
|
+
}: {
|
|
250
|
+
// ... other prop types
|
|
251
|
+
trigger?: any
|
|
252
|
+
items?: Item[]
|
|
253
|
+
direction?: "rtl" | "ltr"
|
|
254
|
+
onItemSelect?: any
|
|
255
|
+
className?: ExtendedDropdownMenuContentProps["className"]
|
|
256
|
+
sideOffset?: ExtendedDropdownMenuContentProps["sideOffset"]
|
|
257
|
+
side?: ExtendedDropdownMenuContentProps["side"]
|
|
258
|
+
align?: ExtendedDropdownMenuContentProps["align"]
|
|
259
|
+
alignOffset?: ExtendedDropdownMenuContentProps["alignOffset"]
|
|
260
|
+
// ... more prop types
|
|
261
|
+
}) => {
|
|
262
|
+
return (
|
|
263
|
+
<DropdownMenuRoot dir={direction}>
|
|
264
|
+
<DropdownMenuTrigger className="focus:ring-0">
|
|
265
|
+
{trigger}
|
|
266
|
+
</DropdownMenuTrigger>
|
|
267
|
+
<DropdownMenuPortal>
|
|
268
|
+
<DropdownMenuContent
|
|
269
|
+
side={side}
|
|
270
|
+
sideOffset={sideOffset}
|
|
271
|
+
className={cn(className)}
|
|
272
|
+
align={align}
|
|
273
|
+
alignOffset={alignOffset}
|
|
274
|
+
>
|
|
275
|
+
{items.map((item, index) => {
|
|
276
|
+
return item.subitems ? (
|
|
277
|
+
<DropdownMenuSub>
|
|
278
|
+
<DropdownMenuSubTrigger dir={direction}>
|
|
279
|
+
{item.label}
|
|
280
|
+
</DropdownMenuSubTrigger>
|
|
281
|
+
<DropdownMenuPortal>
|
|
282
|
+
<DropdownMenuSubContent>
|
|
283
|
+
{item.subitems.map((subitem, subIndex) => (
|
|
284
|
+
<DropdownMenuItem
|
|
285
|
+
onSelect={() => onItemSelect(subitem.value)}
|
|
286
|
+
key={subIndex}
|
|
287
|
+
>
|
|
288
|
+
{subitem.label}
|
|
289
|
+
</DropdownMenuItem>
|
|
290
|
+
))}
|
|
291
|
+
</DropdownMenuSubContent>
|
|
292
|
+
</DropdownMenuPortal>
|
|
293
|
+
</DropdownMenuSub>
|
|
294
|
+
) : (
|
|
295
|
+
<DropdownMenuItem
|
|
296
|
+
key={index}
|
|
297
|
+
onSelect={() => onItemSelect(item.value)}
|
|
298
|
+
>
|
|
299
|
+
{item.label}
|
|
300
|
+
</DropdownMenuItem>
|
|
301
|
+
)
|
|
302
|
+
})}
|
|
303
|
+
</DropdownMenuContent>
|
|
304
|
+
</DropdownMenuPortal>
|
|
305
|
+
</DropdownMenuRoot>
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// export {
|
|
310
|
+
// DropdownMenu,
|
|
311
|
+
// DropdownMenuTrigger,
|
|
312
|
+
// DropdownMenuContent,
|
|
313
|
+
// DropdownMenuItem,
|
|
314
|
+
// DropdownMenuCheckboxItem,
|
|
315
|
+
// DropdownMenuRadioItem,
|
|
316
|
+
// DropdownMenuLabel,
|
|
317
|
+
// DropdownMenuSeparator,
|
|
318
|
+
// DropdownMenuShortcut,
|
|
319
|
+
// DropdownMenuGroup,
|
|
320
|
+
// DropdownMenuPortal,
|
|
321
|
+
// DropdownMenuSub,
|
|
322
|
+
// DropdownMenuSubContent,
|
|
323
|
+
// DropdownMenuSubTrigger,
|
|
324
|
+
// DropdownMenuRadioGroup,
|
|
325
|
+
// }
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as SelectPrimitive from "@radix-ui/react-select"
|
|
5
|
+
// import { ChevronDown } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "../util"
|
|
8
|
+
|
|
9
|
+
const Select = SelectPrimitive.Root
|
|
10
|
+
|
|
11
|
+
const SelectGroup = SelectPrimitive.Group
|
|
12
|
+
|
|
13
|
+
const SelectValue = SelectPrimitive.Value
|
|
14
|
+
|
|
15
|
+
const SelectTrigger = React.forwardRef<
|
|
16
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
17
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
18
|
+
>(({ className, children, ...props }, ref) => (
|
|
19
|
+
<SelectPrimitive.Trigger
|
|
20
|
+
ref={ref}
|
|
21
|
+
className={cn(
|
|
22
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
<SelectPrimitive.Icon asChild>
|
|
29
|
+
{/* <ChevronDown className="h-4 w-4 opacity-50" /> */}
|
|
30
|
+
<svg
|
|
31
|
+
aria-label="Chevron Right Icon"
|
|
32
|
+
stroke="currentColor"
|
|
33
|
+
fill="currentColor"
|
|
34
|
+
stroke-width="0"
|
|
35
|
+
viewBox="0 0 16 16"
|
|
36
|
+
height="1em"
|
|
37
|
+
width="1em"
|
|
38
|
+
>
|
|
39
|
+
<path
|
|
40
|
+
fill-rule="evenodd"
|
|
41
|
+
d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
|
|
42
|
+
></path>
|
|
43
|
+
</svg>
|
|
44
|
+
</SelectPrimitive.Icon>
|
|
45
|
+
</SelectPrimitive.Trigger>
|
|
46
|
+
))
|
|
47
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
|
48
|
+
|
|
49
|
+
const SelectContent = React.forwardRef<
|
|
50
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
51
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
52
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
53
|
+
<SelectPrimitive.Portal>
|
|
54
|
+
<SelectPrimitive.Content
|
|
55
|
+
ref={ref}
|
|
56
|
+
className={cn(
|
|
57
|
+
"relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
58
|
+
position === "popper" &&
|
|
59
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
60
|
+
className
|
|
61
|
+
)}
|
|
62
|
+
position={position}
|
|
63
|
+
{...props}
|
|
64
|
+
>
|
|
65
|
+
<SelectPrimitive.Viewport
|
|
66
|
+
className={cn(
|
|
67
|
+
"p-1",
|
|
68
|
+
position === "popper" &&
|
|
69
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
70
|
+
)}
|
|
71
|
+
>
|
|
72
|
+
{children}
|
|
73
|
+
</SelectPrimitive.Viewport>
|
|
74
|
+
</SelectPrimitive.Content>
|
|
75
|
+
</SelectPrimitive.Portal>
|
|
76
|
+
))
|
|
77
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName
|
|
78
|
+
|
|
79
|
+
const SelectLabel = React.forwardRef<
|
|
80
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
81
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
82
|
+
>(({ className, ...props }, ref) => (
|
|
83
|
+
<SelectPrimitive.Label
|
|
84
|
+
ref={ref}
|
|
85
|
+
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
))
|
|
89
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
|
90
|
+
|
|
91
|
+
const SelectItem = React.forwardRef<
|
|
92
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
93
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
94
|
+
>(({ className, children, ...props }, ref) => (
|
|
95
|
+
<SelectPrimitive.Item
|
|
96
|
+
ref={ref}
|
|
97
|
+
className={cn(
|
|
98
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
99
|
+
className
|
|
100
|
+
)}
|
|
101
|
+
{...props}
|
|
102
|
+
>
|
|
103
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
104
|
+
<SelectPrimitive.ItemIndicator>
|
|
105
|
+
{/* <Check className="h-4 w-4" /> */}
|
|
106
|
+
<svg
|
|
107
|
+
aria-label="Check Mark"
|
|
108
|
+
stroke="currentColor"
|
|
109
|
+
fill="currentColor"
|
|
110
|
+
stroke-width="0"
|
|
111
|
+
viewBox="0 0 512 512"
|
|
112
|
+
height="0.60em"
|
|
113
|
+
width="0.60em"
|
|
114
|
+
>
|
|
115
|
+
<path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"></path>
|
|
116
|
+
</svg>
|
|
117
|
+
</SelectPrimitive.ItemIndicator>
|
|
118
|
+
</span>
|
|
119
|
+
|
|
120
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
121
|
+
</SelectPrimitive.Item>
|
|
122
|
+
))
|
|
123
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName
|
|
124
|
+
|
|
125
|
+
const SelectSeparator = React.forwardRef<
|
|
126
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
127
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
128
|
+
>(({ className, ...props }, ref) => (
|
|
129
|
+
<SelectPrimitive.Separator
|
|
130
|
+
ref={ref}
|
|
131
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
132
|
+
{...props}
|
|
133
|
+
/>
|
|
134
|
+
))
|
|
135
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
Select,
|
|
139
|
+
SelectGroup,
|
|
140
|
+
SelectValue,
|
|
141
|
+
SelectTrigger,
|
|
142
|
+
SelectContent,
|
|
143
|
+
SelectLabel,
|
|
144
|
+
SelectItem,
|
|
145
|
+
SelectSeparator,
|
|
146
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../util"
|
|
4
|
+
|
|
5
|
+
export interface TextareaProps
|
|
6
|
+
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
|
|
7
|
+
|
|
8
|
+
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
9
|
+
({ className, ...props }, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<textarea
|
|
12
|
+
className={cn(
|
|
13
|
+
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
ref={ref}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
Textarea.displayName = "Textarea"
|
|
23
|
+
|
|
24
|
+
export { Textarea }
|
package/src/elements/index.ts
CHANGED