@hobenakicoffee/libraries 1.11.0 → 1.13.0

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 (76) hide show
  1. package/README.md +25 -4
  2. package/package.json +84 -9
  3. package/src/App.tsx +28 -0
  4. package/src/components/turnstile-captcha.tsx +47 -0
  5. package/src/components/ui/alert-dialog.tsx +196 -0
  6. package/src/components/ui/alert.tsx +76 -0
  7. package/src/components/ui/avatar.tsx +110 -0
  8. package/src/components/ui/badge.tsx +49 -0
  9. package/src/components/ui/breadcrumb.tsx +122 -0
  10. package/src/components/ui/button-group.tsx +82 -0
  11. package/src/components/ui/button.tsx +77 -0
  12. package/src/components/ui/calendar.tsx +235 -0
  13. package/src/components/ui/card.tsx +100 -0
  14. package/src/components/ui/chart.tsx +364 -0
  15. package/src/components/ui/checkbox.tsx +30 -0
  16. package/src/components/ui/dialog.tsx +162 -0
  17. package/src/components/ui/drawer.tsx +126 -0
  18. package/src/components/ui/dropdown-menu.tsx +267 -0
  19. package/src/components/ui/empty-minimal.tsx +20 -0
  20. package/src/components/ui/empty.tsx +101 -0
  21. package/src/components/ui/field.tsx +235 -0
  22. package/src/components/ui/input-group.tsx +170 -0
  23. package/src/components/ui/input-otp.tsx +84 -0
  24. package/src/components/ui/input.tsx +37 -0
  25. package/src/components/ui/item.tsx +196 -0
  26. package/src/components/ui/label.tsx +19 -0
  27. package/src/components/ui/popover.tsx +87 -0
  28. package/src/components/ui/radio-group.tsx +47 -0
  29. package/src/components/ui/select.tsx +205 -0
  30. package/src/components/ui/separator.tsx +26 -0
  31. package/src/components/ui/sheet.tsx +141 -0
  32. package/src/components/ui/sidebar.tsx +699 -0
  33. package/src/components/ui/skeleton.tsx +13 -0
  34. package/src/components/ui/sonner.tsx +74 -0
  35. package/src/components/ui/spinner.tsx +18 -0
  36. package/src/components/ui/table.tsx +114 -0
  37. package/src/components/ui/tabs.tsx +88 -0
  38. package/src/components/ui/textarea.tsx +35 -0
  39. package/src/components/ui/toggle-group.tsx +91 -0
  40. package/src/components/ui/toggle.tsx +44 -0
  41. package/src/components/ui/tooltip.tsx +59 -0
  42. package/src/constants/common.test.ts +1 -1
  43. package/src/constants/legal.test.ts +1 -1
  44. package/src/constants/payment.test.ts +9 -9
  45. package/src/constants/platforms.test.ts +1 -1
  46. package/src/constants/services.test.ts +1 -1
  47. package/src/hooks/use-mobile.ts +19 -0
  48. package/src/index.css +135 -0
  49. package/src/lib/utils.ts +6 -0
  50. package/src/main.tsx +16 -0
  51. package/src/moderation/datasets/bn.ts +708 -708
  52. package/src/moderation/normalizer.test.ts +1 -1
  53. package/src/moderation/normalizer.ts +16 -16
  54. package/src/moderation/profanity-service.test.ts +3 -3
  55. package/src/providers/theme-provider.tsx +73 -0
  56. package/src/types/supabase.ts +751 -647
  57. package/src/utils/check-moderation.test.ts +12 -12
  58. package/src/utils/format-number.test.ts +1 -1
  59. package/src/utils/format-plain-text.test.ts +1 -1
  60. package/src/utils/get-social-handle.test.ts +3 -3
  61. package/src/utils/get-social-link.test.ts +9 -9
  62. package/src/utils/get-social-link.ts +5 -3
  63. package/src/utils/get-user-name-initials.test.ts +1 -1
  64. package/src/utils/get-user-name-initials.ts +4 -4
  65. package/src/utils/get-user-page-link.ts +1 -1
  66. package/src/utils/index.ts +5 -5
  67. package/src/utils/open-to-new-window.ts +3 -1
  68. package/src/utils/post-to-facebook.test.ts +1 -1
  69. package/src/utils/post-to-facebook.ts +9 -3
  70. package/src/utils/post-to-instagram.test.ts +1 -1
  71. package/src/utils/post-to-linkedin.test.ts +1 -1
  72. package/src/utils/post-to-linkedin.ts +9 -3
  73. package/src/utils/post-to-x.test.ts +1 -1
  74. package/src/utils/post-to-x.ts +12 -4
  75. package/src/utils/to-human-readable.ts +6 -2
  76. package/src/utils/validate-phone-number.test.ts +1 -1
@@ -0,0 +1,205 @@
1
+ import {
2
+ ArrowDown01Icon,
3
+ ArrowUp01Icon,
4
+ Tick02Icon,
5
+ UnfoldMoreIcon,
6
+ } from "@hugeicons/core-free-icons";
7
+ import { HugeiconsIcon } from "@hugeicons/react";
8
+ import { Select as SelectPrimitive } from "radix-ui";
9
+ import type * as React from "react";
10
+ import { cn } from "@/lib/utils";
11
+
12
+ function Select({
13
+ ...props
14
+ }: React.ComponentProps<typeof SelectPrimitive.Root>) {
15
+ return <SelectPrimitive.Root data-slot="select" {...props} />;
16
+ }
17
+
18
+ function SelectGroup({
19
+ className,
20
+ ...props
21
+ }: React.ComponentProps<typeof SelectPrimitive.Group>) {
22
+ return (
23
+ <SelectPrimitive.Group
24
+ className={cn("scroll-my-1 p-1", className)}
25
+ data-slot="select-group"
26
+ {...props}
27
+ />
28
+ );
29
+ }
30
+
31
+ function SelectValue({
32
+ ...props
33
+ }: React.ComponentProps<typeof SelectPrimitive.Value>) {
34
+ return <SelectPrimitive.Value data-slot="select-value" {...props} />;
35
+ }
36
+
37
+ function SelectTrigger({
38
+ className,
39
+ size = "default",
40
+ children,
41
+ ...props
42
+ }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
43
+ size?: "sm" | "default";
44
+ }) {
45
+ return (
46
+ <SelectPrimitive.Trigger
47
+ className={cn(
48
+ "flex w-fit items-center justify-between gap-1.5 whitespace-nowrap rounded-xl border border-input bg-transparent py-2 pr-2 pl-3 text-sm outline-none transition-[color] focus-visible:border-ring focus-visible:ring focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 data-[size=default]:h-12 data-[size=sm]:h-8 data-placeholder:text-muted-foregroun *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:hover:bg-input/50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
49
+ className
50
+ )}
51
+ data-size={size}
52
+ data-slot="select-trigger"
53
+ {...props}
54
+ >
55
+ {children}
56
+ <SelectPrimitive.Icon asChild>
57
+ <HugeiconsIcon
58
+ className="pointer-events-none size-4 text-muted-foreground"
59
+ icon={UnfoldMoreIcon}
60
+ strokeWidth={2}
61
+ />
62
+ </SelectPrimitive.Icon>
63
+ </SelectPrimitive.Trigger>
64
+ );
65
+ }
66
+
67
+ function SelectContent({
68
+ className,
69
+ children,
70
+ position = "item-aligned",
71
+ align = "center",
72
+ ...props
73
+ }: React.ComponentProps<typeof SelectPrimitive.Content>) {
74
+ return (
75
+ <SelectPrimitive.Portal>
76
+ <SelectPrimitive.Content
77
+ align={align}
78
+ className={cn(
79
+ "data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-y-auto overflow-x-hidden rounded-xl bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-closed:animate-out data-open:animate-in",
80
+ position === "popper" &&
81
+ "data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",
82
+ className
83
+ )}
84
+ data-slot="select-content"
85
+ position={position}
86
+ {...props}
87
+ >
88
+ <SelectScrollUpButton />
89
+ <SelectPrimitive.Viewport
90
+ className={cn(
91
+ "data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",
92
+ position === "popper" && ""
93
+ )}
94
+ data-position={position}
95
+ >
96
+ {children}
97
+ </SelectPrimitive.Viewport>
98
+ <SelectScrollDownButton />
99
+ </SelectPrimitive.Content>
100
+ </SelectPrimitive.Portal>
101
+ );
102
+ }
103
+
104
+ function SelectLabel({
105
+ className,
106
+ ...props
107
+ }: React.ComponentProps<typeof SelectPrimitive.Label>) {
108
+ return (
109
+ <SelectPrimitive.Label
110
+ className={cn("px-2 py-1.5 text-muted-foreground text-xs", className)}
111
+ data-slot="select-label"
112
+ {...props}
113
+ />
114
+ );
115
+ }
116
+
117
+ function SelectItem({
118
+ className,
119
+ children,
120
+ ...props
121
+ }: React.ComponentProps<typeof SelectPrimitive.Item>) {
122
+ return (
123
+ <SelectPrimitive.Item
124
+ className={cn(
125
+ "relative flex w-full cursor-default select-none items-center gap-2 rounded-lg py-3 pr-8 pl-4 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
126
+ className
127
+ )}
128
+ data-slot="select-item"
129
+ {...props}
130
+ >
131
+ <span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center">
132
+ <SelectPrimitive.ItemIndicator>
133
+ <HugeiconsIcon
134
+ className="pointer-events-none"
135
+ icon={Tick02Icon}
136
+ strokeWidth={2}
137
+ />
138
+ </SelectPrimitive.ItemIndicator>
139
+ </span>
140
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
141
+ </SelectPrimitive.Item>
142
+ );
143
+ }
144
+
145
+ function SelectSeparator({
146
+ className,
147
+ ...props
148
+ }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
149
+ return (
150
+ <SelectPrimitive.Separator
151
+ className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
152
+ data-slot="select-separator"
153
+ {...props}
154
+ />
155
+ );
156
+ }
157
+
158
+ function SelectScrollUpButton({
159
+ className,
160
+ ...props
161
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
162
+ return (
163
+ <SelectPrimitive.ScrollUpButton
164
+ className={cn(
165
+ "z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
166
+ className
167
+ )}
168
+ data-slot="select-scroll-up-button"
169
+ {...props}
170
+ >
171
+ <HugeiconsIcon icon={ArrowUp01Icon} strokeWidth={2} />
172
+ </SelectPrimitive.ScrollUpButton>
173
+ );
174
+ }
175
+
176
+ function SelectScrollDownButton({
177
+ className,
178
+ ...props
179
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
180
+ return (
181
+ <SelectPrimitive.ScrollDownButton
182
+ className={cn(
183
+ "z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
184
+ className
185
+ )}
186
+ data-slot="select-scroll-down-button"
187
+ {...props}
188
+ >
189
+ <HugeiconsIcon icon={ArrowDown01Icon} strokeWidth={2} />
190
+ </SelectPrimitive.ScrollDownButton>
191
+ );
192
+ }
193
+
194
+ export {
195
+ Select,
196
+ SelectContent,
197
+ SelectGroup,
198
+ SelectItem,
199
+ SelectLabel,
200
+ SelectScrollDownButton,
201
+ SelectScrollUpButton,
202
+ SelectSeparator,
203
+ SelectTrigger,
204
+ SelectValue,
205
+ };
@@ -0,0 +1,26 @@
1
+ import { Separator as SeparatorPrimitive } from "radix-ui";
2
+ import type * as React from "react";
3
+
4
+ import { cn } from "@/lib/utils";
5
+
6
+ function Separator({
7
+ className,
8
+ orientation = "horizontal",
9
+ decorative = true,
10
+ ...props
11
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
12
+ return (
13
+ <SeparatorPrimitive.Root
14
+ className={cn(
15
+ "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",
16
+ className
17
+ )}
18
+ data-slot="separator"
19
+ decorative={decorative}
20
+ orientation={orientation}
21
+ {...props}
22
+ />
23
+ );
24
+ }
25
+
26
+ export { Separator };
@@ -0,0 +1,141 @@
1
+ import { Cancel01Icon } from "@hugeicons/core-free-icons";
2
+ import { HugeiconsIcon } from "@hugeicons/react";
3
+ import { Dialog as SheetPrimitive } from "radix-ui";
4
+ import type * as React from "react";
5
+ import { Button } from "@/components/ui/button";
6
+ import { cn } from "@/lib/utils";
7
+
8
+ function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
9
+ return <SheetPrimitive.Root data-slot="sheet" {...props} />;
10
+ }
11
+
12
+ function SheetTrigger({
13
+ ...props
14
+ }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
15
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
16
+ }
17
+
18
+ function SheetClose({
19
+ ...props
20
+ }: React.ComponentProps<typeof SheetPrimitive.Close>) {
21
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
22
+ }
23
+
24
+ function SheetPortal({
25
+ ...props
26
+ }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
27
+ return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
28
+ }
29
+
30
+ function SheetOverlay({
31
+ className,
32
+ ...props
33
+ }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
34
+ return (
35
+ <SheetPrimitive.Overlay
36
+ className={cn(
37
+ "data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 z-50 bg-black/10 duration-100 data-closed:animate-out data-open:animate-in data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",
38
+ className
39
+ )}
40
+ data-slot="sheet-overlay"
41
+ {...props}
42
+ />
43
+ );
44
+ }
45
+
46
+ function SheetContent({
47
+ className,
48
+ children,
49
+ side = "right",
50
+ showCloseButton = true,
51
+ ...props
52
+ }: React.ComponentProps<typeof SheetPrimitive.Content> & {
53
+ side?: "top" | "right" | "bottom" | "left";
54
+ showCloseButton?: boolean;
55
+ }) {
56
+ return (
57
+ <SheetPortal>
58
+ <SheetOverlay />
59
+ <SheetPrimitive.Content
60
+ className={cn(
61
+ "data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=top]:inset-x-0 data-[side=left]:inset-y-0 data-[side=right]:inset-y-0 data-[side=top]:top-0 data-[side=right]:right-0 data-[side=bottom]:bottom-0 data-[side=left]:left-0 data-[side=bottom]:h-auto data-[side=left]:h-full data-[side=right]:h-full data-[side=top]:h-auto data-[side=left]:w-3/4 data-[side=right]:w-3/4 data-closed:animate-out data-open:animate-in data-[side=bottom]:border-t data-[side=left]:border-r data-[side=top]:border-b data-[side=right]:border-l data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
62
+ className
63
+ )}
64
+ data-side={side}
65
+ data-slot="sheet-content"
66
+ {...props}
67
+ >
68
+ {children}
69
+ {showCloseButton && (
70
+ <SheetPrimitive.Close asChild data-slot="sheet-close">
71
+ <Button
72
+ className="absolute top-4 right-4"
73
+ size="icon-sm"
74
+ variant="ghost"
75
+ >
76
+ <HugeiconsIcon icon={Cancel01Icon} strokeWidth={2} />
77
+ <span className="sr-only">Close</span>
78
+ </Button>
79
+ </SheetPrimitive.Close>
80
+ )}
81
+ </SheetPrimitive.Content>
82
+ </SheetPortal>
83
+ );
84
+ }
85
+
86
+ function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
87
+ return (
88
+ <div
89
+ className={cn("flex flex-col gap-1.5 p-4", className)}
90
+ data-slot="sheet-header"
91
+ {...props}
92
+ />
93
+ );
94
+ }
95
+
96
+ function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
97
+ return (
98
+ <div
99
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
100
+ data-slot="sheet-footer"
101
+ {...props}
102
+ />
103
+ );
104
+ }
105
+
106
+ function SheetTitle({
107
+ className,
108
+ ...props
109
+ }: React.ComponentProps<typeof SheetPrimitive.Title>) {
110
+ return (
111
+ <SheetPrimitive.Title
112
+ className={cn("font-medium text-foreground text-lg", className)}
113
+ data-slot="sheet-title"
114
+ {...props}
115
+ />
116
+ );
117
+ }
118
+
119
+ function SheetDescription({
120
+ className,
121
+ ...props
122
+ }: React.ComponentProps<typeof SheetPrimitive.Description>) {
123
+ return (
124
+ <SheetPrimitive.Description
125
+ className={cn("text-muted-foreground text-sm", className)}
126
+ data-slot="sheet-description"
127
+ {...props}
128
+ />
129
+ );
130
+ }
131
+
132
+ export {
133
+ Sheet,
134
+ SheetTrigger,
135
+ SheetClose,
136
+ SheetContent,
137
+ SheetHeader,
138
+ SheetFooter,
139
+ SheetTitle,
140
+ SheetDescription,
141
+ };